浏览代码

implement !help

Krombel 6 年之前
父节点
当前提交
798a3dfd2c
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      commands.go

+ 9 - 1
commands.go

@@ -73,6 +73,8 @@ func (handler *CommandHandler) Handle(roomID types.MatrixRoomID, user *User, mes
 	}
 	}
 }
 }
 
 
+const cmdLoginHelp = `!login - Authenticate this Bridge as WhatsApp Web Client`
+
 func (handler *CommandHandler) CommandLogin(ce *CommandEvent) {
 func (handler *CommandHandler) CommandLogin(ce *CommandEvent) {
 	if ce.User.Session != nil {
 	if ce.User.Session != nil {
 		ce.Reply("You're already logged in.")
 		ce.Reply("You're already logged in.")
@@ -83,6 +85,8 @@ func (handler *CommandHandler) CommandLogin(ce *CommandEvent) {
 	ce.User.Login(ce.RoomID)
 	ce.User.Login(ce.RoomID)
 }
 }
 
 
+const cmdLogoutHelp = `!logout - Logout from WhatsApp`
+
 func (handler *CommandHandler) CommandLogout(ce *CommandEvent) {
 func (handler *CommandHandler) CommandLogout(ce *CommandEvent) {
 	if ce.User.Session == nil {
 	if ce.User.Session == nil {
 		ce.Reply("You're not logged in.")
 		ce.Reply("You're not logged in.")
@@ -100,6 +104,10 @@ func (handler *CommandHandler) CommandLogout(ce *CommandEvent) {
 	ce.Reply("Logged out successfully.")
 	ce.Reply("Logged out successfully.")
 }
 }
 
 
+// CommandHelp handles !help command
 func (handler *CommandHandler) CommandHelp(ce *CommandEvent) {
 func (handler *CommandHandler) CommandHelp(ce *CommandEvent) {
-	ce.Reply("Help is not yet implemented 3:")
+	ce.Reply(strings.Join([]string{
+		cmdLoginHelp,
+		cmdLogoutHelp,
+	}, "\n"))
 }
 }