mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 21:09:23 +00:00
chore: i18n for packet log messages
This commit is contained in:
parent
fb09af0e64
commit
8e550e216e
@ -49,7 +49,7 @@ export class NTQQPacketApi {
|
|||||||
.then()
|
.then()
|
||||||
.catch(this.core.context.logger.logError.bind(this.core.context.logger));
|
.catch(this.core.context.logger.logError.bind(this.core.context.logger));
|
||||||
} else {
|
} else {
|
||||||
this.core.context.logger.logWarn('PacketServer is not set, will not init NapCat.Packet!');
|
this.core.context.logger.logWarn('PacketServer未配置,NapCat.Packet将不会加载!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ export class NTQQPacketApi {
|
|||||||
this.logger.log(`上传资源${res.length}个,失败${res.filter(r => r.status === 'rejected').length}个`);
|
this.logger.log(`上传资源${res.length}个,失败${res.filter(r => r.status === 'rejected').length}个`);
|
||||||
res.forEach((result, index) => {
|
res.forEach((result, index) => {
|
||||||
if (result.status === 'rejected') {
|
if (result.status === 'rejected') {
|
||||||
this.logger.logError(`第${index + 1}个失败:${result.reason}`);
|
this.logger.logError(`上传第${index + 1}个资源失败:${result.reason}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ export class PacketClient {
|
|||||||
this.websocket.onopen = () => {
|
this.websocket.onopen = () => {
|
||||||
this.isConnected = true;
|
this.isConnected = true;
|
||||||
this.reconnectAttempts = 0;
|
this.reconnectAttempts = 0;
|
||||||
this.logger.log.bind(this.logger)(`[Core] [Packet Server] Connected to ${this.clientUrl}`);
|
this.logger.log.bind(this.logger)(`[Core] [Packet Server] 已连接到 ${this.clientUrl}`);
|
||||||
cb();
|
cb();
|
||||||
resolve();
|
resolve();
|
||||||
};
|
};
|
||||||
@ -85,14 +85,14 @@ export class PacketClient {
|
|||||||
this.reconnectAttempts++;
|
this.reconnectAttempts++;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.connect(cb).catch((error) => {
|
this.connect(cb).catch((error) => {
|
||||||
this.logger.logError.bind(this.logger)(`[Core] [Packet Server] Reconnecting attempt failed,${error.message}`);
|
this.logger.logError.bind(this.logger)(`[Core] [Packet Server] 尝试重连失败:${error.message}`);
|
||||||
});
|
});
|
||||||
}, 5000 * this.reconnectAttempts);
|
}, 5000 * this.reconnectAttempts);
|
||||||
} else {
|
} else {
|
||||||
this.logger.logError.bind(this.logger)(`[Core] [Packet Server] Max reconnect attempts reached. ${this.clientUrl}`);
|
this.logger.logError.bind(this.logger)(`[Core] [Packet Server] ${this.clientUrl} 已达到最大重连次数!`);
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
this.logger.logError.bind(this.logger)(`Error attempting to reconnect: ${error.message}`);
|
this.logger.logError.bind(this.logger)(`[Core] [Packet Server] 重连时出错: ${error.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ export class PacketClient {
|
|||||||
// 校验失败和异常 可能返回undefined
|
// 校验失败和异常 可能返回undefined
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!this.available) {
|
if (!this.available) {
|
||||||
this.logger.logError('NapCat.Packet is not init');
|
this.logger.logError('NapCat.Packet 未初始化!');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const md5 = crypto.createHash('md5').update(data).digest('hex');
|
const md5 = crypto.createHash('md5').update(data).digest('hex');
|
||||||
|
Loading…
Reference in New Issue
Block a user