fix(discord): tune gateway intents and metadata timeout

This commit is contained in:
Peter Steinberger
2026-04-28 19:39:37 +01:00
parent 065284deab
commit 7191f1a1eb
9 changed files with 276 additions and 19 deletions

View File

@@ -792,6 +792,11 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
proxy: {
type: "string",
},
gatewayInfoTimeoutMs: {
type: "integer",
exclusiveMinimum: 0,
maximum: 120000,
},
allowBots: {
anyOf: [
{
@@ -1445,6 +1450,9 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
guildMembers: {
type: "boolean",
},
voiceStates: {
type: "boolean",
},
},
additionalProperties: false,
},
@@ -2147,6 +2155,11 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
proxy: {
type: "string",
},
gatewayInfoTimeoutMs: {
type: "integer",
exclusiveMinimum: 0,
maximum: 120000,
},
allowBots: {
anyOf: [
{
@@ -2800,6 +2813,9 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
guildMembers: {
type: "boolean",
},
voiceStates: {
type: "boolean",
},
},
additionalProperties: false,
},
@@ -3521,9 +3537,17 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Discord Guild Members Intent",
help: "Enable the Guild Members privileged intent. Must also be enabled in the Discord Developer Portal. Default: false.",
},
"intents.voiceStates": {
label: "Discord Voice States Intent",
help: "Enable the Guild Voice States intent. Defaults to the effective Discord voice setting; set false for text-only gateway sessions even when voice config is present.",
},
gatewayInfoTimeoutMs: {
label: "Discord Gateway Metadata Timeout (ms)",
help: "Timeout for Discord /gateway/bot metadata lookup before falling back to the default gateway URL. Default is 30000; OPENCLAW_DISCORD_GATEWAY_INFO_TIMEOUT_MS can override when config is unset.",
},
"voice.enabled": {
label: "Discord Voice Enabled",
help: "Enable Discord voice channel conversations (default: true). Omit channels.discord.voice to keep voice support disabled for the account.",
help: "Enable Discord voice channel conversations (default: true). Set false for text-only gateway sessions.",
},
"voice.model": {
label: "Discord Voice Model",

View File

@@ -116,6 +116,8 @@ export type DiscordIntentsConfig = {
presence?: boolean;
/** Enable Guild Members privileged intent (requires Portal opt-in). Default: false. */
guildMembers?: boolean;
/** Enable Guild Voice States intent. Defaults to voice.enabled, unless explicitly set. */
voiceStates?: boolean;
};
export type DiscordVoiceAutoJoinConfig = {
@@ -241,6 +243,8 @@ export type DiscordAccountConfig = {
token?: SecretInput;
/** HTTP(S) proxy URL for Discord gateway WebSocket connections. */
proxy?: string;
/** Timeout for Discord /gateway/bot metadata lookup before falling back to the default gateway URL. Default: 30000. */
gatewayInfoTimeoutMs?: number;
/** Allow bot-authored messages to trigger replies (default: false). Set "mentions" to gate on mentions. */
allowBots?: boolean | "mentions";
/**

View File

@@ -528,6 +528,7 @@ export const DiscordAccountSchema = z
configWrites: z.boolean().optional(),
token: SecretInputSchema.optional().register(sensitive),
proxy: z.string().optional(),
gatewayInfoTimeoutMs: z.number().int().positive().max(120_000).optional(),
allowBots: z.union([z.boolean(), z.literal("mentions")]).optional(),
dangerouslyAllowNameMatching: z.boolean().optional(),
groupPolicy: GroupPolicySchema.optional().default("allowlist"),
@@ -613,6 +614,7 @@ export const DiscordAccountSchema = z
.object({
presence: z.boolean().optional(),
guildMembers: z.boolean().optional(),
voiceStates: z.boolean().optional(),
})
.strict()
.optional(),