diff options
Diffstat (limited to 'src/commands/utility')
| -rw-r--r-- | src/commands/utility/average.ts | 46 | ||||
| -rw-r--r-- | src/commands/utility/csgoserverstatus.ts | 79 | ||||
| -rw-r--r-- | src/commands/utility/fortnitestats.ts | 106 | ||||
| -rw-r--r-- | src/commands/utility/gmodserverstatus.ts | 78 | ||||
| -rw-r--r-- | src/commands/utility/google.ts | 34 | ||||
| -rw-r--r-- | src/commands/utility/iss.ts | 33 | ||||
| -rw-r--r-- | src/commands/utility/romannumeral.ts | 57 | ||||
| -rw-r--r-- | src/commands/utility/rustserverstatus.ts | 78 | ||||
| -rw-r--r-- | src/commands/utility/starboundserverstatus.ts | 99 | ||||
| -rw-r--r-- | src/commands/utility/time.ts | 24 | ||||
| -rw-r--r-- | src/commands/utility/whois.ts | 39 | ||||
| -rw-r--r-- | src/commands/utility/xorstr.ts | 23 |
12 files changed, 0 insertions, 696 deletions
diff --git a/src/commands/utility/average.ts b/src/commands/utility/average.ts deleted file mode 100644 index 233236c..0000000 --- a/src/commands/utility/average.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { formatDistance, formatRelative } from 'date-fns' -//TODO: check if this has types -//@ts-ignore no types -import { stripIndents } from 'common-tags' - -module.exports = class AverageUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'average', - aliases: [ - 'average-number', - 'averagenumber', - 'average-num', - 'averagenum' - ], - group: 'utility', - memberName: 'average', - description: 'Gets the average of specified numbers.', - examples: ['uwu!average 10 20 30 40 50'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'nNum', - prompt: 'What\'s another number you would like to average?', - type: 'float', - label: 'number', - infinite: true - } - ] - }); - } - async run(msg: CommandoMessage, { nNum }: any) { // this is really a string - if (nNum.length < 2) msg.reply('Please provide **2** or more numbers.') - - const reducer = (accumulator: any, currentValue: any) => accumulator + currentValue - return msg.reply(`The average of the specified numbers is ${nNum.reduce(reducer) / nNum.length}.` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/utility/csgoserverstatus.ts b/src/commands/utility/csgoserverstatus.ts deleted file mode 100644 index 5f0cfe7..0000000 --- a/src/commands/utility/csgoserverstatus.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no @types -import gamedig from 'gamedig' -const gameDigHelper = require('../../utils/gameDigHelper.js') - -module.exports = class CSGOServerStatusUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'csgoserverstatus', - aliases: [ - 'counterstrikeserverstatus', - 'counter-strike-server-status', - 'counterstrikeglobaloffensiveserverstatus', - 'counter-strike-global-offensive-server-status', - 'csgoss' - ], - group: 'utility', - memberName: 'csgoserverstatus', - description: 'Grabs you the server status of a CS:GO server.', - examples: [ - 'uwu!csgoserverstatus', - 'uwu!csgoss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What is the IP or host of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '27015', - max: 65535, - min: 1 - } - ] - }); - } - async run(msg: CommandoMessage, { host, port }: any) { - try { - const options = { - host, - type: 'csgo', - } - - if (port) { - //@ts-ignore this get auto appended - options.port = port - } - - return gamedig - .query(options) - .then((data: any) => { - let emb = gameDigHelper(data) - emb.setColor(0xFFCC4D) - emb.setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/730/header.jpg') - return msg.replyEmbed(emb) - }) - .catch((err: string) => { - if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) - - console.error(err) - return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) - }) - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/fortnitestats.ts b/src/commands/utility/fortnitestats.ts deleted file mode 100644 index 8eb65c4..0000000 --- a/src/commands/utility/fortnitestats.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore to types -import emoji from 'emoji-random' -import axios from 'axios' -import config from '../../config.json' -const platforms = ['pc', 'xbl', 'psn'] - -module.exports = class FortniteStatsUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'fortnitestats', - aliases: [ - 'fortnite-stats', - 'fortnitestatistics', - 'fortnite-statistics', - 'fnstats', - 'fn-stats', - 'fnstatistics', - 'fn-statistics', - 'fns', - 'fn-s', - 'fortnite' - ], - group: 'utility', - memberName: 'fortnitestats', - description: 'Grabs a specified player\'s Fortnite statistics.', - details: 'Available platforms are `pc` (PC), `xbp` (Xbox Live) and `psn` (Playstation Network).', - examples: [ - 'uwu!fortnitestats Frozen', - 'uwu!fns Sin' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'pPlatform', - prompt: 'What platform would you like to search on.', - type: 'string', - parse: (platform: string) => platform.toLowerCase(), - oneOf: platforms - }, - { - key: 'pUsername', - prompt: 'What user would you like to look up?', - type: 'string' - } - ] - }); - } - //TODO: - //@ts-ignore this is not async - async run(msg: CommandoMessage, { pPlatform, pUsername }: any) { - try { - const stats = ( - await axios - .get(`https://api.fortnitetracker.com/v1/profile/${pPlatform}/${pUsername}`, { - headers: { 'TRN-Api-Key': config.fortniteTrackerNetworkToken } - }) - .catch(err => { - console.error(err) - return msg.reply('Woops, There was an error with the (https://api.fortnitetracker.com) API. ' + emoji.random()) - }) - //@ts-ignore yes it does exist lmao - ).data - - if (stats.error === 'Player Not Found') { - return msg.reply('Specified player was not found on that platform. ' + emoji.random()) - } - - console.debug(`Result for ${pUsername} on ${pPlatform}:`, stats) - let emb = new MessageEmbed() - .setTitle(stats.epicUserHandle) - .setURL(`https://fortnitetracker.com/profile/${pPlatform}/${encodeURIComponent(pUsername)}`) - .setColor(0xFFCC4D) - .setFooter('Information providied by The Tracker Network.',) - - if (stats.lifeTimeStats[8] && stats.lifeTimeStats[9]) { - emb.addField("🏆 Wins", `${stats.lifeTimeStats[8].value} wins (${stats.lifeTimeStats[9].value})`) - } - - if (stats.lifeTimeStats[10] && stats.lifeTimeStats[11]) { - emb.addField( - "💀 Kills", - `${stats.lifeTimeStats[10].value} kills. ${stats.lifeTimeStats[11].value} K/D ratio.` - ); - } - - if (stats.lifeTimeStats[7]) { - emb.addField("🎮 Matches Played", stats.lifeTimeStats[7].value.toString()); - } - - if (stats.lifeTimeStats[6]) { - emb.addField("🔢 Score", stats.lifeTimeStats[6].value.toString()); - } - - return msg.replyEmbed(emb); - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/gmodserverstatus.ts b/src/commands/utility/gmodserverstatus.ts deleted file mode 100644 index 50c0e61..0000000 --- a/src/commands/utility/gmodserverstatus.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no types -import gamedig from 'gamedig' -const gameDigHelper = require('../../utils/gameDigHelper.js') - -module.exports = class GModServerStatusUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'gmodserverstatus', - aliases: [ - 'g-mod-server-status', - 'garrysmodserverstatus', - 'garrys-mod-server-status', - 'gmodss' - ], - group: 'utility', - memberName: 'gmodserverstatus', - description: 'Grabs you the server status of a Garry\'s Mod server.', - examples: [ - 'uwu!gmodserverstatus', - 'uwu!gmodss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What is the IP or host of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '27015', - max: 65535, - min: 1 - } - ] - }); - } - async run(msg: CommandoMessage, { host, port }: any) { - try { - const options = { - host, - type: 'garrysmod' - } - - if (port) { - //@ts-ignore added auto - options.port = port - } - - return gamedig - .query(options) - .then((data: any) => { - let emb = gameDigHelper(data) - emb.setColor(0xFFCC4D) - emb.setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/4000/header.jpg') - return msg.replyEmbed(emb) - }) - .catch((err: string) => { - if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) - - console.error(err) - return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) - }) - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/google.ts b/src/commands/utility/google.ts deleted file mode 100644 index 2c84bd5..0000000 --- a/src/commands/utility/google.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class GoogleUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'google', - group: 'utility', - memberName: 'google', - description: 'Googles something for you.', - examples: ['uwu!google sin'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'gTerm', - prompt: 'What would you like to search for?', - type: 'string' - } - ] - }); - } - run(msg: CommandoMessage, { gTerm }: any) { - let embed = new MessageEmbed() - .setTitle('**Google Search**') - .setColor(0xFFCC4D) - .addField('Searching Google for`' + gTerm + '`...', `[Click Here](https://google.com/search?q=${gTerm.replace(/ /g, '%20')})`) - return msg.say(embed) - } -};
\ No newline at end of file diff --git a/src/commands/utility/iss.ts b/src/commands/utility/iss.ts deleted file mode 100644 index 3bb4ff6..0000000 --- a/src/commands/utility/iss.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; -import request from 'node-superfetch' - -module.exports = class ISSUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'iss', - aliases: ['internationalspacestation', 'international-space-station'], - group: 'utility', - memberName: 'iss', - description: 'Tells you the current location of the International Space Station.', - examples: ['uwu!iss'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - async run(msg: CommandoMessage) { - try { - const { body } = await request.get('http://api.open-notify.org/iss-now.json') - //@ts-ignore this exists - const pos = body.iss_position - return msg.reply(`The ISS is currentaly at **${pos.latitude}, ${pos.longitude}**. ${emoji.random()}`) - } catch (err) { - return msg.reply(`Woops, an error has occurred: \`${err.message}\`. Try again later! ${emoji.random()}`) - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/romannumeral.ts b/src/commands/utility/romannumeral.ts deleted file mode 100644 index 39b9320..0000000 --- a/src/commands/utility/romannumeral.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no types -import romanize from 'romanize' - -module.exports = class RomanNumeralUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'romannumeral', - aliases: [ - 'roman-numeral', - 'romannumerals', - 'roman-numerals' - ], - group: 'utility', - memberName: 'romannumeral', - description: 'Converts a number to a roman numeral.', - examples: ['uwu!romannumeral 12'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'nNum', - prompt: 'What number would you like to translate', - type: 'integer', - min: 1 - } - ] - }); - } - run(msg: CommandoMessage, { nNum }: any) { - if (nNum === parseInt(nNum, 10)) { - msg.reply(romanize(nNum)) - } - - const back = (value: string) => { - let res = 0 - - const decimal = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] - const roman = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] - for (let i = 0; i <= decimal.length; i++) { - while (value.indexOf(roman[i]) === 0) { - res += decimal[i] - value = value.replace(roman[i], '') - } - } - return res - } - - return msg.reply(back(nNum) + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/utility/rustserverstatus.ts b/src/commands/utility/rustserverstatus.ts deleted file mode 100644 index dd91487..0000000 --- a/src/commands/utility/rustserverstatus.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no types -import gamedig from 'gamedig' -const gameDigHelper = require('../../utils/gameDigHelper.js') - -module.exports = class RustServerStatusUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'rustserverstatus', - aliases: [ - 'rust-ss', - 'rust-server-status', - 'rustss' - ], - group: 'utility', - memberName: 'rustserverstatus', - description: 'Grabs you the server status of a Rust server.', - examples: [ - 'uwu!rustserverstatus', - 'uwu!rustss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What is the IP or host of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '28015', - max: 65535, - min: 1 - } - ] - }); - } - run(msg: CommandoMessage, { host, port }: any) { - try { - const options = { - host, - type: 'rust' - } - - if (port) { - //@ts-ignore gets added - options.port = port - } - - return gamedig - .query(options) - .then((data: any) => { - msg.replyEmbed( - gameDigHelper(data) - .setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/252490/header.jpg') - .setColor(0xFFCC4D) - ) - }) - .catch((err: string) => { - if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) - - console.error(err) - return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) - }) - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/starboundserverstatus.ts b/src/commands/utility/starboundserverstatus.ts deleted file mode 100644 index 0d8e319..0000000 --- a/src/commands/utility/starboundserverstatus.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no types -import gamedig from 'gamedig' -const gameDigHelper = require('../../utils/gameDigHelper.js') - -module.exports = class StarboundServerStatusUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'starboundserverstatus', - aliases: [ - 'starbound-ss', - 'starbound-server-status', - 'sbss' - ], - group: 'utility', - memberName: 'starboundserverstatus', - description: 'Grabs you the server status of a Starbound server.', - examples: [ - 'uwu!starboundserverstatus', - 'uwu!sbss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What is the IP or host of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '21025', - max: 65535, - min: 1 - } - ] - }); - } - run(msg: CommandoMessage, { host, port }: any) { - try { - const options = { - host, - type: 'starbound' - } - - if (port) { - //@ts-ignore added auto - options.port = port - } - - return gamedig - .query(options) - // this is auto'd so might not be good - .then((data: { raw: { numplayers: any; }; maxplayers: any; name: any; query: { duration: any; address: any; port: any; }; password: any; }) => { - const curr = data.raw.numplayers - const max = data.maxplayers - - return msg.replyEmbed( - new MessageEmbed() - .setTitle(data.name) - .setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/211820/header.jpg') - .setFooter(`Took ${data.query.duration} to complete.`) - .addFields([ - { - name: 'IP Address', - value: `${data.query.address} (port ${data.query.port})` - }, - { - name: "Online Players", - value: `${curr}/${max} (${Math.round((curr / max) * 100)}%)` - }, - { - name: "Password Required", - value: data.password ? "Yes" : "No" - } - ]) - .setColor(0xFFCC4D) - ) - }) - .catch((err: string) => { - if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) - - console.error(err) - return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) - }) - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/time.ts b/src/commands/utility/time.ts deleted file mode 100644 index 78fe391..0000000 --- a/src/commands/utility/time.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' - -module.exports = class TimeUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'time', - group: 'utility', - memberName: 'time', - description: 'Check the time.', - examples: ['uwu!time'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage) { - return msg.reply(`The time is currently **${new Date()}**. ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/utility/whois.ts b/src/commands/utility/whois.ts deleted file mode 100644 index d699e39..0000000 --- a/src/commands/utility/whois.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; -//@ts-ignore no types -import whois from 'whois'; - -module.exports = class WhoIsUtility extends Command { - constructor(client: CommandoClient) { - 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' - } - ] - }); - } - run(msg: CommandoMessage, { host }: any) { - //@ts-ignore doesnt matter if none is returned - return whois.lookup(host, (err: any, data: any) => { - 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()}`); - return msg.author.send(data, { split: true }); - }); - } -};
\ No newline at end of file diff --git a/src/commands/utility/xorstr.ts b/src/commands/utility/xorstr.ts deleted file mode 100644 index 188ed75..0000000 --- a/src/commands/utility/xorstr.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; - -module.exports = class XorStrUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'xorstr', - aliases: ['xor'], - group: 'utility', - memberName: 'xorstr', - description: 'Gives you Dexor\'s XorStr link and documentation.', - examples: ['uwu!xorstr', 'uwu!xor'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - return msg.reply('https://github.com/JustasMasiulis/xorstr'); - } -};
\ No newline at end of file |