目前后台对 notification_channels 里的 Telegram 渠道执行创建、更新、启停、删除时,都会触发 telegram.ReloadBotAsync(...),但命令 bot reload 实际读取的并不是 notification_channels,而是 settings 表里的 system.telegram_bot_token / system.telegram_chat_id。
相关代码:
src/controller/admin/notification_controller.go:102-104
src/controller/admin/notification_controller.go:157-159
src/controller/admin/notification_controller.go:193-195
src/controller/admin/notification_controller.go:223-225
src/telegram/telegram.go:37-45
src/telegram/telegram.go:48-63
src/controller/admin/settings_controller.go:114-128
当前行为:
- 后台修改 Telegram notification channel 时,会看到代码显式触发 reload
- 但
reloadBot() 最终调用 loadCommandBotConfig()
loadCommandBotConfig() 只从 settings 读取 system.telegram_bot_token 和 system.telegram_chat_id
- 也就是说,notification channel 的
config 本身并不是命令 bot 的真实配置来源
影响:
- 后台行为和实际生效配置源不一致,容易让人误以为修改 notification channel 就能直接切换命令 bot
- 代码注释里也写着“from notification_channels”,但实际读取来源是 settings,排查时很容易被误导
- 现在更像是两套 Telegram 配置路径并存,只是通过 settings -> sync channel 的方式间接维持
建议:
- 明确命令 bot 的唯一配置来源
- 如果命令 bot 设计上就是读 settings,那 notification channel 的增删改不应该再以“reload command bot”的语义暴露出来
- 如果希望统一走 notification_channels,就需要让 reload 直接读取对应 channel 配置,而不是继续只读 settings
目前后台对
notification_channels里的 Telegram 渠道执行创建、更新、启停、删除时,都会触发telegram.ReloadBotAsync(...),但命令 bot reload 实际读取的并不是notification_channels,而是settings表里的system.telegram_bot_token/system.telegram_chat_id。相关代码:
src/controller/admin/notification_controller.go:102-104src/controller/admin/notification_controller.go:157-159src/controller/admin/notification_controller.go:193-195src/controller/admin/notification_controller.go:223-225src/telegram/telegram.go:37-45src/telegram/telegram.go:48-63src/controller/admin/settings_controller.go:114-128当前行为:
reloadBot()最终调用loadCommandBotConfig()loadCommandBotConfig()只从 settings 读取system.telegram_bot_token和system.telegram_chat_idconfig本身并不是命令 bot 的真实配置来源影响:
建议: