From 9d9d024fb0d8c9105d625edebdefb0d5a23341db Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Sat, 6 Jun 2020 09:09:25 -0700 Subject: add whois, change versioning in package.json make msgContent a const instead of a var in app.js --- src/bot.ts | 2 +- src/commands/utility/whois.ts | 36 ++++++++++++++++++++++++++++++++++++ src/config.json | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/commands/utility/whois.ts (limited to 'src') diff --git a/src/bot.ts b/src/bot.ts index 7900d7a..3e07da2 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -125,7 +125,7 @@ client.on('guildMemberRemove', member => { }) client.on('message', async msg => { - var msgContent = msg.content.toLowerCase(); + const msgContent = msg.content.toLowerCase(); function prefixCheck() { if (msgContent.startsWith('uwu!')) { return true; diff --git a/src/commands/utility/whois.ts b/src/commands/utility/whois.ts new file mode 100644 index 0000000..95c954c --- /dev/null +++ b/src/commands/utility/whois.ts @@ -0,0 +1,36 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import whois from 'whois'; + +module.exports = class WhoIsUtility extends Command { + constructor(client) { + super(client, { + name: 'whois', + group: 'utility', + memberName: 'whois', + description: 'Perform a whois on a specified or domain.', + examples: ['uwu!whois google.com'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'host', + prompt: 'What host/ domain would you like to perform a who is on?', + type: 'string' + } + ] + }); + } + async run(msg: CommandoMessage, { host }) { + whois.lookup(host, (err, data) => { + if (err) return msg.reply(`Woops, there was an error getting that information for you! Please re-check your specified host/ domain. ${emoji.random()}`); + + msg.reply(`Check your DMs for the whois! ${emoji.random()}`); + msg.author.send(data, { split: true }); + }); + } +}; \ No newline at end of file diff --git a/src/config.json b/src/config.json index d9c16f9..6ab342c 100644 --- a/src/config.json +++ b/src/config.json @@ -2,6 +2,6 @@ "secret":"Njk5NDczMjYzOTk4MjcxNDg5.XpU5oQ.btZuxVudhNllSQY6CxrXXtMJm9A", "secret-dev":"NzEyMDg4MzY5MjA2OTE5MjY5.XsMeEw.Yy0a8m2vZLDbPi7cZ8aqCalMR68", "yt-api-key":"AIzaSyCeG1lQAeInv4vjFv_eTL9IFAFNdQC9Nk8", - "version":"1.10.21", + "version":"1.10.22", "fortniteTrackerNetworkToken": "4cf21f95-5f1a-412a-b4a7-e5424adc314a" } \ No newline at end of file -- cgit v1.2.3