diff --git a/assets/images/raw.png b/assets/images/raw.png new file mode 100644 index 00000000..4626b7e5 Binary files /dev/null and b/assets/images/raw.png differ diff --git a/commands/edit-meme/raw.js b/commands/edit-meme/raw.js new file mode 100644 index 00000000..3abc5f1c --- /dev/null +++ b/commands/edit-meme/raw.js @@ -0,0 +1,55 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage } = require('canvas'); +const path = require('path'); + +module.exports = class RawCommand extends Command { + constructor(client) { + super(client, { + name: 'raw', + aliases: ['doing-it-raw'], + group: 'edit-meme', + memberName: 'raw', + description: 'Sends a "Give me x, and I wouldn\'t mind doing it raw!" meme with the text of your choice.', + nsfw: true, + throttling: { + usages: 2, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Inside Scanlation', + url: 'https://www.insidescanlation.com/', + reason: 'Wild Words Font', + // eslint-disable-next-line max-len + reasonURL: 'https://www.insidescanlation.com/etc/the-idiots-guide-to-editing-manga/guide/type/fonts.html' + } + ], + args: [ + { + key: 'text', + prompt: 'What makes her want to do it raw?', + type: 'string', + max: 100 + } + ] + }); + } + + async run(msg, { text }) { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'raw.png')); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0); + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + ctx.font = this.client.fonts.get('wildwordsroman.ttf').toCanvasString(24); + let fontSize = 24; + while (ctx.measureText(text).width > 168) { + fontSize--; + ctx.font = this.client.fonts.get('wildwordsroman.ttf').toCanvasString(fontSize); + } + ctx.fillText(text, 520, 142); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'raw.png' }] }); + } +}; diff --git a/package.json b/package.json index 346ca9da..fb13a940 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "135.6.0", + "version": "135.7.0", "description": "Your personal server companion.", "main": "Xiao.js", "private": true,