mirror of
https://github.com/crystelf/crystelf-core.git
synced 2025-07-04 14:49:19 +00:00
优化bot上报
This commit is contained in:
parent
106b61b137
commit
a635c82078
@ -68,14 +68,9 @@ class WSMessageHandler {
|
|||||||
private async handleReportBots(socket: WebSocket, msg: any) {
|
private async handleReportBots(socket: WebSocket, msg: any) {
|
||||||
logger.debug(`received reportBots: ${msg.data}`);
|
logger.debug(`received reportBots: ${msg.data}`);
|
||||||
const clientId = msg.data[0].client;
|
const clientId = msg.data[0].client;
|
||||||
|
|
||||||
const botsData = msg.data.slice(1);
|
const botsData = msg.data.slice(1);
|
||||||
|
await redisService.persistData('crystelfBots', botsData, clientId);
|
||||||
for (const bot of botsData) {
|
logger.debug(`保存了 ${botsData.length} 个 bot(client: ${clientId})`);
|
||||||
await redisService.persistData('crystelfBots', bot, clientId);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.debug(`已保存 ${botsData.length} 个 bot 数据 (client: ${clientId})`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public registerHandler(type: string, handler: MessageHandler): void {
|
public registerHandler(type: string, handler: MessageHandler): void {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user