Skip to content

Commit

Permalink
fix: 登录失败输出错误信息,指令定义错误
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-cn committed Jun 21, 2023
1 parent 35eebb8 commit 49a7986
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export class Context extends EventEmitter {
command<S extends Command.Declare>(decl: S, config?: Command.Config): Command<ArgsType<Command.RemoveFirst<S>>>
command<S extends Command.Declare>(decl: S, initialValue?: ArgsType<Command.RemoveFirst<S>>, config?: Command.Config): Command<ArgsType<Command.RemoveFirst<S>>>
command<S extends Command.Declare>(decl: S, ...args: (ArgsType<Command.RemoveFirst<S>> | Command.Config)[]): Command<ArgsType<Command.RemoveFirst<S>>>{
const [nameDecl,argsDecl='']=decl.split(/\s+/)
const [nameDecl,...argsDecl]=decl.split(/\s+/)
if(!nameDecl)throw new Error('nameDecl不能为空')
const nameArr=nameDecl.split('/').filter(Boolean)
const name=nameArr.pop()
Expand All @@ -373,7 +373,7 @@ export class Context extends EventEmitter {
parent=this.zhin.findCommand(nameArr.shift())
if(!parent) throw new Error(`找不到父指令:${nameArr.join('/')}`)
}
const command=defineCommand(argsDecl,...args as any)
const command=defineCommand(argsDecl.join(' '),...args as any)
if(parent){
command.parent=parent
parent.children.push(command as unknown as Command)
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ ctx.on('icqq.system.login.device', (e) => {
}
})
})
ctx.on('icqq.system.login.error',e=>{
e.bot.adapter.logger.error(`${e.bot.self_id}:${e.message}`)
})

0 comments on commit 49a7986

Please sign in to comment.