添加退出回调
This commit is contained in:
parent
e2004af0a0
commit
8e1d0e0163
4
bot.go
4
bot.go
@ -10,6 +10,7 @@ import (
|
||||
type Bot struct {
|
||||
ScanCallBack func(body []byte) // 扫码回调,可获取扫码用户的头像
|
||||
LoginCallBack func(body []byte) // 登陆回调
|
||||
LogoutCallBack func(bot *Bot) // 退出回调
|
||||
UUIDCallback func(uuid string) // 获取UUID的回调函数
|
||||
MessageHandler func(msg *Message) // 获取消息成功的handle
|
||||
GetMessageErrorHandler func(err error) // 获取消息发生错误的handle
|
||||
@ -137,6 +138,9 @@ func (b *Bot) Login() error {
|
||||
// 用户退出
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user