- Introduced global command channel whitelist and blacklist in the GuildSettings model for improved command access control. - Implemented command gate logic in the command routing to handle channel and role restrictions, providing user feedback for denied commands. - Enhanced the CommandsManager component to support global rules and channel/role selection, improving the user interface for managing command permissions. - Updated localization files to include new keys for global command rules and related messages, ensuring clarity in user interactions.
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { Suspense } from 'react';
|
|
import { CommandsManager } from '@/components/modules/commands-manager';
|
|
import { listGuildChannelsForDashboard, listGuildRolesForDashboard } from '@/lib/discord-guild-resources';
|
|
import { getLocale, t } from '@/lib/i18n';
|
|
import { getCommandGlobalRules } from '@/lib/module-configs/command-global-rules';
|
|
import { listCommandOverridesDashboard } from '@/lib/module-configs/commands';
|
|
|
|
interface CommandsPageProps {
|
|
params: Promise<{ guildId: string }>;
|
|
}
|
|
|
|
export default async function CommandsPage({ params }: CommandsPageProps) {
|
|
const { guildId } = await params;
|
|
const [locale, commands, globalRules, channels, roles] = await Promise.all([
|
|
getLocale(),
|
|
listCommandOverridesDashboard(guildId),
|
|
getCommandGlobalRules(guildId),
|
|
listGuildChannelsForDashboard(guildId).catch(() => []),
|
|
listGuildRolesForDashboard(guildId).catch(() => [])
|
|
]);
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<div>
|
|
<h1 className="text-2xl font-semibold">{t(locale, 'modulePages.commands.title')}</h1>
|
|
<p className="text-sm text-muted-foreground">{t(locale, 'modulePages.commands.description')}</p>
|
|
</div>
|
|
<Suspense fallback={null}>
|
|
<CommandsManager
|
|
guildId={guildId}
|
|
initialCommands={commands}
|
|
initialGlobalRules={globalRules}
|
|
channels={channels}
|
|
roles={roles}
|
|
/>
|
|
</Suspense>
|
|
</div>
|
|
);
|
|
}
|