mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
fix(discord): restrict activity types and statuses to valid enum values
- Removed 'offline' from valid config statuses (use 'invisible'). - Restricted activityType to 0, 1, 2, 3, 5 (excluding custom/4). - Added logic to only send 'url' when activityType is 1 (Streaming). - Updated Typescript definitions and Zod schemas to match.
This commit is contained in:
@@ -178,9 +178,9 @@ export type DiscordAccountConfig = {
|
||||
/** Bot activity status text (e.g. "Watching X"). */
|
||||
activity?: string;
|
||||
/** Bot status (online|dnd|idle|invisible). Default: online. */
|
||||
status?: "online" | "dnd" | "idle" | "invisible" | "offline";
|
||||
status?: "online" | "dnd" | "idle" | "invisible";
|
||||
/** Activity type (0=Game, 1=Streaming, 2=Listening, 3=Watching, 5=Competing). Default: 3 (Watching). */
|
||||
activityType?: number;
|
||||
activityType?: 0 | 1 | 2 | 3 | 5;
|
||||
/** Streaming URL (Twitch/YouTube). Required if activityType=1. */
|
||||
activityUrl?: string;
|
||||
};
|
||||
|
||||
@@ -333,8 +333,10 @@ export const DiscordAccountSchema = z
|
||||
.optional(),
|
||||
responsePrefix: z.string().optional(),
|
||||
activity: z.string().optional(),
|
||||
status: z.enum(["online", "dnd", "idle", "invisible", "offline"]).optional(),
|
||||
activityType: z.number().int().min(0).max(5).optional(),
|
||||
status: z.enum(["online", "dnd", "idle", "invisible"]).optional(),
|
||||
activityType: z
|
||||
.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3), z.literal(5)])
|
||||
.optional(),
|
||||
activityUrl: z.string().optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
Reference in New Issue
Block a user