diff --git a/commands/edit-text/html-decode.js b/commands/edit-text/html-decode.js new file mode 100644 index 00000000..eb64b1e5 --- /dev/null +++ b/commands/edit-text/html-decode.js @@ -0,0 +1,29 @@ +const Command = require('../../structures/Command'); +const { decode: decodeHTML } = require('html-entities'); + +module.exports = class HtmlDecodeCommand extends Command { + constructor(client) { + super(client, { + name: 'html-decode', + aliases: ['decode-html'], + group: 'edit-text', + memberName: 'html-decode', + description: 'Decodes HTML characters to regular characters.', + args: [ + { + key: 'text', + prompt: 'What text would you like to decode?', + type: 'string', + validate: text => { + if (decodeHTML(text).length < 2000) return true; + return 'Invalid text, your text is too long.'; + } + } + ] + }); + } + + run(msg, { text }) { + return msg.say(decodeHTML(text)); + } +}; diff --git a/package.json b/package.json index 43661488..aa895ca2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "132.7.0", + "version": "132.8.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {