Certificate Command

This commit is contained in:
Dragon Fire
2020-04-20 22:13:36 -04:00
parent 1a04990030
commit 7d24638315
5 changed files with 77 additions and 1 deletions
+5
View File
@@ -671,6 +671,8 @@ here.
* doomsday-clock ([Doomsday Clock Data](https://thebulletin.org/doomsday-clock/current-time/))
- [cheesecakejedi](https://imgur.com/user/cheesecakejedi)
* axis-cult-sign-up ([Image](https://imgur.com/gallery/quQTD))
- [Cheng Xiao](https://www.instagram.com/chengxiao_0715/)
* certificate (Signature)
- [Christoph Mueller](https://www.fontsquirrel.com/fonts/list/foundry/christoph-mueller)
* captcha ([Moms Typewriter Font](https://www.fontsquirrel.com/fonts/MomsTypewriter))
- [Chuck Norris](https://chucknorris.com/)
@@ -690,6 +692,8 @@ here.
* sip ([Image](http://search.coolclips.com/m/vector/hand0007/Hands-holding-mug/))
- [cowsay Online](http://cowsay.morecode.org/)
* cow-say (API)
- [Creative Certificates](https://www.creativecertificates.com/)
* certificate ([Image](https://www.creativecertificates.com/award-certificate-templates/))
- [Danbooru](https://danbooru.donmai.us/)
* danbooru (API)
- [Dance Dance Revolution](https://www.ddrgame.com/)
@@ -914,6 +918,7 @@ here.
* minecraft-skin ([API, Original "Minecraft" Game](https://wiki.vg/Mojang_API))
- [Monotype](https://www.monotype.com/)
* be-like-bill ([Arial Font](https://catalog.monotype.com/family/monotype/arial))
* certificate ([Old English Text MT Font](https://catalog.monotype.com/family/monotype/monotype-old-english-text))
- [Monty Hall problem](https://en.wikipedia.org/wiki/Monty_Hall_problem)
* doors (Concept)
- [MotivaShian](https://www.youtube.com/channel/UC0yDCpC_UaXEdL6Zc4715rg)
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

+71
View File
@@ -0,0 +1,71 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const moment = require('moment');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'oldengl.ttf'), { family: 'Old English Text MT' });
module.exports = class CertificateCommand extends Command {
constructor(client) {
super(client, {
name: 'certificate',
aliases: ['award', 'certificate-of-excellence'],
group: 'edit-image',
memberName: 'certificate',
description: 'Sends a certificate of excellence with the name and reason of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Creative Certificates',
url: 'https://www.creativecertificates.com/',
reason: 'Image',
reasonURL: 'https://www.creativecertificates.com/award-certificate-templates/'
},
{
name: 'Cheng Xiao',
url: 'https://www.instagram.com/chengxiao_0715/',
reason: 'Signature'
},
{
name: 'Monotype',
url: 'https://www.monotype.com/',
reason: 'Old English Text MT Font',
reasonURL: 'https://catalog.monotype.com/family/monotype/monotype-old-english-text'
}
],
args: [
{
key: 'reason',
prompt: 'What is the reason for the award?',
type: 'string',
max: 30
},
{
key: 'name',
prompt: 'What is the name of the person recieving the award?',
type: 'string',
max: 30,
default: msg => msg.author.username
}
]
});
}
async run(msg, { reason, name }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'certificate.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '30px Old English Text MT';
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
ctx.fillText(reason, 518, 273);
ctx.fillText(name, 518, 419);
ctx.fillText(moment().format('MM/DD/YYYY'), 309, 503);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'certificate.png' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "113.8.0",
"version": "113.9.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {