improve search terms to allow c or no dash on them, add generic dps support for class

This commit is contained in:
Ean Milligan 2024-09-13 00:30:20 -04:00
parent 4e79bfd01b
commit 51cb8004ea
5 changed files with 17 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# Logogram Discord Bot - A FFXIV Eureka Utility Bot | V1.1.0 - 2025/09/04
# Logogram Discord Bot - A FFXIV Eureka Utility Bot | V1.1.1 - 2025/09/13
A Discord bot for Eureka Logos Actions and their recipes.
## Commands

View File

@ -1,6 +1,6 @@
export const config = {
'name': 'Logogram Bot', // Name of the bot
'version': '1.1.0', // Version of the bot
'version': '1.1.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

9
mod.ts
View File

@ -109,17 +109,20 @@ startBot({
page: 1,
};
const classPrefixes = ['-class=', 'class=', '-c=', 'c='];
const pagePrefixes = ['-page=', 'page=', '-p=', 'p='];
args.forEach((arg) => {
if (arg.toLowerCase().startsWith('-class=')) {
if (classPrefixes.some(pfx => arg.toLowerCase().startsWith(pfx))) { //
params.rawClass = arg.split('=')[1];
params.class = classToType(params.rawClass);
params.isNin = params.rawClass.toLowerCase() === 'nin';
} else if (arg.toLowerCase().startsWith('-page=')) {
} else if (pagePrefixes.some(pfx => arg.toLowerCase().startsWith(pfx))) {
params.page = parseInt(arg.split('=')[1]);
}
});
const cleanArgs = args.filter((arg) => !(arg.toLowerCase().startsWith('-class=') || arg.toLowerCase().startsWith('-page=')));
const cleanArgs = args.filter((arg) => !(classPrefixes.concat(pagePrefixes).some(pfx => arg.toLowerCase().startsWith(pfx))));
const rawQuery = cleanArgs.join(' ');
const query = rawQuery.toLowerCase();

View File

@ -745,6 +745,13 @@ const Actions: Array<LogosAction> = [
},
];
// add dps flag at runtime
Actions.forEach(action => {
if (action.jobs.includes('melee') || action.jobs.includes('ranged') || action.jobs.includes('magic')) {
action.jobs.push('dps');
}
});
const ActionNames = Actions.map((action) => action.name.toLowerCase());
const Presets: Map<string, Array<number>> = new Map([

View File

@ -1,5 +1,7 @@
export const classToType = (classAbr: string) => {
switch (classAbr.toLowerCase()) {
case 'dps':
return 'dps';
case 'tank':
case 'pld':
case 'war':