mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-13 09:03:10 +01:00
Make sure there are enough args before getting args
This commit is contained in:
parent
88483fc61f
commit
c6d33d8bba
1 changed files with 6 additions and 1 deletions
|
@ -134,13 +134,18 @@ func (handler *CommandHandler) CommandHelp(ce *CommandEvent) {
|
||||||
}, "\n"))
|
}, "\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmdImportHelp = `import JID|contacts - Open up a room for JID or for each WhatsApp contact`
|
const cmdImportHelp = `import <jid>|contacts - Open up a room for JID or for each WhatsApp contact`
|
||||||
|
|
||||||
// CommandImport handles import command
|
// CommandImport handles import command
|
||||||
func (handler *CommandHandler) CommandImport(ce *CommandEvent) {
|
func (handler *CommandHandler) CommandImport(ce *CommandEvent) {
|
||||||
// ensure all messages go to the management room
|
// ensure all messages go to the management room
|
||||||
ce.RoomID = ce.User.ManagementRoom
|
ce.RoomID = ce.User.ManagementRoom
|
||||||
|
|
||||||
|
if len(ce.Args) == 0 {
|
||||||
|
ce.Reply("Usage: import <jid>|contacts")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
user := ce.User
|
user := ce.User
|
||||||
|
|
||||||
if ce.Args[0] == "contacts" {
|
if ce.Args[0] == "contacts" {
|
||||||
|
|
Loading…
Reference in a new issue