Skip to content

Commit 6484a80

Browse files
committed
修复用户主动退出,logoutcallback不执行的bug 🐛
1 parent 3605ad0 commit 6484a80

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bot.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ func (b *Bot) LoginWithUUID(uuid string) error {
152152
// Logout 用户退出
153153
func (b *Bot) Logout() error {
154154
if b.Alive() {
155-
if b.LogoutCallBack != nil {
156-
b.LogoutCallBack(b)
157-
}
158155
info := b.Storage.LoginInfo
159156
if err := b.Caller.Logout(info); err != nil {
160157
return err
@@ -287,7 +284,6 @@ func (b *Bot) stopSyncCheck(err error) bool {
287284
}
288285
b.err = err
289286
b.Exit()
290-
log.Printf("exit with : %s", err.Error())
291287
return false
292288
}
293289

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

314310
// Exit 主动退出,让 Block 不在阻塞
315311
func (b *Bot) Exit() {
312+
if b.LogoutCallBack != nil {
313+
b.LogoutCallBack(b)
314+
}
316315
b.self = nil
317316
b.cancel()
318317
}

0 commit comments

Comments
 (0)