fix: resolve channel delay per-message for Discord channel ID support
The channelDelayMs was being resolved once at handler creation with 'discord' as the key, but configs use Discord channel IDs (e.g., '1465655303121928265'). This caused the peer reply check to never run since channelDelayMs was always 0. Now channelDelayMs is resolved per-message using the actual Discord channel ID from the incoming message, enabling per-channel delay configuration to work correctly.
This commit is contained in:
parent
b99ad70b46
commit
65446b0c48
@ -43,7 +43,7 @@ export function createDiscordMessageHandler(params: {
|
||||
const groupPolicy = params.discordConfig?.groupPolicy ?? "open";
|
||||
const ackReactionScope = params.cfg.messages?.ackReactionScope ?? "group-mentions";
|
||||
const debounceMs = resolveInboundDebounceMs({ cfg: params.cfg, channel: "discord" });
|
||||
const channelDelayMs = resolveChannelDelayMs({ cfg: params.cfg, channel: "discord" });
|
||||
// Note: channelDelayMs is resolved per-message below to support per-channel overrides
|
||||
const skipIfPeerRepliedMs = resolveSkipIfPeerRepliedMs({ cfg: params.cfg });
|
||||
|
||||
const debouncer = createInboundDebouncer<{ data: DiscordMessageEvent; client: Client }>({
|
||||
@ -168,6 +168,10 @@ export function createDiscordMessageHandler(params: {
|
||||
|
||||
return async (data, client) => {
|
||||
try {
|
||||
// Resolve channel delay per-message to support per-channel overrides via Discord channel ID
|
||||
const discordChannelId = data.message?.channelId ?? "discord";
|
||||
const channelDelayMs = resolveChannelDelayMs({ cfg: params.cfg, channel: discordChannelId });
|
||||
|
||||
// Apply channel delay for multi-bot coordination
|
||||
if (channelDelayMs > 0) {
|
||||
await sleep(channelDelayMs);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user