Add global /about command and configuration
- Introduced `BotAboutConfig` model for managing the global `/about` message in the owner panel. - Implemented the `/about` command with localization support and integrated it into the help catalog. - Enhanced the dashboard with a new owner section for configuring the `/about` message type and content. - Updated components to handle the new command and its interactions, including support for different message formats (TEXT, EMBED, COMPONENTS_V2). - Added localization entries for the `/about` command in English and German, improving accessibility for users. - Documented the implementation in the phase tracking documentation for future reference.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import { MessageComponentsV2Schema } from './components-v2.js';
|
||||
import { WelcomeEmbedSchema } from './phase2.js';
|
||||
|
||||
const snowflake = z.string().regex(/^\d{17,20}$/);
|
||||
|
||||
@@ -114,3 +116,26 @@ export const OwnerAuditEntrySchema = z.object({
|
||||
export type OwnerAuditEntry = z.infer<typeof OwnerAuditEntrySchema>;
|
||||
|
||||
export const PRESENCE_REDIS_KEY = 'bot:presence';
|
||||
|
||||
export const BotAboutMessageTypeSchema = z.enum(['TEXT', 'EMBED', 'COMPONENTS_V2']);
|
||||
export type BotAboutMessageType = z.infer<typeof BotAboutMessageTypeSchema>;
|
||||
|
||||
/** Global `/about` reply configured in the Owner panel. */
|
||||
export const BotAboutConfigSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
messageType: BotAboutMessageTypeSchema,
|
||||
content: z.string().max(2000).nullable(),
|
||||
embed: WelcomeEmbedSchema.nullable(),
|
||||
components: MessageComponentsV2Schema.nullable()
|
||||
});
|
||||
|
||||
export type BotAboutConfig = z.infer<typeof BotAboutConfigSchema>;
|
||||
|
||||
export const BotAboutConfigPatchSchema = BotAboutConfigSchema.partial().refine(
|
||||
(value) => Object.keys(value).length > 0,
|
||||
{ message: 'At least one field is required' }
|
||||
);
|
||||
|
||||
export type BotAboutConfigPatch = z.infer<typeof BotAboutConfigPatchSchema>;
|
||||
|
||||
export const ABOUT_REDIS_KEY = 'bot:about';
|
||||
|
||||
Reference in New Issue
Block a user