From 2f55ceff2cab07e745cc73b42219f49ef44a1a80 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Wed, 17 Jul 2019 13:55:04 -0400 Subject: [PATCH] URL Decode Command --- README.md | 3 ++- commands/text-edit/uri-decode.js | 28 ++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 commands/text-edit/uri-decode.js diff --git a/README.md b/README.md index c585b372..65a62569 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Xiao is a Discord bot coded in JavaScript with 6. Run `npm i -g pm2` to install PM2. 7. Run `pm2 start Xiao.js --name xiao` to run the bot. -## Commands (342) +## Commands (343) ### Utility: * **eval:** Executes JavaScript code. @@ -394,6 +394,7 @@ Xiao is a Discord bot coded in JavaScript with * **unspoiler:** Removes all spoilers from text. * **uppercase:** Converts text to uppercase. * **upside-down:** Flips text upside-down. +* **url-decode:** Decodes URL characters to regular characters. * **url-encode:** Encodes text to URL-friendly characters. * **webhook:** Posts a message to the webhook defined in the bot owner's `process.env`. * **yoda:** Converts text to Yoda speak. diff --git a/commands/text-edit/uri-decode.js b/commands/text-edit/uri-decode.js new file mode 100644 index 00000000..0da6abc1 --- /dev/null +++ b/commands/text-edit/uri-decode.js @@ -0,0 +1,28 @@ +const Command = require('../../structures/Command'); + +module.exports = class URLDecodeCommand extends Command { + constructor(client) { + super(client, { + name: 'url-decode', + aliases: ['decode-url', 'decode-uri', 'uri-decode', 'decode-uri-component'], + group: 'text-edit', + memberName: 'url-decode', + description: 'Decodes URL characters to regular characters.', + args: [ + { + key: 'text', + prompt: 'What text would you like to decode?', + type: 'string', + validate: text => { + if (decodeURIComponent(text).length < 2000) return true; + return 'Invalid text, your text is too long.'; + } + } + ] + }); + } + + run(msg, { text }) { + return msg.say(decodeURIComponent(text)); + } +}; diff --git a/package.json b/package.json index 985f5f2d..46ec257d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "107.1.0", + "version": "107.2.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {