diff --git a/README.md b/README.md index 4a983090..2c402c4a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/assets/fonts/oldengl.ttf b/assets/fonts/oldengl.ttf new file mode 100644 index 00000000..bed2c5bf Binary files /dev/null and b/assets/fonts/oldengl.ttf differ diff --git a/assets/images/certificate.png b/assets/images/certificate.png new file mode 100644 index 00000000..abb20128 Binary files /dev/null and b/assets/images/certificate.png differ diff --git a/commands/edit-image/certificate.js b/commands/edit-image/certificate.js new file mode 100644 index 00000000..16b315f4 --- /dev/null +++ b/commands/edit-image/certificate.js @@ -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' }] }); + } +}; + diff --git a/package.json b/package.json index 7ff6fc0d..bfe573a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "113.8.0", + "version": "113.9.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {