From 774ab8796627bc866bfd46c2b2aa79c20463ef4d Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Sat, 26 Apr 2025 11:39:07 -0400 Subject: [PATCH] change preset shorthand to pr --- README.md | 4 +- config.example.ts | 2 +- mod.ts | 29 ++++++------ src/constantCmds.ts | 109 ++++++++++++++++++++++++-------------------- 4 files changed, 79 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 1c27a67..bc10d2c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Logogram Discord Bot - A FFXIV Eureka Utility Bot | V1.2.0 - 2025/04/25 +# Logogram Discord Bot - A FFXIV Eureka Utility Bot | V1.2.1 - 2025/04/25 A Discord bot for Eureka Logos Actions and their recipes. ## Commands @@ -12,7 +12,7 @@ A Discord bot for Eureka Logos Actions and their recipes. - Examples: `-class=healer`, `-class=drg` - `-page=#` - Use to view more search results -- `preset` or `p` +- `preset` or `pr` - Shows a pre-made list of actions for convenient viewing - `flowchart` or `flow` or `f` - Shows a simple flowchart for best actions diff --git a/config.example.ts b/config.example.ts index f16ea47..5d2bf71 100755 --- a/config.example.ts +++ b/config.example.ts @@ -1,6 +1,6 @@ export const config = { name: 'Logogram Bot', // Name of the bot - version: '1.2.0', // Version of the bot + version: '1.2.1', // Version of the bot token: 'the_bot_token', // Discord API Token for this bot localToken: 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token" prefix: 'l!', // Prefix for all commands diff --git a/mod.ts b/mod.ts index c9cf8be..1bb6010 100755 --- a/mod.ts +++ b/mod.ts @@ -158,7 +158,9 @@ startBot({ }); } else if (query && data.ActionShortNames.includes(query)) { log(LT.LOG, `in shorthand matched '${query}'`); - const searchResults: Array = data.Actions.filter((action) => action.shorthand === query).map((action) => data.ActionNames.indexOf(action.name.toLowerCase())); + const searchResults: Array = data.Actions.filter((action) => action.shorthand === query).map((action) => + data.ActionNames.indexOf(action.name.toLowerCase()) + ); message .send({ content: searchResults.length > 1 ? `Showing ${searchResults.length} actions:` : 'Showing single action:', @@ -169,7 +171,9 @@ startBot({ }); } else { log(LT.LOG, `in general search '${query}'`); - const initialSearchResults: Array = data.ActionNames.filter((action) => action.includes(query)).map((action) => data.ActionNames.indexOf(action)); + const initialSearchResults: Array = data.ActionNames.filter((action) => action.includes(query)).map((action) => + data.ActionNames.indexOf(action) + ); const searchResults: Array = initialSearchResults.filter((actionIdx) => params.class ? (data.Actions[actionIdx].jobs.includes('all-nin') && !params.isNin) || @@ -185,9 +189,10 @@ startBot({ } const classMessage = params.class ? ` -class=${params.rawClass}` : ''; const userQuery = `${rawQuery}${classMessage}`.trim(); - const paginationMessage = searchResults.length > config.resultsPerPage - ? `\nShowing page ${params.page} of ${totalPages}\n\nTo see more results, please run \`${config.prefix}logos ${userQuery} -page=#\`, where # is the page number you wish to see.` - : ''; + const paginationMessage = + searchResults.length > config.resultsPerPage + ? `\nShowing page ${params.page} of ${totalPages}\n\nTo see more results, please run \`${config.prefix}logos ${userQuery} -page=#\`, where # is the page number you wish to see.` + : ''; message .send({ content: `${searchResults.length} result${searchResults.length > 1 ? 's' : ''} matching query: \`${userQuery}\`${paginationMessage}`, @@ -207,8 +212,8 @@ startBot({ } } } - } else if (command === 'preset' || command === 'p') { - // l!preset or l!p + } else if (command === 'preset' || command === 'pr') { + // l!preset or l!pr // Returns logos actions stuff const rawQuery = args.join(' '); const query = rawQuery.toLowerCase(); @@ -226,12 +231,10 @@ startBot({ } else if (!query) { message .send({ - content: `Available presets: ${ - data.Presets.keys() - .toArray() - .map((p) => `\`${p}\``) - .join(', ') - }`, + content: `Available presets: ${data.Presets.keys() + .toArray() + .map((p) => `\`${p}\``) + .join(', ')}`, }) .catch((e) => { log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`); diff --git a/src/constantCmds.ts b/src/constantCmds.ts index 7379294..142c676 100755 --- a/src/constantCmds.ts +++ b/src/constantCmds.ts @@ -4,61 +4,72 @@ const errorColor = 0xe71212; export const constantCmds = { help: { - embeds: [{ - title: `${config.name}'s Available Commands:`, - fields: [ - { - name: `\`${config.prefix}?\``, - value: 'This command', - inline: true, - }, - { - name: `\`${config.prefix}info\``, - value: 'Prints some information and links relating to the bot', - inline: true, - }, - { - name: `\`${config.prefix}version\``, - value: 'Prints the bots version', - inline: true, - }, - { - name: `\`${config.prefix}logograms [query]\` or \`${config.prefix}l [query]\``, - value: 'Sends information about the requested logogram, or logograms matching the query\nCan use `-class=abbr` to further filter the results, or `-page=#` to view more results', - inline: true, - }, - { - name: `\`${config.prefix}preset [query]\` or \`${config.prefix}p [query]\``, - value: 'Sends information about the requested preset list', - inline: true, - }, - { - name: `\`${config.prefix}flowchart]\` or \`${config.prefix}f\``, - value: 'Shows a simple flowchart for best actions', - inline: true, - }, - ], - }], + embeds: [ + { + title: `${config.name}'s Available Commands:`, + fields: [ + { + name: `\`${config.prefix}?\``, + value: 'This command', + inline: true, + }, + { + name: `\`${config.prefix}info\``, + value: 'Prints some information and links relating to the bot', + inline: true, + }, + { + name: `\`${config.prefix}version\``, + value: 'Prints the bots version', + inline: true, + }, + { + name: `\`${config.prefix}logograms [query]\` or \`${config.prefix}l [query]\``, + value: + 'Sends information about the requested logogram, or logograms matching the query\nCan use `-class=abbr` to further filter the results, or `-page=#` to view more results', + inline: true, + }, + { + name: `\`${config.prefix}preset [query]\` or \`${config.prefix}pr [query]\``, + value: 'Sends information about the requested preset list', + inline: true, + }, + { + name: `\`${config.prefix}flowchart]\` or \`${config.prefix}f\``, + value: 'Shows a simple flowchart for best actions', + inline: true, + }, + ], + }, + ], }, info: { - embeds: [{ - fields: [{ - name: `${config.name}, a Discord bot for Eureka Logogram Actions.`, - value: `${config.name} is developed by Ean AKA Burn_E99.\n\nFINAL FANTASY XIV SQUARE ENIX CO., LTD. FINAL FANTASY is a registered trademark of Square Enix Holdings Co., Ltd. All material used under license.`, - }], - }], + embeds: [ + { + fields: [ + { + name: `${config.name}, a Discord bot for Eureka Logogram Actions.`, + value: `${config.name} is developed by Ean AKA Burn_E99.\n\nFINAL FANTASY XIV SQUARE ENIX CO., LTD. FINAL FANTASY is a registered trademark of Square Enix Holdings Co., Ltd. All material used under license.`, + }, + ], + }, + ], }, version: { - embeds: [{ - title: `My current version is ${config.version}`, - }], + embeds: [ + { + title: `My current version is ${config.version}`, + }, + ], }, logogramsNoQuery: { - embeds: [{ - color: errorColor, - title: 'No query provided!', - description: `Please type something after the command, such as \`${config.prefix}logos wisdom\`.`, - }], + embeds: [ + { + color: errorColor, + title: 'No query provided!', + description: `Please type something after the command, such as \`${config.prefix}logos wisdom\`.`, + }, + ], }, flowchart: 'https://ffxiv.eanm.dev/eureka/Simple-Logos-Flowchart.png', };