mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
add slash command hints to help
This commit is contained in:
parent
34ba5a6e94
commit
1f6e2cd1f1
19 changed files with 63 additions and 22 deletions
|
@ -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 </${cmd[0].name}:${cmd[0].ids.first()}> 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)
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -16,7 +16,8 @@ module.exports = {
|
|||
description_short: 'Get discord user avatars',
|
||||
examples: ['avatar labsCore'],
|
||||
category: 'info',
|
||||
usage: 'avatar [<user>]'
|
||||
usage: 'avatar [<user>]',
|
||||
slashCommmand: 'avatar'
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
|
|
|
@ -17,7 +17,8 @@ module.exports = {
|
|||
description_short: 'Information about discord users',
|
||||
examples: ['user labsCore'],
|
||||
category: 'info',
|
||||
usage: 'user [<user>]'
|
||||
usage: 'user [<user>]',
|
||||
slashCommand: 'user'
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -70,7 +70,8 @@ module.exports = {
|
|||
description_short: 'Search on Google',
|
||||
examples: ['google Eurasian Small Clawed Otter'],
|
||||
category: 'search',
|
||||
usage: 'google <query>'
|
||||
usage: 'google <query>',
|
||||
slashCommand: "google"
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
|
|
|
@ -48,7 +48,8 @@ module.exports = {
|
|||
description_short: 'Search song lyrics',
|
||||
examples: ['lyrics desert bloom man'],
|
||||
category: 'search',
|
||||
usage: 'lyrics <query>'
|
||||
usage: 'lyrics <query>',
|
||||
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) => {
|
||||
|
|
|
@ -40,7 +40,8 @@ module.exports = {
|
|||
description: 'Performs a reverse-image-search.',
|
||||
description_short: 'Reverse image search',
|
||||
category: 'search',
|
||||
usage: 'reverse <image>'
|
||||
usage: 'reverse <image>',
|
||||
slashCommand: "Reverse Image Search"
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context) => {
|
||||
|
|
|
@ -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 <query>'
|
||||
usage: 'wolframalpha <query>',
|
||||
slashCommand: "wolframalpha"
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
|
|
|
@ -117,7 +117,8 @@ module.exports = {
|
|||
description_short: `Search YouTube videos, channels and playlists.`,
|
||||
examples: ['youtube otter live cam'],
|
||||
category: 'search',
|
||||
usage: 'youtube <query> [-type <category>]'
|
||||
usage: 'youtube <query> [-type <category>]',
|
||||
slashCommand: "youtube"
|
||||
},
|
||||
args: [
|
||||
{name: 'type', default: 'all', type: 'string', help: `Video Category`}
|
||||
|
|
|
@ -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 <query> [-lang <language>]'
|
||||
usage: 'dictionary <query> [-lang <language>]',
|
||||
slashCommand: "dictionary"
|
||||
},
|
||||
args: [
|
||||
{name: 'lang', default: 'en', type: 'language', help: "Language to define in"},
|
||||
|
|
|
@ -45,7 +45,8 @@ module.exports = {
|
|||
examples: ['e 😀', 'emojimix 🐱 🍞'],
|
||||
category: 'utils',
|
||||
usage: 'emoji <emoji> [<emoji to mix>]',
|
||||
use_custom_ingest: true
|
||||
use_custom_ingest: true,
|
||||
slashCommand: "emoji"
|
||||
},
|
||||
args: [
|
||||
{name: 'type', default: 'twitter', type: 'string', help: `Emoji platform type`}
|
||||
|
|
|
@ -40,7 +40,8 @@ module.exports = {
|
|||
description_short: 'Detailed information about an emoji.',
|
||||
examples: ['ei 😀'],
|
||||
category: 'utils',
|
||||
usage: 'emojiinfo <emoji>'
|
||||
usage: 'emojipedia <emoji>',
|
||||
slashCommand: "emojipedia"
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.READ_MESSAGE_HISTORY, Permissions.USE_EXTERNAL_EMOJIS],
|
||||
run: async (context, args) => {
|
||||
|
|
|
@ -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 <attachment>'
|
||||
usage: 'ocr <attachment>',
|
||||
slashCommand: "OCR"
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.READ_MESSAGE_HISTORY, Permissions.USE_EXTERNAL_EMOJIS],
|
||||
run: async (context) => {
|
||||
|
|
|
@ -20,7 +20,8 @@ module.exports = {
|
|||
description_short: 'Image text recognition + translation.',
|
||||
examples: ['ocrtr en -from pl'],
|
||||
category: 'utils',
|
||||
usage: 'ocrtr <language> [-from <origin language>]'
|
||||
usage: 'ocrtr <language> [-from <origin language>]',
|
||||
slashCommand: "OCR Translate"
|
||||
},
|
||||
args: [
|
||||
{name: 'from', default: 'auto', type: 'string', help: "Language to translate from"}
|
||||
|
|
|
@ -15,7 +15,8 @@ module.exports = {
|
|||
description_short: 'Screenshot websites.',
|
||||
examples: ['ss google.com'],
|
||||
category: 'utils',
|
||||
usage: 'screenshot <url>'
|
||||
usage: 'screenshot <url>',
|
||||
slashCommand: "screenshot"
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.ATTACH_FILES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
|
|
|
@ -17,7 +17,8 @@ module.exports = {
|
|||
description_short: 'Local weather information',
|
||||
examples: ['weather Otter, Germany'],
|
||||
category: 'utils',
|
||||
usage: 'weather <location>'
|
||||
usage: 'weather <location>',
|
||||
slashCommand: "weather"
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
|
|
|
@ -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>",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue