Implement Owner Panel features and maintenance mode handling
- Introduced the Owner Panel with new routes and UI components for managing guilds, user blacklists, feature flags, and bot presence. - Added maintenance mode functionality to prevent non-owner users from executing commands during maintenance periods. - Enhanced localization with new keys for Owner Panel features in both English and German. - Updated job processing to include a presence refresh job, ensuring the bot's status is regularly updated. - Improved environment configuration to support owner user IDs for access control.
This commit is contained in:
@@ -8,6 +8,7 @@ import { t } from '@nexumi/shared';
|
||||
import { env } from './env.js';
|
||||
import { logger } from './logger.js';
|
||||
import { getGuildLocale } from './i18n.js';
|
||||
import { isMaintenanceMode } from './presence.js';
|
||||
import { moderationCommands } from './modules/moderation/commands.js';
|
||||
import { automodCommands } from './modules/automod/commands.js';
|
||||
import { welcomeCommands } from './modules/welcome/commands.js';
|
||||
@@ -91,8 +92,18 @@ export async function registerCommands() {
|
||||
}
|
||||
|
||||
export async function routeCommand(interaction: ChatInputCommandInteraction, context: BotContext) {
|
||||
const command = map.get(interaction.commandName);
|
||||
const locale = await getGuildLocale(context.prisma, interaction.guildId);
|
||||
const maintenance = await isMaintenanceMode(context);
|
||||
const ownerIds = env.OWNER_USER_IDS ?? [];
|
||||
if (maintenance.enabled && !ownerIds.includes(interaction.user.id)) {
|
||||
await interaction.reply({
|
||||
content: maintenance.message?.trim() || t(locale, 'generic.maintenance'),
|
||||
ephemeral: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const command = map.get(interaction.commandName);
|
||||
if (!command) {
|
||||
await interaction.reply({ content: t(locale, 'generic.unknownCommand'), ephemeral: true });
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user