feat: added command suffix to commands

This commit is contained in:
TresAbhi committed 2023-07-05 01:15:18 +00:00
1 parent d2d575bd72
commit 423a8b8088
17 files changed
+66 -67

No files matched your search

+2 -2
View File
@@ -10,7 +10,7 @@ import { CommandRegistry } from '../events/interactionCreate/index.js';
const executionStart = new Date().getTime(); const executionStart = new Date().getTime();
export default { export const debugCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -42,4 +42,4 @@ export default {
]), ]),
); );
}, },
} satisfies CommandRegistry; };
+2 -2
View File
@@ -23,7 +23,7 @@ export const SKILLED_CLANS: Record<SkilledClan, string> = {
SMRI: 'Samurai', SMRI: 'Samurai',
}; };
export default { export const eligibleCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: false, inPublic: false,
@@ -169,4 +169,4 @@ export default {
return (isEligible ? embedPositive : embedNegative)(title, body); return (isEligible ? embedPositive : embedNegative)(title, body);
}, },
} satisfies CommandRegistry; };
+3 -3
View File
@@ -18,9 +18,9 @@ import evolution from '../renderers/evolution.js';
import { StatType } from '../renderers/statsfull.js'; import { StatType } from '../renderers/statsfull.js';
import { AccountInfo } from '../types/accountInfo.js'; import { AccountInfo } from '../types/accountInfo.js';
export default { export const evolutionCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true, inDevelopment: false,
inPublic: true, inPublic: true,
command: addStatTypeSubCommandGroups( command: addStatTypeSubCommandGroups(
@@ -83,4 +83,4 @@ export default {
parseInt(url.searchParams.get('tankId')!), parseInt(url.searchParams.get('tankId')!),
); );
}, },
} satisfies CommandRegistry; };
+2 -2
View File
@@ -8,7 +8,7 @@ import {
publicCommands, publicCommands,
} from '../events/interactionCreate/index.js'; } from '../events/interactionCreate/index.js';
export default { export const helpCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -33,4 +33,4 @@ export default {
)}\n\n*I am a new bot; I may make mistakes and go offline unexpectedly from time to time.*`, )}\n\n*I am a new bot; I may make mistakes and go offline unexpectedly from time to time.*`,
); );
}, },
} satisfies CommandRegistry; };
+2 -2
View File
@@ -16,7 +16,7 @@ import { ClanInfo } from '../types/clanInfo.js';
const DEFAULT_THRESHOLD = 7; const DEFAULT_THRESHOLD = 7;
export default { export const inactiveCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -85,4 +85,4 @@ export default {
}, },
autocomplete: autocompleteClan, autocomplete: autocompleteClan,
} satisfies CommandRegistry; };
@@ -41,7 +41,7 @@ const COMP_TANKS = [
6753, // type 71 6753, // type 71
]; ];
export default { export const ownedTanksCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -121,4 +121,4 @@ export default {
}, },
autocomplete: autocompleteUsername, autocomplete: autocompleteUsername,
} satisfies CommandRegistry; };
+2 -2
View File
@@ -1,7 +1,7 @@
import { SlashCommandBuilder } from 'discord.js'; import { SlashCommandBuilder } from 'discord.js';
import { CommandRegistry } from '../events/interactionCreate/index.js'; import { CommandRegistry } from '../events/interactionCreate/index.js';
export default { export const pingCommand: CommandRegistry<true> = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -30,4 +30,4 @@ export default {
const executionTime = Date.now() - executionStart; const executionTime = Date.now() - executionStart;
interaction.editReply(`Pong 🏓 - ${executionTime}ms`); interaction.editReply(`Pong 🏓 - ${executionTime}ms`);
}, },
} satisfies CommandRegistry<true>; };
@@ -16,7 +16,7 @@ import { AccountInfo } from '../types/accountInfo.js';
type SortBy = 'name' | 'count'; type SortBy = 'name' | 'count';
export default { export const playerAchievementsCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -75,4 +75,4 @@ export default {
}, },
autocomplete: autocompleteUsername, autocomplete: autocompleteUsername,
} satisfies CommandRegistry; };
@@ -10,7 +10,7 @@ import { WARGAMING_APPLICATION_ID } from '../core/node/arguments.js';
import { CommandRegistry } from '../events/interactionCreate/index.js'; import { CommandRegistry } from '../events/interactionCreate/index.js';
import { AccountInfo } from '../types/accountInfo.js'; import { AccountInfo } from '../types/accountInfo.js';
export default { export const playerInfoCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -57,4 +57,4 @@ export default {
}, },
autocomplete: autocompleteUsername, autocomplete: autocompleteUsername,
} satisfies CommandRegistry; };
@@ -9,7 +9,7 @@ import { WARGAMING_APPLICATION_ID } from '../core/node/arguments.js';
import { CommandRegistry } from '../events/interactionCreate/index.js'; import { CommandRegistry } from '../events/interactionCreate/index.js';
import { ClanList } from '../types/clanList.js'; import { ClanList } from '../types/clanList.js';
export default { export const searchClansCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -44,4 +44,4 @@ export default {
.join('\n')}\n\`\`\``, .join('\n')}\n\`\`\``,
); );
}, },
} satisfies CommandRegistry; };
@@ -10,7 +10,7 @@ import { WARGAMING_APPLICATION_ID } from '../core/node/arguments.js';
import { CommandRegistry } from '../events/interactionCreate/index.js'; import { CommandRegistry } from '../events/interactionCreate/index.js';
import { AccountList } from '../types/accountList.js'; import { AccountList } from '../types/accountList.js';
export default { export const searchPlayersCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -52,4 +52,4 @@ export default {
}\`\`\``, }\`\`\``,
); );
}, },
} satisfies CommandRegistry; };
@@ -6,7 +6,7 @@ import addTankChoices from '../core/discord/addTankChoices.js';
import embedInfo from '../core/discord/embedInfo.js'; import embedInfo from '../core/discord/embedInfo.js';
import { CommandRegistry } from '../events/interactionCreate/index.js'; import { CommandRegistry } from '../events/interactionCreate/index.js';
export default { export const searchTanksCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -37,4 +37,4 @@ export default {
: `\`\`\`\n${results.join('\n')}\n\`\`\``, : `\`\`\`\n${results.join('\n')}\n\`\`\``,
); );
}, },
} satisfies CommandRegistry; };
+3 -3
View File
@@ -18,9 +18,9 @@ import stats from '../renderers/stats.js';
import { StatType } from '../renderers/statsfull.js'; import { StatType } from '../renderers/statsfull.js';
import { AccountInfo } from '../types/accountInfo.js'; import { AccountInfo } from '../types/accountInfo.js';
export default { export const statsCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: true, inDevelopment: false,
inPublic: true, inPublic: true,
command: addStatTypeSubCommandGroups( command: addStatTypeSubCommandGroups(
@@ -81,4 +81,4 @@ export default {
parseInt(url.searchParams.get('tankId')!), parseInt(url.searchParams.get('tankId')!),
); );
}, },
} satisfies CommandRegistry; };
@@ -17,7 +17,7 @@ import { CommandRegistry } from '../events/interactionCreate/index.js';
import statsfull, { StatType } from '../renderers/statsfull.js'; import statsfull, { StatType } from '../renderers/statsfull.js';
import { AccountInfo } from '../types/accountInfo.js'; import { AccountInfo } from '../types/accountInfo.js';
export default { export const statsFullCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -80,4 +80,4 @@ export default {
parseInt(url.searchParams.get('tankId')!), parseInt(url.searchParams.get('tankId')!),
); );
}, },
} satisfies CommandRegistry; };
+2 -2
View File
@@ -12,7 +12,7 @@ import { CommandRegistry } from '../events/interactionCreate/index.js';
import today from '../renderers/today.js'; import today from '../renderers/today.js';
import { AccountInfo } from '../types/accountInfo.js'; import { AccountInfo } from '../types/accountInfo.js';
export default { export const todayCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -49,4 +49,4 @@ export default {
return await today(player); return await today(player);
}, },
} satisfies CommandRegistry; };
+2 -2
View File
@@ -12,7 +12,7 @@ import { CommandRegistry } from '../events/interactionCreate/index.js';
import { AccountInfo } from '../types/accountInfo.js'; import { AccountInfo } from '../types/accountInfo.js';
import { PlayerClanData } from '../types/playerClanData.js'; import { PlayerClanData } from '../types/playerClanData.js';
export default { export const verifyCommand: CommandRegistry = {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: false,
inPublic: true, inPublic: true,
@@ -80,4 +80,4 @@ export default {
}, },
autocomplete: autocompleteUsername, autocomplete: autocompleteUsername,
} satisfies CommandRegistry; };
+32 -33
View File
@@ -13,22 +13,22 @@ import {
SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandsOnlyBuilder,
} from 'discord.js'; } from 'discord.js';
import discord from '../../../discord.json' assert { type: 'json' }; import discord from '../../../discord.json' assert { type: 'json' };
import debug from '../../commands/debug.js'; import { debugCommand } from '../../commands/debug.js';
import eligible from '../../commands/eligible.js'; import { eligibleCommand } from '../../commands/eligible.js';
import evolution from '../../commands/evolution.js'; import { evolutionCommand } from '../../commands/evolution.js';
import help from '../../commands/help.js'; import { helpCommand } from '../../commands/help.js';
import inactive from '../../commands/inactive.js'; import { inactiveCommand } from '../../commands/inactive.js';
import ownedtanks from '../../commands/ownedtanks.js'; import { ownedTanksCommand } from '../../commands/ownedTanks.js';
import ping from '../../commands/ping.js'; import { pingCommand } from '../../commands/ping.js';
import playerachievements from '../../commands/playerachievements.js'; import { playerAchievementsCommand } from '../../commands/playerAchievements.js';
import playerinfo from '../../commands/playerinfo.js'; import { playerInfoCommand } from '../../commands/playerInfo.js';
import searchclans from '../../commands/searchclans.js'; import { searchClansCommand } from '../../commands/searchClans.js';
import searchplayers from '../../commands/searchplayers.js'; import { searchPlayersCommand } from '../../commands/searchPlayers.js';
import searchtanks from '../../commands/searchtanks.js'; import { searchTanksCommand } from '../../commands/searchTanks.js';
import stats from '../../commands/stats.js'; import { statsCommand } from '../../commands/stats.js';
import statsfull from '../../commands/statsfull.js'; import { statsFullCommand } from '../../commands/statsFull.js';
import today from '../../commands/today.js'; import { todayCommand } from '../../commands/today.js';
import verify from '../../commands/verify.js'; import { verifyCommand } from '../../commands/verify.js';
import { DISCORD_TOKEN } from '../../core/node/arguments.js'; import { DISCORD_TOKEN } from '../../core/node/arguments.js';
import getClientId from '../../core/node/getClientId.js'; import getClientId from '../../core/node/getClientId.js';
import isDev from '../../core/node/isDev.js'; import isDev from '../../core/node/isDev.js';
@@ -72,26 +72,25 @@ const rest = new REST().setToken(DISCORD_TOKEN);
export const commands: Record<string, CommandRegistry> = ( export const commands: Record<string, CommandRegistry> = (
[ [
debug, debugCommand,
eligible, eligibleCommand,
help, helpCommand,
inactive, inactiveCommand,
ownedtanks, ownedTanksCommand,
playerachievements, playerAchievementsCommand,
playerinfo, playerInfoCommand,
searchclans, searchClansCommand,
searchplayers, searchPlayersCommand,
searchtanks, searchTanksCommand,
statsfull, statsFullCommand,
today, todayCommand,
verify, verifyCommand,
ping, pingCommand,
evolution, evolutionCommand,
stats, statsCommand,
] as CommandRegistry[] ] as CommandRegistry[]
).reduce((accumulator, registry) => { ).reduce((accumulator, registry) => {
if (isDev()) registry.command.setDefaultMemberPermissions(0); if (isDev()) registry.command.setDefaultMemberPermissions(0);
return { ...accumulator, [registry.command.name]: registry }; return { ...accumulator, [registry.command.name]: registry };
}, {}); }, {});