diff --git a/commands/analyze/is-it-down.js b/commands/analyze/is-it-down.js index 69dd2d74..d15bbe2f 100644 --- a/commands/analyze/is-it-down.js +++ b/commands/analyze/is-it-down.js @@ -1,5 +1,7 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); +const url = require('url'); +const validURL = require('valid-url'); module.exports = class IsItDownCommand extends Command { constructor(client) { @@ -20,17 +22,19 @@ module.exports = class IsItDownCommand extends Command { { key: 'url', prompt: 'What URL do you want to test?', - type: 'string' + type: 'string', + validate: site => Boolean(validURL.isWebUri(site)) } ] }); } async run(msg, { url }) { + const parsed = url.parse(site); try { const { text } = await request .post('https://www.isitdownrightnow.com/check.php') - .query({ domain: url }); + .query({ domain: parsed.host }); const down = text.includes('div class="statusdown"'); if (!down) return msg.reply('👍 This site is up and running.'); return msg.reply('👎 Looks like this site is down for everyone...'); diff --git a/package.json b/package.json index a042aa10..fd0e8252 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "131.11.1", + "version": "131.11.2", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {