瀏覽代碼

Don't connect in reconnect command if the user is not logged in

Tulir Asokan 6 年之前
父節點
當前提交
239de25bf0
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      commands.go

+ 6 - 2
commands.go

@@ -177,8 +177,12 @@ const cmdReconnectHelp = `reconnect - Reconnect to WhatsApp`
 
 func (handler *CommandHandler) CommandReconnect(ce *CommandEvent) {
 	if ce.User.Conn == nil {
-		ce.Reply("No existing connection, creating one...")
-		ce.User.Connect(false)
+		if ce.User.Session == nil {
+			ce.Reply("No existing connection and no session. Did you mean `login`?")
+		} else {
+			ce.Reply("No existing connection, creating one...")
+			ce.User.Connect(false)
+		}
 		return
 	}
 	err := ce.User.Conn.Restore()