mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: moved cmdName behaviour to interaction create
This commit is contained in:
1 parent
3e8e198c88
commit
6f21789c46
17 files changed
+21
-37
No files matched your search
@@ -3,7 +3,6 @@ import packageJSON from '../../package.json' assert { type: 'json' };
|
||||
import { tankopedia } from '../core/blitz/tankopedia.js';
|
||||
import { tankAverages } from '../core/blitzstars/tankAverages.js';
|
||||
import cleanTable from '../core/interaction/cleanTable.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import infoEmbed from '../core/interaction/infoEmbed.js';
|
||||
import getClientId from '../core/process/getClientId.js';
|
||||
import { CommandRegistry } from '../events/interactionCreate.js';
|
||||
@@ -17,7 +16,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('debug'))
|
||||
.setName('debug')
|
||||
.setDescription('Debug information about the bot'),
|
||||
|
||||
execute(interaction) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import getPeriodStart from '../core/blitzstars/getPeriodStart.js';
|
||||
import getTankStatsOverTime from '../core/blitzstars/getTankStatsOverTime.js';
|
||||
import { tankAverages } from '../core/blitzstars/tankAverages.js';
|
||||
import cleanTable, { TableInput } from '../core/interaction/cleanTable.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import negativeEmbed from '../core/interaction/negativeEmbed.js';
|
||||
import positiveEmbed from '../core/interaction/positiveEmbed.js';
|
||||
import addUsernameOption from '../core/options/addUsernameOption.js';
|
||||
@@ -30,7 +29,7 @@ export default {
|
||||
inPublic: false,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('eligible'))
|
||||
.setName('eligible')
|
||||
.setDescription('Checks eligibility for any Skilled clan')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
|
||||
@@ -13,7 +13,6 @@ import resolveTankId from '../core/blitz/resolveTankId.js';
|
||||
import resolveTankName from '../core/blitz/resolveTankName.js';
|
||||
import { tankopedia } from '../core/blitz/tankopedia.js';
|
||||
import getTankHistories from '../core/blitzstars/getTankHistories.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import { supportBlitzStars } from '../core/interaction/supportBlitzStars.js';
|
||||
import {
|
||||
Period,
|
||||
@@ -33,7 +32,7 @@ export default {
|
||||
|
||||
command: addStatsSubCommandGroups(
|
||||
new SlashCommandBuilder()
|
||||
.setName(cmdName('evolution'))
|
||||
.setName('evolution')
|
||||
.setDescription('Evolution of statistics'),
|
||||
),
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import discord from '../../discord.json' assert { type: 'json' };
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import infoEmbed from '../core/interaction/infoEmbed.js';
|
||||
import {
|
||||
CommandRegistry,
|
||||
@@ -15,7 +14,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('help'))
|
||||
.setName('help')
|
||||
.setDescription('All the help you need about the bot'),
|
||||
|
||||
execute(interaction) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import { BLITZ_SERVERS } from '../constants/servers.js';
|
||||
import clanAutocomplete from '../core/autocomplete/clan.js';
|
||||
import getBlitzClan from '../core/blitz/getBlitzClan.js';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import addClanChoices from '../core/options/addClanChoices.js';
|
||||
import { WARGAMING_APPLICATION_ID } from '../core/process/args.js';
|
||||
import { CommandRegistry } from '../events/interactionCreate.js';
|
||||
@@ -23,7 +22,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('inactive'))
|
||||
.setName('inactive')
|
||||
.setDescription('Lists all inactive players')
|
||||
.addStringOption(addClanChoices)
|
||||
.addNumberOption((option) =>
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
Tier,
|
||||
tankopedia,
|
||||
} from '../core/blitz/tankopedia.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import addUsernameOption from '../core/options/addUsernameOption.js';
|
||||
import { WARGAMING_APPLICATION_ID } from '../core/process/args.js';
|
||||
import { CommandRegistry } from '../events/interactionCreate.js';
|
||||
@@ -48,7 +47,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('ownedtanks'))
|
||||
.setName('ownedtanks')
|
||||
.setDescription("Shows a player's owned tanks")
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import { CommandRegistry } from '../events/interactionCreate.js';
|
||||
|
||||
export default {
|
||||
@@ -9,7 +8,7 @@ export default {
|
||||
handlesInteraction: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('ping'))
|
||||
.setName('ping')
|
||||
.setDescription('Check if the bot is alive'),
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import usernameAutocomplete from '../core/autocomplete/username.js';
|
||||
import getBlitzAccount from '../core/blitz/getBlitzAccount.js';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse.js';
|
||||
import cleanTable, { TableInputEntry } from '../core/interaction/cleanTable.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import infoEmbed from '../core/interaction/infoEmbed.js';
|
||||
import addUsernameOption from '../core/options/addUsernameOption.js';
|
||||
import { WARGAMING_APPLICATION_ID } from '../core/process/args.js';
|
||||
@@ -21,7 +20,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('playerachievements'))
|
||||
.setName('playerachievements')
|
||||
.setDescription("All the player's achievements")
|
||||
.addStringOption(addUsernameOption)
|
||||
.addStringOption((option) =>
|
||||
|
||||
@@ -4,7 +4,6 @@ import usernameAutocomplete from '../core/autocomplete/username.js';
|
||||
import getBlitzAccount from '../core/blitz/getBlitzAccount.js';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse.js';
|
||||
import cleanTable from '../core/interaction/cleanTable.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import infoEmbed from '../core/interaction/infoEmbed.js';
|
||||
import addUsernameOption from '../core/options/addUsernameOption.js';
|
||||
import { WARGAMING_APPLICATION_ID } from '../core/process/args.js';
|
||||
@@ -17,7 +16,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('playerinfo'))
|
||||
.setName('playerinfo')
|
||||
.setDescription('Basic information about a player')
|
||||
.addStringOption(addUsernameOption),
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import { SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { BLITZ_SERVERS, BlitzServer } from '../constants/servers.js';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import infoEmbed from '../core/interaction/infoEmbed.js';
|
||||
import addClanChoices from '../core/options/addClanChoices.js';
|
||||
import addServerChoices from '../core/options/addServerChoices.js';
|
||||
@@ -16,7 +15,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('searchclans'))
|
||||
.setName('searchclans')
|
||||
.setDescription('Search clans')
|
||||
.addStringOption(addServerChoices)
|
||||
.addStringOption((option) => addClanChoices(option).setAutocomplete(false))
|
||||
|
||||
@@ -3,7 +3,6 @@ import markdownEscape from 'markdown-escape';
|
||||
import { BLITZ_SERVERS, BlitzServer } from '../constants/servers.js';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse.js';
|
||||
import { usernamePattern } from '../core/blitz/listAccountsPanServer.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import infoEmbed from '../core/interaction/infoEmbed.js';
|
||||
import addServerChoices from '../core/options/addServerChoices.js';
|
||||
import addUsernameOption from '../core/options/addUsernameOption.js';
|
||||
@@ -17,7 +16,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('searchplayers'))
|
||||
.setName('searchplayers')
|
||||
.setDescription('Search players in a Blitz server')
|
||||
.addStringOption(addServerChoices)
|
||||
.addStringOption((option) =>
|
||||
|
||||
@@ -2,7 +2,6 @@ import { SlashCommandBuilder } from 'discord.js';
|
||||
import { go } from 'fuzzysort';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { TANK_NAMES } from '../core/blitz/tankopedia.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import infoEmbed from '../core/interaction/infoEmbed.js';
|
||||
import addTankChoices from '../core/options/addTankChoices.js';
|
||||
import { CommandRegistry } from '../events/interactionCreate.js';
|
||||
@@ -13,7 +12,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('searchtanks'))
|
||||
.setName('searchtanks')
|
||||
.setDescription('Search tanks')
|
||||
.addStringOption((option) => addTankChoices(option).setAutocomplete(false))
|
||||
.addIntegerOption((option) =>
|
||||
|
||||
@@ -17,7 +17,6 @@ import sumStats from '../core/blitz/sumStats.js';
|
||||
import { Tier, tankopedia } from '../core/blitz/tankopedia.js';
|
||||
import getTankStatsOverTime from '../core/blitzstars/getTankStatsOverTime.js';
|
||||
import { tankAverages } from '../core/blitzstars/tankAverages.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import addStatsSubCommandGroups from '../core/options/addStatsSubCommandGroups.js';
|
||||
import getPeriodDataFromSubcommand from '../core/options/getPeriodDataFromSubcommand.js';
|
||||
import { WARGAMING_APPLICATION_ID } from '../core/process/args.js';
|
||||
@@ -36,7 +35,7 @@ export default {
|
||||
|
||||
command: addStatsSubCommandGroups(
|
||||
new SlashCommandBuilder()
|
||||
.setName(cmdName('stats'))
|
||||
.setName('stats')
|
||||
.setDescription('In-game statistics'),
|
||||
),
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import { tankopedia } from '../core/blitz/tankopedia.js';
|
||||
import getTankStatsOverTime from '../core/blitzstars/getTankStatsOverTime.js';
|
||||
import last5AM from '../core/blitzstars/last5AM.js';
|
||||
import { tankAverages } from '../core/blitzstars/tankAverages.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import fullBlitzStarsStats from '../core/interaction/fullBlitzStarsStats.js';
|
||||
import { supportBlitzStars } from '../core/interaction/supportBlitzStars.js';
|
||||
import addUsernameOption from '../core/options/addUsernameOption.js';
|
||||
@@ -31,7 +30,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('today'))
|
||||
.setName('today')
|
||||
.setDescription('A general daily breakdown of your performance')
|
||||
.addStringOption(addUsernameOption),
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import discord from '../../discord.json' assert { type: 'json' };
|
||||
import usernameAutocomplete from '../core/autocomplete/username.js';
|
||||
import getBlitzAccount from '../core/blitz/getBlitzAccount.js';
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse.js';
|
||||
import cmdName from '../core/interaction/cmdName.js';
|
||||
import negativeEmbed from '../core/interaction/negativeEmbed.js';
|
||||
import positiveEmbed from '../core/interaction/positiveEmbed.js';
|
||||
import addUsernameOption from '../core/options/addUsernameOption.js';
|
||||
@@ -19,7 +18,7 @@ export default {
|
||||
inPublic: true,
|
||||
|
||||
command: new SlashCommandBuilder()
|
||||
.setName(cmdName('verify'))
|
||||
.setName('verify')
|
||||
.setDescription("Set's the user's username to their in-game name")
|
||||
.addStringOption((option) => addUsernameOption(option).setRequired(true)),
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import isDev from '../process/isDev.js';
|
||||
|
||||
export default function cmdName(name: string) {
|
||||
return isDev() ? `${name}dev` : name;
|
||||
}
|
||||
@@ -96,10 +96,14 @@ export const publicCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] =
|
||||
|
||||
Object.entries(commands).forEach(([, registry]) => {
|
||||
if (isDev() ? registry.inDevelopment : registry.inProduction) {
|
||||
const json = registry.command
|
||||
.setName(isDev() ? `${registry.command.name}dev` : registry.command.name)
|
||||
.toJSON();
|
||||
|
||||
if (registry.inPublic) {
|
||||
publicCommands.push(registry.command.toJSON());
|
||||
publicCommands.push(json);
|
||||
} else {
|
||||
guildCommands.push(registry.command.toJSON());
|
||||
guildCommands.push(json);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user