-
-
Notifications
You must be signed in to change notification settings - Fork 69.8k
fix(discord): channel ID in guild channels config causes 'channels unresolved' #26139
Description
Bug Description
When specifying a Discord channel by its numeric ID in openclaw.json under guilds.<guildId>.channels, the gateway fails to resolve the channel and logs channels unresolved.
Reproduction
Config:
{
"channels": {
"discord": {
"guilds": {
"1468266439856357409": {
"requireMention": true,
"channels": {
"1476042683708604518": {
"requireMention": false
}
}
}
}
}
}
}Expected: Channel resolves successfully by ID.
Actual: Log output:
[discord] channels unresolved: 1468266439856357409/1476042683708604518
Root Cause
In parseDiscordChannelInput, when parsing guildId/channelId format where the guild part is numeric, the channel part is always assigned to parsed.channel (name-based matching) instead of parsed.channelId (ID-based matching), even when the channel part is also a pure numeric string:
if (guild && /^\d+$/.test(guild)) return {
guildId: guild,
channel // ← always treated as a name, never as an ID
};Later in resolveDiscordChannelAllowlist, the if (parsed.channelId) branch (direct ID lookup) is skipped, and it falls through to name-based matching via normalizeDiscordSlug(channel.name) === normalizeDiscordSlug(channelQuery), which fails because no channel is named "1476042683708604518".
Workaround
Using the channel name instead of ID as the config key works:
"channels": {
"gins-clinic": {
"requireMention": false
}
}Log output:
[discord] channels resolved: 1468266439856357409/gins-clinic→1468266439856357409/1476042683708604518
Suggested Fix
When the channel part is a pure numeric string, return channelId instead of channel:
if (guild && /^\d+$/.test(guild)) {
if (/^\d+$/.test(channel)) {
return { guildId: guild, channelId: channel };
}
return { guildId: guild, channel };
}Environment
- OpenClaw: v2026.2.24
- OS: macOS 15.4
- Node: v22.x