diff --git a/assets/images/be-like-bill.png b/assets/images/be-like-bill.png new file mode 100644 index 00000000..51f88b9d Binary files /dev/null and b/assets/images/be-like-bill.png differ diff --git a/assets/json/be-like-bill.json b/assets/json/be-like-bill.json new file mode 100644 index 00000000..c525026c --- /dev/null +++ b/assets/json/be-like-bill.json @@ -0,0 +1,32 @@ +[ + "{{name}} has a girlfriend, but he\ndoesn't post 56 photos a day about it.\n{{name}} likes to keep these things private.", + "{{name}} is on the internet.\n{{name}} sees something that offends him.\n{{name}} moves on.", + "{{name}} doesn't spam his friends\nwith Be Like Bill memes.", + "{{name}} doesn't drive with his\nfog lights on when it isn't foggy.\n{{name}} knows this is annoying\nand dazzles other drivers.", + "{{name}} doesn't talk to a friend when\nthat friend just woke up.", + "{{name}} can afford a Mac but he\ngets a PC instead because\n{{name}} is not a dumbass.", + "{{name}} does not play Candy Crush.\n{{name}} has a life.", + "{{name}} is a jerk.", + "{{name}} wakes up and sees it snowing outside.\n{{name}} doesn't post about it because\nhe knows his friends also have windows.", + "{{name}} knows tomorrow is Monday.\n{{name}} doesn't post about it, becuase\nhe knows it happens every week.", + "{{name}} doesn't shout at the TV\nwhen football is on.\n{{name}} knows they can't hear him.", + "{{name}} pays attention in class instead of\nchatting with his friends on Discord.", + "{{name}} has a good camera.\n{{name}} doesn't take useless photos\nand call himself a photographer.", + "{{name}} doesn't beg for his PRs to get\nmerged when he had three merged today.", + "{{name}} is a bad meme.\n{{name}} has a good sense of humor about it.", + "{{name}} likes to play games with his nephew.\n{{name}} lets him win all the time.", + "{{name}} meets Della.\n{{name}} loves Della.\nDella loves {{name}}.\n{{name}} and Della dump social networks.", + "{{name}} sees your picture has only three likes.\n{{name}} presses like and comments\nwith a compliement.", + "{{name}} bought a new car.\n{{name}} doesn't post pictures\nand tag 49 others about it.", + "{{name}} is nice.", + "{{name}} has the heart to tell the truth\nwhen his friends don't look very good.", + "{{name}} likes dogs.\n{{name}} doesn't bring his dogs\nto your house uninvited.", + "{{name}} likes to go bowling.\n{{name}} doesn't put up bumpers.", + "{{name}} eats pant.", + "{{name}} likes to use XiaoBot.\n{{name}} doesn't complain when\nit goes closed source.", + "{{name}} loves to buy shoes.\n{{name}} doesn't buy 200 pairs for no reason.", + "{{name}} doesn't like dogs.\n{{name}} doesn't complain on the internet\nbecause he knows no one cares.", + "{{name}}.\nEnough said.", + "{{name}} is a butt.", + "{{name}} knows." +] diff --git a/commands/image-edit/be-like-bill.js b/commands/image-edit/be-like-bill.js index 012ad43f..d464bbb4 100644 --- a/commands/image-edit/be-like-bill.js +++ b/commands/image-edit/be-like-bill.js @@ -1,5 +1,11 @@ const Command = require('../../structures/Command'); -const snekfetch = require('snekfetch'); +const { createCanvas, loadImage, registerFont } = require('canvas'); +const { stripIndents } = require('common-tags'); +const path = require('path'); +const texts = require('../../assets/json/be-like-bill'); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto.ttf'), { family: 'Noto' }); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' }); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' }); module.exports = class BeLikeBillCommand extends Command { constructor(client) { @@ -9,6 +15,10 @@ module.exports = class BeLikeBillCommand extends Command { group: 'image-edit', memberName: 'be-like-bill', description: 'Sends a "Be Like Bill" meme with the name of your choice.', + throttling: { + usages: 1, + duration: 15 + }, clientPermissions: ['ATTACH_FILES'], args: [ { @@ -21,15 +31,23 @@ module.exports = class BeLikeBillCommand extends Command { }); } - async run(msg, { name }) { + run(msg, { name }) { try { - const { body } = await snekfetch - .get('http://belikebill.azurewebsites.net/billgen-API.php') - .query({ - default: 1, - name - }); - return msg.say({ files: [{ attachment: body, name: 'be-like-bill.png' }] }); + const canvas = createCanvas(800, 420); + const ctx = canvas.getContext('2d'); + const base = loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'be-like-bill.png')); + ctx.drawImage(base, 0, 0); + ctx.font = '23px Noto'; + const text = stripIndents` + This is ${name}. + + ${texts[Math.floor(Math.random() * texts.length)].replace(/{{name}}/gi, name)} + + ${name} is smart. + Be like ${name}. + `; + ctx.fillText(text, 31, 80); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'be-like-bill.png' }] }); } catch (err) { return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } diff --git a/commands/image-edit/color.js b/commands/image-edit/color.js index 41d3f92c..248c5e7a 100644 --- a/commands/image-edit/color.js +++ b/commands/image-edit/color.js @@ -9,6 +9,10 @@ module.exports = class ColorCommand extends Command { group: 'image-edit', memberName: 'color', description: 'Sends an image of the color you choose.', + throttling: { + usages: 1, + duration: 15 + }, clientPermissions: ['ATTACH_FILES'], args: [ { diff --git a/package.json b/package.json index 5f8013cd..ea46b16e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "42.12.2", + "version": "42.12.3", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {