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