mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
optimize
This commit is contained in:
parent
8564630c4d
commit
183eab2cf4
@ -18,18 +18,15 @@ export default class Log {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const file = path.join(LOG_DIR, cfg.filename)
|
const file = path.join(LOG_DIR, cfg.filename)
|
||||||
const refreshNick = ctx.debounce(() => {
|
/*const refreshNick = ctx.debounce(() => {
|
||||||
const ntUserApi = ctx.get('ntUserApi')
|
const ntUserApi = ctx.get('ntUserApi')
|
||||||
if (ntUserApi && !selfInfo.nick) {
|
if (ntUserApi && !selfInfo.nick) {
|
||||||
ntUserApi.getSelfNick(true)
|
ntUserApi.getSelfNick(true)
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)*/
|
||||||
const target: Logger.Target = {
|
const target: Logger.Target = {
|
||||||
colors: 0,
|
colors: 0,
|
||||||
record: (record: Logger.Record) => {
|
record: (record: Logger.Record) => {
|
||||||
if (!selfInfo.nick) {
|
|
||||||
refreshNick()
|
|
||||||
}
|
|
||||||
const dateTime = new Date(record.timestamp).toLocaleString()
|
const dateTime = new Date(record.timestamp).toLocaleString()
|
||||||
const userInfo = selfInfo.uin ? `${selfInfo.nick}(${selfInfo.uin})` : ''
|
const userInfo = selfInfo.uin ? `${selfInfo.nick}(${selfInfo.uin})` : ''
|
||||||
const content = `${dateTime} [${record.type}] ${userInfo} | ${record.name} ${record.content}\n\n`
|
const content = `${dateTime} [${record.type}] ${userInfo} | ${record.name} ${record.content}\n\n`
|
||||||
|
@ -153,8 +153,8 @@ export function invoke<ReturnType>(params: InvokeParams<ReturnType>) {
|
|||||||
afterFirstCmd && secondCallback()
|
afterFirstCmd && secondCallback()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log('ntqq api call failed', result)
|
log('ntqq api call failed,', params.methodName, result)
|
||||||
reject(`ntqq api call failed, ${result.errMsg}`)
|
reject(`ntqq api call failed, ${params.methodName}, ${result.errMsg}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ class OB11WebSocketReverse {
|
|||||||
|
|
||||||
this.wsClient.on('close', () => {
|
this.wsClient.on('close', () => {
|
||||||
disposeHeartBeat()
|
disposeHeartBeat()
|
||||||
this.ctx.logger.info('The websocket connection: ' + this.config.url + ' closed, trying reconnecting...')
|
this.ctx.logger.info(`The websocket connection: ${this.config.url} closed${this.running ? ', trying reconnecting...' : ''}`)
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
this.ctx.setTimeout(() => this.tryConnect(), 3000)
|
this.ctx.setTimeout(() => this.tryConnect(), 3000)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user