Skip to content

Commit

Permalink
修复用户主动退出,logoutcallback不执行的bug 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
eatmoreapple committed Jul 19, 2022
1 parent 3605ad0 commit 6484a80
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ func (b *Bot) LoginWithUUID(uuid string) error {
// Logout 用户退出
func (b *Bot) Logout() error {
if b.Alive() {
if b.LogoutCallBack != nil {
b.LogoutCallBack(b)
}
info := b.Storage.LoginInfo
if err := b.Caller.Logout(info); err != nil {
return err
Expand Down Expand Up @@ -287,7 +284,6 @@ func (b *Bot) stopSyncCheck(err error) bool {
}
b.err = err
b.Exit()
log.Printf("exit with : %s", err.Error())
return false
}

Expand All @@ -313,6 +309,9 @@ func (b *Bot) Block() error {

// Exit 主动退出,让 Block 不在阻塞
func (b *Bot) Exit() {
if b.LogoutCallBack != nil {
b.LogoutCallBack(b)
}
b.self = nil
b.cancel()
}
Expand Down

0 comments on commit 6484a80

Please sign in to comment.