diff --git a/assets/images/simp.png b/assets/images/simp.png deleted file mode 100644 index 8c1d0b31..00000000 Binary files a/assets/images/simp.png and /dev/null differ diff --git a/commands/edit-image/minecraft-skin.js b/commands/edit-image/minecraft-skin.js deleted file mode 100644 index f9900850..00000000 --- a/commands/edit-image/minecraft-skin.js +++ /dev/null @@ -1,55 +0,0 @@ -const Command = require('../../framework/Command'); -const request = require('node-superfetch'); -const { list } = require('../../util/Util'); -const types = ['face', 'front', 'frontfull', 'head', 'bust', 'full', 'skin']; - -module.exports = class MinecraftSkinCommand extends Command { - constructor(client) { - super(client, { - name: 'minecraft-skin', - aliases: ['mc-skin'], - group: 'edit-image', - memberName: 'minecraft-skin', - description: 'Sends the Minecraft skin for a user.', - details: `**Types:** ${types.join(', ')}`, - clientPermissions: ['ATTACH_FILES'], - credit: [ - { - name: 'Mojang', - url: 'https://www.mojang.com/', - reason: 'API, Original "Minecraft" Game', - reasonURL: 'https://wiki.vg/Mojang_API' - } - ], - args: [ - { - key: 'user', - prompt: 'What user would you like to get the skin of?', - type: 'string', - parse: user => encodeURIComponent(user) - }, - { - key: 'type', - prompt: `What type should the skin be rendered in? Either ${list(types, 'or')}.`, - type: 'string', - default: 'full', - validate: type => { - if (types.includes(type.toLowerCase())) return true; - return `Invalid type, please enter either ${list(types, 'or')}.`; - }, - parse: type => type.toLowerCase() - } - ] - }); - } - - async run(msg, { user, type }) { - try { - const search = await request.get(`https://api.mojang.com/users/profiles/minecraft/${user}`); - if (search.status === 204) return msg.say('Could not find any results.'); - return msg.say({ files: [`https://visage.surgeplay.com/${type}/512/${search.body.id}.png`] }); - } catch (err) { - return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); - } - } -}; diff --git a/commands/edit-image/simp.js b/commands/edit-image/simp.js deleted file mode 100644 index 18a83f33..00000000 --- a/commands/edit-image/simp.js +++ /dev/null @@ -1,55 +0,0 @@ -const Command = require('../../framework/Command'); -const { createCanvas, loadImage } = require('canvas'); -const request = require('node-superfetch'); -const path = require('path'); -const { centerImage } = require('../../util/Canvas'); - -module.exports = class SimpCommand extends Command { - constructor(client) { - super(client, { - name: 'simp', - group: 'edit-image', - memberName: 'simp', - description: 'Draws a "simp" stamp over an image or a user\'s avatar.', - throttling: { - usages: 2, - duration: 10 - }, - clientPermissions: ['ATTACH_FILES'], - credit: [ - { - name: 'World of Tanks', - url: 'https://worldoftanks.com/', - reason: 'Image', - reasonURL: 'https://worldoftanks.com/es-ar/content/silver-league/open-standings/' - } - ], - args: [ - { - key: 'image', - prompt: 'What image would you like to edit?', - type: 'image-or-avatar', - default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) - } - ] - }); - } - - async run(msg, { image }) { - try { - const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'simp.png')); - const { body } = await request.get(image); - const data = await loadImage(body); - const canvas = createCanvas(data.width, data.height); - const ctx = canvas.getContext('2d'); - ctx.drawImage(data, 0, 0); - const { x, y, width, height } = centerImage(base, data); - ctx.drawImage(base, x, y, width, height); - const attachment = canvas.toBuffer(); - if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); - return msg.say({ files: [{ attachment, name: 'simp.png' }] }); - } catch (err) { - return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); - } - } -}; diff --git a/commands/edit-image/sketch.js b/commands/edit-image/sketch.js index bd061ffc..cd57863e 100644 --- a/commands/edit-image/sketch.js +++ b/commands/edit-image/sketch.js @@ -37,12 +37,14 @@ module.exports = class SketchCommand extends Command { async run(msg, { image }) { try { const { body } = await request.get(image); + await reactIfAble(msg, this.client.user, LOADING_EMOJI_ID, '💬'); const magik = gm(body); magik.colorspace('gray'); magik.out('-sketch'); magik.out('0x20+120'); magik.setFormat('png'); const attachment = await magikToBuffer(magik); + reactIfAble(res, res.author, SUCCESS_EMOJI_ID, '✅'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'sketch.png' }] }); } catch (err) { diff --git a/framework/types/user.js b/framework/types/user.js index 61271c00..87e98866 100644 --- a/framework/types/user.js +++ b/framework/types/user.js @@ -49,5 +49,5 @@ function memberFilterExact(search) { function memberFilterInexact(search) { return mem => mem.user.username.toLowerCase().includes(search) || (mem.nickname && mem.nickname.toLowerCase().includes(search)) - || mem.tag.toLowerCase().includes(search); + || mem.user.tag.toLowerCase().includes(search); }