diff --git a/commands.go b/commands.go index d5840a2..f1ad108 100644 --- a/commands.go +++ b/commands.go @@ -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") } } diff --git a/go.mod b/go.mod index 07f8ad2..6518f81 100644 --- a/go.mod +++ b/go.mod @@ -19,4 +19,4 @@ require ( github.com/prometheus/client_golang v1.6.0 ) -replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.3.0 +replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.3.1 diff --git a/go.sum b/go.sum index ccc1484..4b5be60 100644 --- a/go.sum +++ b/go.sum @@ -116,6 +116,8 @@ github.com/tulir/go-whatsapp v0.2.9 h1:hagfBU+oqFzXw3Wb4U/ugR2kOZAzJDq3RVIzyz74c github.com/tulir/go-whatsapp v0.2.9/go.mod h1:gyw9zGup1/Y3ZQUueZaqz3iR/WX9a2Lth4aqEbXjkok= github.com/tulir/go-whatsapp v0.3.0 h1:68aLiPNaWDWMnH3WMw/z2as6KsmBnCMyn+Lkk5i1v70= github.com/tulir/go-whatsapp v0.3.0/go.mod h1:7yGOBdWidM6gsmbAFwgkwHEIhzVrm01+6UbImpMWfTM= +github.com/tulir/go-whatsapp v0.3.1 h1:WEiRaG1zlmS0+MHwPbURqQEy3ZqofJ9UgS+UZD1KAOQ= +github.com/tulir/go-whatsapp v0.3.1/go.mod h1:7yGOBdWidM6gsmbAFwgkwHEIhzVrm01+6UbImpMWfTM= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/provisioning.go b/provisioning.go index 4f06d8d..99d45cd 100644 --- a/provisioning.go +++ b/provisioning.go @@ -247,9 +247,9 @@ func (prov *ProvisioningAPI) Ping(w http.ResponseWriter, r *http.Request) { "is_logged_in": user.Conn.IsLoggedIn(), "is_login_in_progress": user.Conn.IsLoginInProgress(), } - ok, err := user.Conn.AdminTest() + err := user.Conn.AdminTest() wa["ping"] = map[string]interface{}{ - "ok": ok, + "ok": err == nil, "err": err, } }