fix a problem with Logout

This commit is contained in:
ivy1996-encode 2021-03-16 18:00:30 +08:00
parent e44cf1e557
commit e07a798a08

13
bot.go
View File

@ -70,12 +70,15 @@ func (b *Bot) Login() error {
}
func (b *Bot) Logout() error {
info := b.storage.GetLoginInfo()
if err := b.Caller.Logout(info); err != nil {
return err
if b.Alive() {
info := b.storage.GetLoginInfo()
if err := b.Caller.Logout(info); err != nil {
return err
}
b.stopAsyncCALL(errors.New("logout"))
return nil
}
b.stopAsyncCALL(errors.New("logout"))
return nil
return errors.New("user not login")
}
// 登录逻辑