From a1c6d8d155cdccf3596f2a647c9086f4283ae69e Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 12 Sep 2018 17:07:55 +0000 Subject: [PATCH] Wrap text in be like bill --- assets/json/be-like-bill.json | 52 ++++++++++++++--------------- commands/image-edit/be-like-bill.js | 7 ++-- commands/image-edit/nike-ad.js | 6 ++-- package.json | 2 +- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/assets/json/be-like-bill.json b/assets/json/be-like-bill.json index c44a0aa3..c9e33758 100644 --- a/assets/json/be-like-bill.json +++ b/assets/json/be-like-bill.json @@ -1,33 +1,33 @@ [ - "{{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}} has a girlfriend, but he doesn't post 56 photos a day about it. {{name}} likes to keep these things private.", + "{{name}} is on the internet. {{name}} sees something that offends him. {{name}} moves on.", + "{{name}} doesn't spam his friends with Be Like Bill memes.", + "{{name}} doesn't drive with his fog lights on when it isn't foggy. {{name}} knows this is annoying and dazzles other drivers.", + "{{name}} doesn't talk to a friend when that friend just woke up.", + "{{name}} can afford a Mac but he gets a PC instead because {{name}} is not a dumbass.", + "{{name}} does not play Candy Crush. {{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, because\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}} wakes up and sees it snowing outside. {{name}} doesn't post about it because he knows his friends also have windows.", + "{{name}} knows tomorrow is Monday. {{name}} doesn't post about it, because he knows it happens every week.", + "{{name}} doesn't shout at the TV when football is on. {{name}} knows they can't hear him.", + "{{name}} pays attention in class instead of chatting with his friends on Discord.", + "{{name}} has a good camera. {{name}} doesn't take useless photos and call himself a photographer.", + "{{name}} doesn't beg for his PRs to get merged when he had three merged today.", + "{{name}} is a bad meme. {{name}} has a good sense of humor about it.", + "{{name}} likes to play games with his nephew. {{name}} lets him win all the time.", + "{{name}} meets Della. {{name}} loves Della. Della loves {{name}}. {{name}} and Della dump social networks.", + "{{name}} sees your picture has only three likes. {{name}} presses like and comments with a compliement.", + "{{name}} bought a new car. {{name}} doesn't post pictures and 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}} has the heart to tell the truth when his friends don't look very good.", + "{{name}} likes dogs. {{name}} doesn't bring his dogs to your house uninvited.", + "{{name}} likes to go bowling. {{name}} doesn't put up bumpers.", "{{name}} eats pant.", - "{{name}} likes to use Xiao.\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}} likes to use Xiao. {{name}} doesn't complain when it goes closed source.", + "{{name}} loves to buy shoes. {{name}} doesn't buy 200 pairs for no reason.", + "{{name}} doesn't like dogs. {{name}} doesn't complain on the internet because he knows no one cares.", + "{{name}}. Enough said.", "{{name}} is a butt.", "{{name}} knows.", - "{{name}} uses Discord's dark theme\nso he doesn't go blind." + "{{name}} uses Discord's dark theme so he doesn't go blind." ] diff --git a/commands/image-edit/be-like-bill.js b/commands/image-edit/be-like-bill.js index 8e43b618..2402e7ba 100644 --- a/commands/image-edit/be-like-bill.js +++ b/commands/image-edit/be-like-bill.js @@ -2,6 +2,7 @@ const Command = require('../../structures/Command'); const { createCanvas, loadImage, registerFont } = require('canvas'); const { stripIndents } = require('common-tags'); const path = require('path'); +const { wrapText } = require('../../util/Canvas'); const texts = require('../../assets/json/be-like-bill'); registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' }); registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' }); @@ -25,7 +26,8 @@ module.exports = class BeLikeBillCommand extends Command { key: 'name', prompt: 'What should the name on the meme be?', type: 'string', - default: 'Bill' + default: 'Bill', + max: 20 } ] }); @@ -37,10 +39,11 @@ module.exports = class BeLikeBillCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(base, 0, 0); ctx.font = '23px Noto'; + const text = wrapText(ctx, texts[Math.floor(Math.random() * texts.length)].replace(/{{name}}/gi, name), 600 - 31); ctx.fillText(stripIndents` This is ${name}. - ${texts[Math.floor(Math.random() * texts.length)].replace(/{{name}}/gi, name)} + ${text.join('\n')} ${name} is smart. Be like ${name}. diff --git a/commands/image-edit/nike-ad.js b/commands/image-edit/nike-ad.js index ef3470d6..d84129f3 100644 --- a/commands/image-edit/nike-ad.js +++ b/commands/image-edit/nike-ad.js @@ -25,15 +25,13 @@ module.exports = class NikeAdCommand extends Command { key: 'something', prompt: 'What should the something to believe in be?', type: 'string', - max: 50, - parse: something => something.toLowerCase() + max: 50 }, { key: 'sacrifice', prompt: 'What should believing result in (e.g. sacrificing everything)?', type: 'string', - max: 50, - parse: sacrifice => sacrifice.toLowerCase() + max: 50 }, { key: 'image', diff --git a/package.json b/package.json index 851cd322..9f2a206e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "91.1.4", + "version": "91.1.5", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {