mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
feat: added basic infrastructure for ratings command
This commit is contained in:
1 parent
9419aec116
commit
aa6011b18d
40 files changed
+227
-96
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
ChatInputCommandInteraction,
|
||||
} from 'discord.js';
|
||||
import { commands } from '..';
|
||||
import discord from '../../../../discord.json' assert { type: 'json' };
|
||||
import embedNegative from '../../../core/discord/embedNegative';
|
||||
import embedWarning from '../../../core/discord/embedWarning';
|
||||
import normalizeInteractionReturnable from '../../../core/discord/normalizeInteractionReturnable';
|
||||
@@ -21,6 +22,19 @@ export default async function handleChatInputCommand(
|
||||
await interaction.deferReply();
|
||||
|
||||
try {
|
||||
if (registry.inPreview && interaction.guildId !== discord.tres_guild_id) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
embedWarning(
|
||||
`\`/${registry.command.name}\` is in Public Preview`,
|
||||
'[Join the official Discord server](https://discord.gg/nDt7AjGJQH) to gain early access to this command before it is released to the public.',
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const returnable = await registry.handler(interaction);
|
||||
|
||||
if (registry.handlesInteraction) return;
|
||||
|
||||
@@ -23,6 +23,7 @@ import { ownedTanksCommand } from '../../commands/ownedTanks';
|
||||
import { pingCommand } from '../../commands/ping';
|
||||
import { playerAchievementsCommand } from '../../commands/playerAchievements';
|
||||
import { playerInfoCommand } from '../../commands/playerInfo';
|
||||
import { ratingsCommand } from '../../commands/ratings';
|
||||
import { searchClansCommand } from '../../commands/searchClans';
|
||||
import { searchPlayersCommand } from '../../commands/searchPlayers';
|
||||
import { searchTanksCommand } from '../../commands/searchTanks';
|
||||
@@ -56,6 +57,7 @@ export interface Registry {
|
||||
export interface CommandRegistry<HandlesInteraction extends boolean = boolean>
|
||||
extends Registry {
|
||||
inPublic: boolean;
|
||||
inPreview?: boolean;
|
||||
handlesInteraction?: HandlesInteraction;
|
||||
command:
|
||||
| SlashCommandBuilder
|
||||
@@ -88,6 +90,7 @@ export const COMMANDS_RAW: CommandRegistry[] = [
|
||||
pingCommand,
|
||||
evolutionCommand,
|
||||
statsCommand,
|
||||
ratingsCommand,
|
||||
];
|
||||
export const commands: Record<string, CommandRegistry> = COMMANDS_RAW.reduce(
|
||||
(accumulator, registry) => {
|
||||
|
||||
Reference in new issue
Block a user