From e07a798a08d7a4027962a3b6262e95dc7a75e143 Mon Sep 17 00:00:00 2001 From: ivy1996-encode <15055461510@163.com> Date: Tue, 16 Mar 2021 18:00:30 +0800 Subject: [PATCH] fix a problem with Logout --- bot.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bot.go b/bot.go index 54d4c9c..ffb5e1c 100644 --- a/bot.go +++ b/bot.go @@ -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") } // 登录逻辑