Skip to content

Commit

Permalink
don't reply if command is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
rusenask committed Apr 27, 2019
1 parent 9d22654 commit 1c51c70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ func (bm *BotManager) handleCommand(eventText string) string {
func (bm *BotManager) handleBotMessage(m *BotMessage) string {
command := m.Message

if command == "" {
return ""
}

if responseLines, ok := BotEventTextToResponse[command]; ok {
return strings.Join(responseLines, "\n")
}
Expand All @@ -216,7 +220,7 @@ func (bm *BotManager) handleBotMessage(m *BotMessage) string {
"user": m.User,
"bot": m.Name,
"command": command,
}).Debug("handleMessage: bot couldn't recognise command")
}).Debug("handleMessage: bot couldn't recognize command")

return fmt.Sprintf("unknown command '%s'", command)
}
Expand Down

0 comments on commit 1c51c70

Please sign in to comment.