fix: 删除bot后重置activeBotId,编辑立即更新名称,config fetch await防空值

1. 删除活跃bot后将activeBotId置null,由fetchBots自动选新的
2. updateBot同时更新内存中的name(无需重启即可看到名称变化)
3. openEditBot改为async await config请求,失败时用bot名称做fallback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.6 committed 2026-03-30 20:54:33 +08:00
1 parent 067a30233f
commit 4dbbaaf8f5
3 files changed
+29 -20

No files matched your search

+6 -1
View File
@@ -107,7 +107,12 @@ export class BotManager {
defaultChannel: params.defaultChannel ?? existing.defaultChannel,
channelPassword: params.channelPassword ?? existing.channelPassword,
});
this.logger.info({ botId: id }, "Bot instance config updated (restart to apply)");
// Update in-memory name immediately (other fields need reconnect)
const bot = this.bots.get(id);
if (bot && params.name) {
bot.name = params.name;
}
this.logger.info({ botId: id }, "Bot instance config updated (connection changes need restart)");
}
getBotConfig(id: string): import("../data/database.js").BotInstance | undefined {