diff --git a/commands/edit-image/color.js b/commands/edit-image/color.js index ace11f9f..97a267a0 100644 --- a/commands/edit-image/color.js +++ b/commands/edit-image/color.js @@ -1,5 +1,6 @@ const Command = require('../../structures/Command'); const { createCanvas } = require('canvas'); +const ntc = require('ntcjs'); module.exports = class ColorCommand extends Command { constructor(client) { @@ -17,9 +18,9 @@ module.exports = class ColorCommand extends Command { args: [ { key: 'color', - prompt: 'What color do you want to view? This can be #colorcode or a name.', + prompt: 'What color do you want to view? This must be a #colorcode.', type: 'string', - parse: color => color.toLowerCase() + validate: color => /^#[0-9A-F]{6}$/i.test(color) } ] }); @@ -28,8 +29,11 @@ module.exports = class ColorCommand extends Command { run(msg, { color }) { const canvas = createCanvas(250, 250); const ctx = canvas.getContext('2d'); - ctx.fillStyle = color; + const name = ntc.name(color); + ctx.fillStyle = color.toLowerCase(); ctx.fillRect(0, 0, 250, 250); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'color.png' }] }); + return msg.say(`#${color.toUpperCase()} - ${name[1]}`, { + files: [{ attachment: canvas.toBuffer(), name: 'color.png' }] + }); } }; diff --git a/package.json b/package.json index fb13a940..3fd18a7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "135.7.0", + "version": "136.0.0", "description": "Your personal server companion.", "main": "Xiao.js", "private": true, @@ -70,6 +70,7 @@ "moment-timezone": "^0.5.33", "node-superfetch": "^0.2.2", "nsfwjs": "^2.4.0", + "ntcjs": "^1.1.2", "parse-domain": "^3.0.3", "pokersolver": "^2.1.4", "random-js": "^2.1.0",