Update go-whatsapp to handle unknown ping responses

This commit is contained in:
Tulir Asokan
2020-06-23 15:36:08 +03:00
parent 58de73f8b2
commit 63a1a77f26
4 changed files with 7 additions and 11 deletions

View File

@@ -412,19 +412,13 @@ func (handler *CommandHandler) CommandPing(ce *CommandEvent) {
}
} else if ce.User.Conn == nil {
ce.Reply("You don't have a WhatsApp connection.")
} else if ok, err := ce.User.Conn.AdminTest(); err != nil {
} else if err := ce.User.Conn.AdminTest(); err != nil {
if ce.User.IsLoginInProgress() {
ce.Reply("Connection not OK: %v, but login in progress", err)
} else {
ce.Reply("Connection not OK: %v", err)
}
} else if !ok {
if ce.User.IsLoginInProgress() {
ce.Reply("Connection not OK, but no error received and login in progress")
} else {
ce.Reply("Connection not OK, but no error received")
}
} else {
} else {
ce.Reply("Connection to WhatsApp OK")
}
}