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:
smueller
2026-07-24 12:26:00 +02:00
parent 20593b7173
commit c7fb3d7041
22 changed files with 572 additions and 4 deletions

View File

@@ -1455,6 +1455,10 @@ export const commandLocales = {
de: 'Bot-Info: Version, Uptime, Shard, Links',
en: 'Bot info: version, uptime, shard, links'
},
'core.about.description': {
de: 'Über Nexumi',
en: 'About Nexumi'
},
'core.invite.description': {
de: 'Einladungslink für Nexumi',
en: 'Invite link for Nexumi'

View File

@@ -3,7 +3,7 @@ import { z } from 'zod';
/** Discord MessageFlags.IsComponentsV2 */
export const COMPONENTS_V2_FLAG = 32768 as const;
export const ComponentV2SourceSchema = z.enum(['w', 'l', 't', 's', 'm']);
export const ComponentV2SourceSchema = z.enum(['w', 'l', 't', 's', 'm', 'a']);
export type ComponentV2Source = z.infer<typeof ComponentV2SourceSchema>;
export const ComponentActionTypeSchema = z.enum([

View File

@@ -66,7 +66,7 @@ const de: Dictionary = {
'core.help.subtitle': 'Commands nach Modul. Optional: `/help module:<name>`.',
'core.help.moduleLine': '**{module}**: {commands}',
'core.help.unknownModule': 'Unbekanntes Modul. Verfügbar: {modules}',
'core.help.footer': 'Mehr Infos: /info · Dashboard: {webui}',
'core.help.footer': 'Mehr Infos: /info · /about · Dashboard: {webui}',
'core.info.title': 'Nexumi',
'core.info.version': 'Version',
'core.info.uptime': 'Uptime',
@@ -78,6 +78,10 @@ const de: Dictionary = {
'core.info.link.invite': 'Einladen',
'core.info.link.support': 'Support',
'core.info.link.status': 'Status',
'core.about.defaultTitle': 'Über Nexumi',
'core.about.defaultBody':
'Nexumi ist ein öffentlicher Discord-Bot mit Dashboard. Konfiguriere diese Nachricht im Owner-Panel unter About.',
'core.about.disabled': 'Die About-Nachricht ist derzeit deaktiviert.',
'core.invite.title': 'Nexumi einladen',
'core.invite.body': 'Lade Nexumi mit diesem Link auf deinen Server ein:',
'core.support.title': 'Support',
@@ -658,7 +662,7 @@ const en: Dictionary = {
'core.help.subtitle': 'Commands by module. Optional: `/help module:<name>`.',
'core.help.moduleLine': '**{module}**: {commands}',
'core.help.unknownModule': 'Unknown module. Available: {modules}',
'core.help.footer': 'More: /info · Dashboard: {webui}',
'core.help.footer': 'More: /info · /about · Dashboard: {webui}',
'core.info.title': 'Nexumi',
'core.info.version': 'Version',
'core.info.uptime': 'Uptime',
@@ -670,6 +674,10 @@ const en: Dictionary = {
'core.info.link.invite': 'Invite',
'core.info.link.support': 'Support',
'core.info.link.status': 'Status',
'core.about.defaultTitle': 'About Nexumi',
'core.about.defaultBody':
'Nexumi is a public Discord bot with a dashboard. Configure this message in the Owner panel under About.',
'core.about.disabled': 'The about message is currently disabled.',
'core.invite.title': 'Invite Nexumi',
'core.invite.body': 'Invite Nexumi to your server with this link:',
'core.support.title': 'Support',

View File

@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest';
import {
BotAboutConfigSchema,
BotPresenceConfigSchema,
FeatureFlagUpsertSchema,
ownerRoleAtLeast,
@@ -19,6 +20,17 @@ describe('owner schemas', () => {
expect(parsed.activityText).toBe('nexumi.de');
});
it('parses about config', () => {
const parsed = BotAboutConfigSchema.parse({
enabled: true,
messageType: 'EMBED',
content: null,
embed: { title: 'About', description: 'Nexumi', color: 0x6366f1 },
components: null
});
expect(parsed.embed?.title).toBe('About');
});
it('ranks owner roles', () => {
expect(ownerRoleAtLeast('ADMIN', 'SUPPORT')).toBe(true);
expect(ownerRoleAtLeast('VIEWER', 'ADMIN')).toBe(false);

View File

@@ -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';