Skip to content

Commit

Permalink
fix: fix #130
Browse files Browse the repository at this point in the history
  • Loading branch information
sj817 committed Aug 14, 2024
1 parent 76b789d commit 8ab7a71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/event/handler/notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,16 @@ export class NoticeHandler extends EventBaseHandler {

/** 日志方法字符串 */
this.e.logFnc = `[${info.name}][accept]`
const logFnc = logger.fnc(this.e.logFnc)
const logFnc = logger.fnc(this.e.logFnc + `[${this.e.event}.${this.e.sub_event}]`)

this.GroupMsgPrint && info.log(this.e.self_id, `${logFnc + this.e.logText} 开始处理`)

/** 计算插件处理时间 */
const start = Date.now()
try {
const res = await info.fn(this.e)

this.GroupMsgPrint && logger.bot('info', this.e.self_id, `${logFnc} 处理完成 ${logger.green(Date.now() - start + 'ms')}`)
this.GroupMsgPrint && info.log(this.e.self_id, `${logFnc} 处理完成 ${logger.green(Date.now() - start + 'ms')}`)
if (res !== false) break
} catch (error: any) {
logger.error(`${logFnc}`)
Expand Down
6 changes: 4 additions & 2 deletions src/event/handler/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ export class RequestHandler extends EventBaseHandler {

/** 日志方法字符串 */
this.e.logFnc = `[${info.name}][accept]`
const logFnc = logger.fnc(this.e.logFnc)
const logFnc = logger.fnc(this.e.logFnc + `[${this.e.event}.${this.e.sub_event}]`)

this.GroupMsgPrint && info.log(this.e.self_id, `${logFnc + this.e.logText} 开始处理`)

/** 计算插件处理时间 */
const start = Date.now()

try {
const res = await info.fn(this.e)
this.GroupMsgPrint && logger.bot('info', this.e.self_id, `${logFnc} 处理完成 ${logger.green(Date.now() - start + 'ms')}`)
this.GroupMsgPrint && info.log(this.e.self_id, `${logFnc} 处理完成 ${logger.green(Date.now() - start + 'ms')}`)
if (res !== false) break
} catch (error: any) {
logger.error(`${logFnc}`)
Expand Down

0 comments on commit 8ab7a71

Please sign in to comment.