优化bot上报

This commit is contained in:
Jerry 2025-05-03 19:39:27 +08:00
parent 66f085b68e
commit 106b61b137

View File

@ -68,7 +68,14 @@ class WSMessageHandler {
private async handleReportBots(socket: WebSocket, msg: any) {
logger.debug(`received reportBots: ${msg.data}`);
const clientId = msg.data[0].client;
await redisService.persistData('crystelfBots', msg.data[1], clientId);
const botsData = msg.data.slice(1);
for (const bot of botsData) {
await redisService.persistData('crystelfBots', bot, clientId);
}
logger.debug(`已保存 ${botsData.length} 个 bot 数据 (client: ${clientId})`);
}
public registerHandler(type: string, handler: MessageHandler): void {