diff --git a/commands/message/core/help.js b/commands/message/core/help.js index 5e425f3..22b8454 100644 --- a/commands/message/core/help.js +++ b/commands/message/core/help.js @@ -38,7 +38,7 @@ function renderCommandList(commands, descriptions, limit) { return render.join('\n') } -function createCommandPage(context, prefix, command) { +function createCommandPage(context, prefix, command, slashCommands) { alias = ' ​ ' if (command.aliases.length >= 1) { for (const al of command.aliases) alias += smallPill(al) @@ -63,10 +63,32 @@ function createCommandPage(context, prefix, command) { } let cPage = createEmbed("default", context, { - description: `${icon("slash")} ${smallPill(command.name)}\n${alias}${explicit}\n${command.metadata.description}\n\n${args.join('\n\n')}`, + description: `${icon("slash")} ${smallPill(command.name)}\n${alias}${explicit}\n${command.metadata.description}`, fields: [] }) + if(args.length >= 1) cPage.description += `\n\n${args.join('\n\n')}`; + + // Adds the slash command hint, if available + if(command.metadata.slashCommand){ + let cmd = slashCommands.filter((c)=>c.name === command.metadata.slashCommand); + if(cmd.length >= 1) { + switch(cmd[0].type){ + case 1: + cPage.description += `\n\n${icon("slash")} Available via **Slash Commands**.\n-# ${icon("subtext_lightbulb")} Click on to try it out! • ${link(context.application.oauth2UrlFormat().replace("ptb.discordapp.com","discord.com"), `Add ${context.client.user.username}`, `Add ${context.client.user.username} to use this command anywhere.`)}` + break; + case 2: + cPage.description += `\n\n${icon("slash")} Available via **Context Menu Commands**\n-# ${icon("subtext_lightbulb")} Right-Click on someone's avatar! • ${link(context.application.oauth2UrlFormat().replace("ptb.discordapp.com","discord.com"), `Add ${context.client.user.username}`, `Add ${context.client.user.username} to use this command anywhere.`)}` + break; + case 3: + cPage.description += `\n\n${icon("slash")} Available via **User Context Commands**.\n-# ${icon("subtext_lightbulb")} Right-Click on any message! • ${link(context.application.oauth2UrlFormat().replace("ptb.discordapp.com","discord.com"), `Add ${context.client.user.username}`, `Add ${context.client.user.username} to use this command anywhere.`)}` + break; + default: + break; + } + } + } + // TODO: maybe try building a little parser that highlights things via ansi if (command.metadata.usage) cPage.fields.push({ name: `${icon("settings")} Usage`, @@ -153,7 +175,7 @@ module.exports = { // Generate command detail pages for (const c of results) { - pages.push(createCommandPage(context, prefix, c)) + pages.push(createCommandPage(context, prefix, c, context.interactionCommandClient.commands)) } await paginator.createPaginator({ @@ -162,7 +184,7 @@ module.exports = { }); return; } else { - return editOrReply(context, createCommandPage(context, prefix, results[0])) + return editOrReply(context, createCommandPage(context, prefix, results[0], context.interactionCommandClient.commands)) } } catch (e) { console.log(e) diff --git a/commands/message/fun/otter.js b/commands/message/fun/otter.js index 969f33e..0aba9e5 100644 --- a/commands/message/fun/otter.js +++ b/commands/message/fun/otter.js @@ -12,7 +12,8 @@ module.exports = { description: 'Displays a random image containing otters.', description_short: 'Otter images', category: 'fun', - usage: `otter` + usage: `otter`, + slashCommand: "otter" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY], run: async (context) => { diff --git a/commands/message/google/transcribe.js b/commands/message/google/transcribe.js index b07a060..a94b1b9 100644 --- a/commands/message/google/transcribe.js +++ b/commands/message/google/transcribe.js @@ -15,7 +15,8 @@ module.exports = { description: `${icon("reply")} __Replying__ to a voice message when using this command will transcribe the contents of the voice message.`, description_short: 'Discord voice message transcription', category: 'utils', - usage: 'transcribe' + usage: 'transcribe', + slashCommand: "Transcribe Voice Message" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY, Permissions.READ_MESSAGE_HISTORY], run: async (context) => { diff --git a/commands/message/info/avatar.js b/commands/message/info/avatar.js index 39f621c..f3d74fb 100644 --- a/commands/message/info/avatar.js +++ b/commands/message/info/avatar.js @@ -16,7 +16,8 @@ module.exports = { description_short: 'Get discord user avatars', examples: ['avatar labsCore'], category: 'info', - usage: 'avatar []' + usage: 'avatar []', + slashCommmand: 'avatar' }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { diff --git a/commands/message/info/user.js b/commands/message/info/user.js index 53b0b50..2209cb4 100644 --- a/commands/message/info/user.js +++ b/commands/message/info/user.js @@ -17,7 +17,8 @@ module.exports = { description_short: 'Information about discord users', examples: ['user labsCore'], category: 'info', - usage: 'user []' + usage: 'user []', + slashCommand: 'user' }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { diff --git a/commands/message/search/audio.js b/commands/message/search/audio.js index ced4478..9938a16 100644 --- a/commands/message/search/audio.js +++ b/commands/message/search/audio.js @@ -18,7 +18,8 @@ module.exports = { description: `${icon("reply")} __Replying__ to a message while using this command will return a list of music streamin platforms the provided song (link) is available on.`, description_short: 'Cross-platform music search', category: 'search', - usage: 'audio' + usage: 'audio', + slashCommand: "Music Platforms" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context) => { diff --git a/commands/message/search/google.js b/commands/message/search/google.js index dac2891..5e6665d 100644 --- a/commands/message/search/google.js +++ b/commands/message/search/google.js @@ -70,7 +70,8 @@ module.exports = { description_short: 'Search on Google', examples: ['google Eurasian Small Clawed Otter'], category: 'search', - usage: 'google ' + usage: 'google ', + slashCommand: "google" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { diff --git a/commands/message/search/lyrics.js b/commands/message/search/lyrics.js index 3264056..dffa2eb 100644 --- a/commands/message/search/lyrics.js +++ b/commands/message/search/lyrics.js @@ -48,7 +48,8 @@ module.exports = { description_short: 'Search song lyrics', examples: ['lyrics desert bloom man'], category: 'search', - usage: 'lyrics ' + usage: 'lyrics ', + slashCommand: "lyics" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { diff --git a/commands/message/search/reverse-image.js b/commands/message/search/reverse-image.js index 1701121..dd7f303 100644 --- a/commands/message/search/reverse-image.js +++ b/commands/message/search/reverse-image.js @@ -40,7 +40,8 @@ module.exports = { description: 'Performs a reverse-image-search.', description_short: 'Reverse image search', category: 'search', - usage: 'reverse ' + usage: 'reverse ', + slashCommand: "Reverse Image Search" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context) => { diff --git a/commands/message/search/wolfram-alpha.js b/commands/message/search/wolfram-alpha.js index 6dd66dd..e154db0 100644 --- a/commands/message/search/wolfram-alpha.js +++ b/commands/message/search/wolfram-alpha.js @@ -49,7 +49,8 @@ module.exports = { description_short: 'Compute via Wolfram|Alpha', examples: ['wa x^2+5x+6=0', 'wa 5€ to $', 'wa 5\'11 to cm'], category: 'search', - usage: 'wolframalpha ' + usage: 'wolframalpha ', + slashCommand: "wolframalpha" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { diff --git a/commands/message/search/youtube.js b/commands/message/search/youtube.js index 347fbe7..9313cee 100644 --- a/commands/message/search/youtube.js +++ b/commands/message/search/youtube.js @@ -117,7 +117,8 @@ module.exports = { description_short: `Search YouTube videos, channels and playlists.`, examples: ['youtube otter live cam'], category: 'search', - usage: 'youtube [-type ]' + usage: 'youtube [-type ]', + slashCommand: "youtube" }, args: [ {name: 'type', default: 'all', type: 'string', help: `Video Category`} diff --git a/commands/message/utils/dictionary.js b/commands/message/utils/dictionary.js index 8959b3a..df41549 100644 --- a/commands/message/utils/dictionary.js +++ b/commands/message/utils/dictionary.js @@ -57,9 +57,10 @@ module.exports = { metadata: { description: 'Looks up words and teminology in a dictionary.', description_short: 'Dictionary word definitions.', - examples: ['dictionary Gehen -lang de'], + examples: ['define Gehen -lang de'], category: 'utils', - usage: 'define [-lang ]' + usage: 'dictionary [-lang ]', + slashCommand: "dictionary" }, args: [ {name: 'lang', default: 'en', type: 'language', help: "Language to define in"}, diff --git a/commands/message/utils/emoji.js b/commands/message/utils/emoji.js index c0db3d3..cd20223 100644 --- a/commands/message/utils/emoji.js +++ b/commands/message/utils/emoji.js @@ -45,7 +45,8 @@ module.exports = { examples: ['e 😀', 'emojimix 🐱 🍞'], category: 'utils', usage: 'emoji []', - use_custom_ingest: true + use_custom_ingest: true, + slashCommand: "emoji" }, args: [ {name: 'type', default: 'twitter', type: 'string', help: `Emoji platform type`} diff --git a/commands/message/utils/emojipedia.js b/commands/message/utils/emojipedia.js index de09109..681c533 100644 --- a/commands/message/utils/emojipedia.js +++ b/commands/message/utils/emojipedia.js @@ -40,7 +40,8 @@ module.exports = { description_short: 'Detailed information about an emoji.', examples: ['ei 😀'], category: 'utils', - usage: 'emojiinfo ' + usage: 'emojipedia ', + slashCommand: "emojipedia" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.READ_MESSAGE_HISTORY, Permissions.USE_EXTERNAL_EMOJIS], run: async (context, args) => { diff --git a/commands/message/utils/ocr.js b/commands/message/utils/ocr.js index 4ec1dfa..7ca6c39 100644 --- a/commands/message/utils/ocr.js +++ b/commands/message/utils/ocr.js @@ -15,7 +15,8 @@ module.exports = { description: `${smallIconPill("reply", "Supports Replies")}\n\nUses Optical Character Recognition to detect text in images.`, description_short: 'Image text recognition.', category: 'utils', - usage: 'ocr ' + usage: 'ocr ', + slashCommand: "OCR" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.READ_MESSAGE_HISTORY, Permissions.USE_EXTERNAL_EMOJIS], run: async (context) => { diff --git a/commands/message/utils/ocrtr.js b/commands/message/utils/ocrtr.js index 724ac16..4fd7664 100644 --- a/commands/message/utils/ocrtr.js +++ b/commands/message/utils/ocrtr.js @@ -20,7 +20,8 @@ module.exports = { description_short: 'Image text recognition + translation.', examples: ['ocrtr en -from pl'], category: 'utils', - usage: 'ocrtr [-from ]' + usage: 'ocrtr [-from ]', + slashCommand: "OCR Translate" }, args: [ {name: 'from', default: 'auto', type: 'string', help: "Language to translate from"} diff --git a/commands/message/utils/screenshot.js b/commands/message/utils/screenshot.js index 5a70a3e..23f5725 100644 --- a/commands/message/utils/screenshot.js +++ b/commands/message/utils/screenshot.js @@ -15,7 +15,8 @@ module.exports = { description_short: 'Screenshot websites.', examples: ['ss google.com'], category: 'utils', - usage: 'screenshot ' + usage: 'screenshot ', + slashCommand: "screenshot" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.ATTACH_FILES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { diff --git a/commands/message/utils/weather.js b/commands/message/utils/weather.js index 3bd46a4..b27e159 100644 --- a/commands/message/utils/weather.js +++ b/commands/message/utils/weather.js @@ -17,7 +17,8 @@ module.exports = { description_short: 'Local weather information', examples: ['weather Otter, Germany'], category: 'utils', - usage: 'weather ' + usage: 'weather ', + slashCommand: "weather" }, permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { diff --git a/labscore/constants.js b/labscore/constants.js index 22f70d8..0aef400 100644 --- a/labscore/constants.js +++ b/labscore/constants.js @@ -56,7 +56,9 @@ module.exports.BADGE_ICONS = Object.freeze({ module.exports.ICONS = Object.freeze({ "brand": "<:ico_brand:1237843729880977459>", + "flask_mini": "<:ico_flask_mini:1260342544600928286>", + "subtext_lightbulb": "<:ico_subt_lightbulb:1262470784224591934>", "home": "<:ico_home:1165257185488551976>", "image": "<:ico_image:1165257188235825274>",