feat(discord): add configurable bot message filtering, allow bot to receive other bots' messages (#6505)

* feat(discord): add configurable bot message filtering

Add `discord_allow_bot_messages` config option to allow receiving
messages from other Discord bots. This is useful for bot-to-bot
communication scenarios like message forwarding between channels.

By default, bot messages are still ignored (backward compatible).

Usage: Set `discord_allow_bot_messages: true` in your Discord
platform configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(discord): add WebUI config for discord_allow_bot_messages

Add configuration option to the dashboard for the new
discord_allow_bot_messages feature. Users can now enable/disable
this option through the WebUI in all supported languages
(zh-CN, en-US, ru-RU).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(discord): use typed constructor argument for allow_bot_messages

Address code review feedback:
- Add `allow_bot_messages` as a typed constructor argument in DiscordBotClient
- Simplify the on_message check by using the instance attribute directly
- Pass the parameter in constructor instead of using setattr

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: MinaraAgent <minara-agent@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MinaraAgent
2026-04-11 01:27:46 +08:00
committed by GitHub
co-authored by Claude Opus 4.6 MinaraAgent
parent 574e5089ba
commit b8ccfe3f64
6 changed files with 25 additions and 3 deletions
@@ -390,6 +390,10 @@
"description": "Discord Activity Name",
"hint": "Optional Discord activity name. Leave empty to disable."
},
"discord_allow_bot_messages": {
"description": "Allow Bot Messages",
"hint": "When enabled, AstrBot will receive messages from other Discord bots. Useful for bot-to-bot communication scenarios (e.g., message forwarding). Disabled by default."
},
"discord_command_register": {
"description": "Register Discord slash commands",
"hint": "When enabled, AstrBot will automatically register plugin commands as Discord slash commands"
@@ -390,6 +390,10 @@
"description": "Название активности Discord",
"hint": "Статус бота в Discord. Оставьте пустым для отключения."
},
"discord_allow_bot_messages": {
"description": "Разрешить сообщения от ботов",
"hint": "Если включено, AstrBot будет получать сообщения от других Discord-ботов. Полезно для взаимодействия между ботами (например, пересылка сообщений). По умолчанию отключено."
},
"discord_command_register": {
"description": "Регистрировать слэш-команды Discord",
"hint": "Если включено, команды плагинов будут зарегистрированы как /команды Discord."
@@ -392,6 +392,10 @@
"description": "Discord 活动名称",
"hint": "可选的 Discord 活动名称。留空则不设置活动。"
},
"discord_allow_bot_messages": {
"description": "允许接收机器人消息",
"hint": "启用后,AstrBot 将接收来自其他 Discord 机器人的消息。适用于机器人间通信场景(如消息转发)。默认关闭。"
},
"discord_command_register": {
"description": "注册 Discord 指令",
"hint": "启用后,自动将插件指令注册为 Discord 斜杠指令"