From 61fad7f019c82d435b92bf897eb65b9f5045877e Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 30 Jan 2021 13:19:50 -0500 Subject: [PATCH] Valid URL Command --- README.md | 3 ++- commands/analyze/valid-url.js | 27 +++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 commands/analyze/valid-url.js diff --git a/README.md b/README.md index 5cf3e8c8..1b2ec690 100644 --- a/README.md +++ b/README.md @@ -261,7 +261,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 586 +Total: 587 ### Utility: @@ -560,6 +560,7 @@ Total: 586 * **scrabble-score:** Responds with the scrabble score of a word. * **severe-toxicity:** Determines the toxicity of text, but less sensitive to milder language. * **toxicity:** Determines the toxicity of text. +* **valid-url:** Tests whether a URL is valid or not. * **what-anime:** Determines what anime a screenshot is from. * **zodiac-sign:** Responds with the Zodiac Sign for the given month/day. diff --git a/commands/analyze/valid-url.js b/commands/analyze/valid-url.js new file mode 100644 index 00000000..b5d86bd6 --- /dev/null +++ b/commands/analyze/valid-url.js @@ -0,0 +1,27 @@ +const Command = require('../../structures/Command'); +const validURL = require('valid-url'); + +module.exports = class ValidUrlCommand extends Command { + constructor(client) { + super(client, { + name: 'valid-url', + aliases: ['url-valid', 'url-test', 'test-url'], + group: 'analyze', + memberName: 'valid-url', + description: 'Tests whether a URL is valid or not.', + args: [ + { + key: 'url', + prompt: 'What URL would you like to test?', + type: 'string' + } + ] + }); + } + + run(msg, { url }) { + const valid = validURL.isWebUri(url); + if (!valid) return msg.reply('👎 This is not a valid URL.'); + return msg.reply('👍 This is a valid URL.'); + } +}; diff --git a/package.json b/package.json index d8cfac0b..9394cf5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "128.1.1", + "version": "128.2.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {