feat: preview servers

This commit is contained in:
TrèsAbhi committed 2024-03-16 15:07:05 -05:00
1 parent ec93d8e9ab
commit 04cd205fee
4 files changed
+19 -1

No files matched your search

+1
View File
@@ -31,6 +31,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
resolve({
inProduction: true,
inPublic: true,
inPreview: true,
command: createLocalizedCommand('research')
.addStringOption((option) =>
@@ -15,6 +15,11 @@ import { psa } from '../../../core/discord/psa';
import { translator } from '../../../core/localization/translator';
import { UserError } from '../../../hooks/userError';
const previewServers = [
'734786591205359697', // abhi
'460165161156870161', // optml
];
export default async function handleChatInputCommand(
interaction: ChatInputCommandInteraction<CacheType>,
) {
@@ -24,6 +29,16 @@ export default async function handleChatInputCommand(
await interaction.deferReply();
try {
if (
registry.inPreview &&
!previewServers.includes(`${interaction.guildId}`)
) {
const { t } = translator(interaction.locale);
interaction.editReply(t`bot.common.errors.preview`);
return;
}
const returnable = await registry.handler(interaction);
if (registry.handlesInteraction) return;
+1
View File
@@ -55,6 +55,7 @@ export type InteractionReturnable =
interface CommandRegistryBase {
inProduction: boolean;
inPublic: boolean;
inPreview?: boolean;
command:
| SlashCommandBuilder
+2 -1
View File
@@ -190,7 +190,8 @@
"tank_id_not_found": "# Tank not found\nCould not find tank by the ID \"%s\". Try typing the name of the tank instead of a number.",
"no_tank_stats": "# No tank stats available\nThis player doesn't have any stats available. This may not be the player you are looking for.",
"get_help": "Help Discord server",
"uncaught_error": "# Blitzkrieg ran into an error!\nWe're so sorry about this. Feel free to [join the official Discord server](https://discord.gg/nDt7AjGJQH) to get help."
"uncaught_error": "# Blitzkrieg ran into an error!\nWe're so sorry about this. Feel free to [join the official Discord server](https://discord.gg/nDt7AjGJQH) to get help.",
"preview": "# This command is in preview\n\nYou can only access this command in [the official Discord server](https://discord.gg/nDt7AjGJQH). The command will be generally available soon."
}
},