feat: add ignoreBotReactions config toggle for Discord (#508)
This commit is contained in:
@@ -34,6 +34,7 @@ export interface DiscordConfig {
|
||||
attachmentsMaxBytes?: number;
|
||||
groups?: Record<string, GroupModeConfig>; // Per-guild/channel settings
|
||||
agentName?: string; // For scoping daily limit counters in multi-agent mode
|
||||
ignoreBotReactions?: boolean; // Ignore all bot reactions (default: true). Set false for multi-bot setups.
|
||||
}
|
||||
|
||||
export function shouldProcessDiscordBotMessage(params: {
|
||||
@@ -434,7 +435,11 @@ Ask the bot owner to approve with:
|
||||
user: import('discord.js').User | import('discord.js').PartialUser,
|
||||
action: InboundReaction['action']
|
||||
): Promise<void> {
|
||||
if ('bot' in user && user.bot) return;
|
||||
// By default ignore all bot reactions; when ignoreBotReactions is false,
|
||||
// only ignore self-reactions (allows multi-bot setups)
|
||||
const ignoreBots = this.config.ignoreBotReactions ?? true;
|
||||
if (ignoreBots && 'bot' in user && user.bot) return;
|
||||
if (!ignoreBots && user.id === this.client?.user?.id) return;
|
||||
|
||||
try {
|
||||
if (reaction.partial) {
|
||||
|
||||
@@ -372,6 +372,7 @@ export interface DiscordConfig {
|
||||
instantGroups?: string[]; // Guild/server IDs or channel IDs that bypass batching
|
||||
listeningGroups?: string[]; // @deprecated Use groups.<id>.mode = "listen"
|
||||
groups?: Record<string, GroupConfig>; // Per-guild/channel settings, "*" for defaults
|
||||
ignoreBotReactions?: boolean; // Ignore all bot reactions (default: true). Set false for multi-bot setups.
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -468,6 +468,7 @@ function createChannelsForAgent(
|
||||
attachmentsMaxBytes,
|
||||
groups: agentConfig.channels.discord.groups,
|
||||
agentName: agentConfig.name,
|
||||
ignoreBotReactions: agentConfig.channels.discord.ignoreBotReactions,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user