From fc7a9ea5409bd805c546d9cadc6ef01f76989c22 Mon Sep 17 00:00:00 2001 From: Ian Mitchell Date: Mon, 10 May 2021 17:34:06 -0700 Subject: [PATCH 01/29] Slash Command Notes --- packages/aquarius/src/bot/commands/8ball.js | 1 + packages/aquarius/src/bot/commands/anime.js | 1 + packages/aquarius/src/bot/commands/aqi.js | 1 + packages/aquarius/src/bot/commands/cat.js | 36 ------------------- packages/aquarius/src/bot/commands/choose.js | 1 + packages/aquarius/src/bot/commands/color.js | 1 + packages/aquarius/src/bot/commands/dadjoke.js | 1 + packages/aquarius/src/bot/commands/define.js | 1 + .../aquarius/src/bot/commands/deschtimes.js | 3 ++ packages/aquarius/src/bot/commands/emojis.js | 1 + .../aquarius/src/bot/commands/fizzbuzz.js | 1 + packages/aquarius/src/bot/commands/games.js | 1 + packages/aquarius/src/bot/commands/gdq.js | 1 + packages/aquarius/src/bot/commands/karma.js | 1 + .../aquarius/src/bot/commands/minesweeper.js | 2 ++ packages/aquarius/src/bot/commands/morse.js | 2 ++ packages/aquarius/src/bot/commands/order.js | 1 + .../aquarius/src/bot/commands/overwatch.js | 1 + packages/aquarius/src/bot/commands/quotes.js | 4 ++- .../aquarius/src/bot/commands/reminders.js | 3 ++ packages/aquarius/src/bot/commands/reply.js | 1 + packages/aquarius/src/bot/commands/roll.js | 1 + .../aquarius/src/bot/commands/sarcastic.js | 1 + packages/aquarius/src/bot/commands/seen.js | 2 ++ packages/aquarius/src/bot/commands/slots.js | 1 + packages/aquarius/src/bot/commands/steam.js | 1 + packages/aquarius/src/bot/commands/stocks.js | 4 +++ .../aquarius/src/bot/commands/strawpoll.js | 1 + .../aquarius/src/bot/commands/switchcode.js | 1 + .../aquarius/src/bot/commands/twitchmote.js | 1 + packages/aquarius/src/bot/commands/weather.js | 1 + packages/aquarius/src/bot/commands/xkcd.js | 3 ++ .../aquarius/src/global/commands/admin.js | 2 ++ .../aquarius/src/global/commands/banlist.js | 4 +++ .../aquarius/src/global/commands/broadcast.js | 1 + .../aquarius/src/global/commands/donate.js | 1 + .../aquarius/src/global/commands/guild.js | 3 ++ packages/aquarius/src/global/commands/help.js | 2 ++ .../aquarius/src/global/commands/ignore.js | 3 ++ packages/aquarius/src/global/commands/info.js | 1 + .../aquarius/src/global/commands/invite.js | 1 + .../aquarius/src/global/commands/nickname.js | 1 + packages/aquarius/src/global/commands/ping.js | 1 + .../aquarius/src/global/commands/quiet.js | 1 + .../aquarius/src/global/commands/support.js | 1 + .../aquarius/src/global/commands/uptime.js | 1 + 46 files changed, 68 insertions(+), 37 deletions(-) delete mode 100644 packages/aquarius/src/bot/commands/cat.js diff --git a/packages/aquarius/src/bot/commands/8ball.js b/packages/aquarius/src/bot/commands/8ball.js index ab46b417..e7df84e6 100644 --- a/packages/aquarius/src/bot/commands/8ball.js +++ b/packages/aquarius/src/bot/commands/8ball.js @@ -35,6 +35,7 @@ const responses = [ /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^8ball .+$/i, (message) => { log.info('Generating response', getMessageMeta(message)); message.channel.send(`🎱 | ${randomValue(responses)}`); diff --git a/packages/aquarius/src/bot/commands/anime.js b/packages/aquarius/src/bot/commands/anime.js index 8491295a..f095496b 100644 --- a/packages/aquarius/src/bot/commands/anime.js +++ b/packages/aquarius/src/bot/commands/anime.js @@ -111,6 +111,7 @@ function createAnimeEmbed(data) { } export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand( /^anime info (?.+)$/i, async (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/aqi.js b/packages/aquarius/src/bot/commands/aqi.js index c2167b94..e63da442 100644 --- a/packages/aquarius/src/bot/commands/aqi.js +++ b/packages/aquarius/src/bot/commands/aqi.js @@ -70,6 +70,7 @@ export default async ({ aquarius, analytics }) => { stdTTL: ONE_HOUR / 1000, }); + // TODO: Switch to slash command aquarius.onCommand( /^(?:aqi) (?.*)/i, async (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/cat.js b/packages/aquarius/src/bot/commands/cat.js deleted file mode 100644 index 2603dca0..00000000 --- a/packages/aquarius/src/bot/commands/cat.js +++ /dev/null @@ -1,36 +0,0 @@ -import debug from 'debug'; -import fetch from 'node-fetch'; - -const log = debug('Cat'); - -// TODO: Implement and Test - -/** @type {import('../../typedefs').CommandInfo} */ -export const info = { - name: 'cat', - description: 'Posts an image of a cat', - usage: '```@Aquarius cat```', - disabled: true, // API Issues -}; - -export default async ({ aquarius }) => { - aquarius.onCommand(/^cat$/i, async (message) => { - log('Image request'); - - try { - // TODO: Switch to thecatapi? This one takes forever and times out - const response = await fetch('http://aws.random.cat/meow', { - headers: { - 'Content-Type': 'application/json', - }, - }); - const json = await response.json(); - - log(json); - message.channel.send({ file: json.file }); - } catch (e) { - log(e); - message.channel.send("Sorry, I wasn't able to get an image!"); - } - }); -}; diff --git a/packages/aquarius/src/bot/commands/choose.js b/packages/aquarius/src/bot/commands/choose.js index d02272ab..95571760 100644 --- a/packages/aquarius/src/bot/commands/choose.js +++ b/packages/aquarius/src/bot/commands/choose.js @@ -38,6 +38,7 @@ function countDecimals(number) { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^c(?:hoose)? (?.+)$/i, (message, { groups }) => { // Check for a choice in a range const rangeMatch = groups.input.match(RANGE_REGEX); diff --git a/packages/aquarius/src/bot/commands/color.js b/packages/aquarius/src/bot/commands/color.js index 674be79d..4fbdf882 100644 --- a/packages/aquarius/src/bot/commands/color.js +++ b/packages/aquarius/src/bot/commands/color.js @@ -22,6 +22,7 @@ export const info = { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^color (?.+)$/i, (message, { groups }) => { log(`Looking up color ${groups.name}`); diff --git a/packages/aquarius/src/bot/commands/dadjoke.js b/packages/aquarius/src/bot/commands/dadjoke.js index 871159ef..bba68341 100644 --- a/packages/aquarius/src/bot/commands/dadjoke.js +++ b/packages/aquarius/src/bot/commands/dadjoke.js @@ -13,6 +13,7 @@ export const info = { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^dadjoke$/i, async (message) => { log('Sending dadjoke'); diff --git a/packages/aquarius/src/bot/commands/define.js b/packages/aquarius/src/bot/commands/define.js index 0715303a..c8facb21 100644 --- a/packages/aquarius/src/bot/commands/define.js +++ b/packages/aquarius/src/bot/commands/define.js @@ -53,6 +53,7 @@ function isWord(dom) { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^define (?.+)$/i, async (message, { groups }) => { const check = checkBotPermissions(message.guild, ...info.permissions); diff --git a/packages/aquarius/src/bot/commands/deschtimes.js b/packages/aquarius/src/bot/commands/deschtimes.js index 134c0622..ad03429e 100644 --- a/packages/aquarius/src/bot/commands/deschtimes.js +++ b/packages/aquarius/src/bot/commands/deschtimes.js @@ -120,6 +120,7 @@ async function getShowEmbed(data, episodeNumber) { export default async ({ aquarius, analytics, settings }) => { settings.register('token', "Your Group's Deschtimes token", 0); + // TODO: Switch to slash command aquarius.onCommand( /^blame (?:#(?\d+) )?(?[^.](?:.+)?)$/i, async (message, { groups }) => { @@ -165,6 +166,7 @@ export default async ({ aquarius, analytics, settings }) => { } ); + // TODO: Switch to slash command aquarius.onCommand( /^(?:(?:(?done|undone) (?\w+)(?: #(?\d+))? (?[^.](?:.+)?)))$/i, async (message, { groups }) => { @@ -226,6 +228,7 @@ export default async ({ aquarius, analytics, settings }) => { } ); + // TODO: Switch to slash command aquarius.onCommand( /^release\s(?[^.](?:.+)?)$/i, async (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/emojis.js b/packages/aquarius/src/bot/commands/emojis.js index a7a30e8a..efff6c4c 100644 --- a/packages/aquarius/src/bot/commands/emojis.js +++ b/packages/aquarius/src/bot/commands/emojis.js @@ -22,6 +22,7 @@ async function downloadImage(url) { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^emojis download$/i, async (message) => { try { log('Creating emoji zip file for download'); diff --git a/packages/aquarius/src/bot/commands/fizzbuzz.js b/packages/aquarius/src/bot/commands/fizzbuzz.js index c6114179..f9dcfe6e 100644 --- a/packages/aquarius/src/bot/commands/fizzbuzz.js +++ b/packages/aquarius/src/bot/commands/fizzbuzz.js @@ -13,6 +13,7 @@ export const info = { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand( /^fizzbuzz (?[\d]+)$/i, async (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/games.js b/packages/aquarius/src/bot/commands/games.js index 01c68e03..677f1986 100644 --- a/packages/aquarius/src/bot/commands/games.js +++ b/packages/aquarius/src/bot/commands/games.js @@ -12,6 +12,7 @@ export const info = { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^games list$/i, (message) => { log('Getting game list'); diff --git a/packages/aquarius/src/bot/commands/gdq.js b/packages/aquarius/src/bot/commands/gdq.js index ca6945cd..2e66cd83 100644 --- a/packages/aquarius/src/bot/commands/gdq.js +++ b/packages/aquarius/src/bot/commands/gdq.js @@ -13,6 +13,7 @@ export const info = { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^gdq$/i, async (message) => { log('Getting message'); diff --git a/packages/aquarius/src/bot/commands/karma.js b/packages/aquarius/src/bot/commands/karma.js index 20720433..958dba6e 100644 --- a/packages/aquarius/src/bot/commands/karma.js +++ b/packages/aquarius/src/bot/commands/karma.js @@ -38,6 +38,7 @@ const COOLDOWN = { DEFAULT: 60 * 5, }; +// TODO: Switch to slash command /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, settings, analytics }) => { settings.register( diff --git a/packages/aquarius/src/bot/commands/minesweeper.js b/packages/aquarius/src/bot/commands/minesweeper.js index 5692ce1a..82803cdd 100644 --- a/packages/aquarius/src/bot/commands/minesweeper.js +++ b/packages/aquarius/src/bot/commands/minesweeper.js @@ -47,6 +47,7 @@ const DIFFICULTIES = { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand( /^minesweeper(?: (?beginner|intermediate|expert))?$/i, (message, { groups }) => { @@ -73,6 +74,7 @@ export default async ({ aquarius, analytics }) => { } ); + // TODO: Switch to slash command aquarius.onCommand( /^minesweeper custom (?\d{1,2})$/i, (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/morse.js b/packages/aquarius/src/bot/commands/morse.js index 3c411530..86bc2775 100644 --- a/packages/aquarius/src/bot/commands/morse.js +++ b/packages/aquarius/src/bot/commands/morse.js @@ -18,6 +18,7 @@ export const info = { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^morse encode (?.+)$/i, (message, { groups }) => { log(`Encoding "${groups.input}"`); const str = morse.encode(groups.input); @@ -25,6 +26,7 @@ export default async ({ aquarius, analytics }) => { analytics.trackUsage('enocde', message); }); + // TODO: Switch to slash command aquarius.onCommand(/^morse decode (?.+)$/i, (message, { groups }) => { log(`Decoding "${groups.input}"`); const str = morse.decode(groups.input); diff --git a/packages/aquarius/src/bot/commands/order.js b/packages/aquarius/src/bot/commands/order.js index dbda6d76..5f663de1 100644 --- a/packages/aquarius/src/bot/commands/order.js +++ b/packages/aquarius/src/bot/commands/order.js @@ -59,6 +59,7 @@ function getChoices(input, delimiter) { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^o(?:rder)? (?.+)$/i, (message, { groups }) => { // Check for a range const rangeMatch = groups.input.match(RANGE_REGEX); diff --git a/packages/aquarius/src/bot/commands/overwatch.js b/packages/aquarius/src/bot/commands/overwatch.js index e4ad39bc..661ebf65 100644 --- a/packages/aquarius/src/bot/commands/overwatch.js +++ b/packages/aquarius/src/bot/commands/overwatch.js @@ -19,6 +19,7 @@ const REGIONS = { // TODO: Switch to account lookup /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand( /^overwatch (?:(?[A-Za-z]{2}) )?(?[\w]+#[\d]{4,5})$/i, (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/quotes.js b/packages/aquarius/src/bot/commands/quotes.js index 23c0c6a6..5d10db9b 100644 --- a/packages/aquarius/src/bot/commands/quotes.js +++ b/packages/aquarius/src/bot/commands/quotes.js @@ -37,7 +37,7 @@ function getQuoteMessage(quote) { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { // TODO: Add a `.quotes find phrase` command - + // TODO: Switch to slash command aquarius.onCommand(/^quotes random$/, async (message) => { log.info('Getting random quote', getMessageMeta(message)); @@ -67,6 +67,7 @@ export default async ({ aquarius, analytics }) => { analytics.trackUsage('random', message); }); + // TODO: Switch to slash command aquarius.onCommand( /^quotes read #?(?[0-9]+)$/i, async (message, { groups }) => { @@ -101,6 +102,7 @@ export default async ({ aquarius, analytics }) => { } ); + // TODO: Switch to slash command aquarius.onCommand( /^quotes (?:new|add) (?[^]*)$/i, async (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/reminders.js b/packages/aquarius/src/bot/commands/reminders.js index afb7a9a3..3b13410b 100644 --- a/packages/aquarius/src/bot/commands/reminders.js +++ b/packages/aquarius/src/bot/commands/reminders.js @@ -134,6 +134,7 @@ export default async ({ aquarius, analytics }) => { refreshTimeout(); }); + // TODO: Switch to slash command aquarius.onCommand( /^(remindme|reminders add) (?.+)$/i, async (message, { groups }) => { @@ -177,6 +178,7 @@ export default async ({ aquarius, analytics }) => { } ); + // TODO: Switch to slash command aquarius.onCommand(/^reminders list$/i, async (message) => { try { log.info('Listing reminders', getMessageMeta(message)); @@ -226,6 +228,7 @@ export default async ({ aquarius, analytics }) => { } }); + // TODO: Switch to slash command aquarius.onCommand( /^reminders remove (?\d+)$/i, async (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/reply.js b/packages/aquarius/src/bot/commands/reply.js index 16bfd2e3..337c2f3b 100644 --- a/packages/aquarius/src/bot/commands/reply.js +++ b/packages/aquarius/src/bot/commands/reply.js @@ -67,6 +67,7 @@ export default async ({ aquarius, analytics }) => { } }); + // TODO: Switch to slash command aquarius.onCommand(/^reply list$/i, (message) => { log.info('Listing replies', getMessageMeta(message)); diff --git a/packages/aquarius/src/bot/commands/roll.js b/packages/aquarius/src/bot/commands/roll.js index b1107873..d7c124d0 100644 --- a/packages/aquarius/src/bot/commands/roll.js +++ b/packages/aquarius/src/bot/commands/roll.js @@ -45,6 +45,7 @@ function getSequenceDescription({ sign, emoji, rolls, modifier }) { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^roll (?.*)$/i, (message, { groups }) => { const { roll } = groups; diff --git a/packages/aquarius/src/bot/commands/sarcastic.js b/packages/aquarius/src/bot/commands/sarcastic.js index d509026e..51cf59d0 100644 --- a/packages/aquarius/src/bot/commands/sarcastic.js +++ b/packages/aquarius/src/bot/commands/sarcastic.js @@ -17,6 +17,7 @@ function sarcastic(str) { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^sarcastic (?.+)$/i, (message, { groups }) => { log.info('Sarcastic request', getMessageMeta(message)); message.channel.send( diff --git a/packages/aquarius/src/bot/commands/seen.js b/packages/aquarius/src/bot/commands/seen.js index 8ff292f5..1d309b1e 100644 --- a/packages/aquarius/src/bot/commands/seen.js +++ b/packages/aquarius/src/bot/commands/seen.js @@ -66,6 +66,7 @@ export default async ({ aquarius, analytics }) => { } }; + // TODO: Switch to slash command aquarius.onCommand( new RegExp(`^seen ${MENTION_USER.source}$`, 'i'), async (message) => { @@ -81,6 +82,7 @@ export default async ({ aquarius, analytics }) => { } ); + // TODO: Switch to slash command aquarius.onCommand( new RegExp(`^seen id (?\\d+)$`, 'i'), async (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/slots.js b/packages/aquarius/src/bot/commands/slots.js index c3a3a11a..3698b4cc 100644 --- a/packages/aquarius/src/bot/commands/slots.js +++ b/packages/aquarius/src/bot/commands/slots.js @@ -28,6 +28,7 @@ const values = [ /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand(/^slots$/i, (message) => { log.info('Rolling', getMessageMeta(message)); message.channel.send(dedent` diff --git a/packages/aquarius/src/bot/commands/steam.js b/packages/aquarius/src/bot/commands/steam.js index 95ac28ad..0a866547 100644 --- a/packages/aquarius/src/bot/commands/steam.js +++ b/packages/aquarius/src/bot/commands/steam.js @@ -20,6 +20,7 @@ export const info = { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand( /^steam info (?.*)$/i, async (message, { groups }) => { diff --git a/packages/aquarius/src/bot/commands/stocks.js b/packages/aquarius/src/bot/commands/stocks.js index f240d785..928bc1f0 100644 --- a/packages/aquarius/src/bot/commands/stocks.js +++ b/packages/aquarius/src/bot/commands/stocks.js @@ -154,6 +154,7 @@ async function getStockEmbed(profileData, priceData) { /** @type {import('../../typedefs').Command} */ export default async ({ aquarius, analytics }) => { + // TODO: Switch to slash command aquarius.onCommand( /^stocks info \$?(?.+)$/i, async (message, { groups }) => { @@ -204,6 +205,7 @@ export default async ({ aquarius, analytics }) => { } ); + // TODO: Switch to slash command aquarius.onCommand( /^stocks rating \$?(?.+)$/i, async (message, { groups }) => { @@ -273,6 +275,7 @@ export default async ({ aquarius, analytics }) => { // //https://financialmodelingprep.com/api/v3/historical-price-full/AAPL?serietype=line // ); + // TODO: Switch to slash command aquarius.onCommand(/^stocks indexes$/, async (message) => { log.info('Looking up indexes', getMessageMeta(message)); @@ -323,6 +326,7 @@ export default async ({ aquarius, analytics }) => { analytics.trackUsage('indexes', message); }); + // TODO: Switch to slash command aquarius.onCommand( /^stocks sectors(?: (?