implement !help
This commit is contained in:
10
commands.go
10
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"))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user