mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-13 17:13:11 +01:00
Suggest delete-session when trying to logout without connection. Fixes #98
This commit is contained in:
parent
e4bc254a65
commit
64af0209b7
1 changed files with 6 additions and 3 deletions
|
@ -121,7 +121,9 @@ func (handler *CommandHandler) CommandMux(ce *CommandEvent) {
|
|||
handler.CommandDevTest(ce)
|
||||
case "set-pl":
|
||||
handler.CommandSetPowerLevel(ce)
|
||||
case "login-matrix", "logout", "sync", "list", "open", "pm":
|
||||
case "logout":
|
||||
handler.CommandLogout(ce)
|
||||
case "login-matrix", "sync", "list", "open", "pm":
|
||||
if !ce.User.HasSession() {
|
||||
ce.Reply("You are not logged in. Use the `login` command to log into WhatsApp.")
|
||||
return
|
||||
|
@ -133,8 +135,6 @@ func (handler *CommandHandler) CommandMux(ce *CommandEvent) {
|
|||
switch ce.Command {
|
||||
case "login-matrix":
|
||||
handler.CommandLoginMatrix(ce)
|
||||
case "logout":
|
||||
handler.CommandLogout(ce)
|
||||
case "sync":
|
||||
handler.CommandSync(ce)
|
||||
case "list":
|
||||
|
@ -229,6 +229,9 @@ func (handler *CommandHandler) CommandLogout(ce *CommandEvent) {
|
|||
if ce.User.Session == nil {
|
||||
ce.Reply("You're not logged in.")
|
||||
return
|
||||
} else if !ce.User.IsConnected() {
|
||||
ce.Reply("You are not connected to WhatsApp. Use the `reconnect` command to reconnect, or `delete-session` to forget all login information.")
|
||||
return
|
||||
}
|
||||
puppet := handler.bridge.GetPuppetByJID(ce.User.JID)
|
||||
if puppet.CustomMXID != "" {
|
||||
|
|
Loading…
Reference in a new issue