talk: Don't reply on comments

This commit is contained in:
Hamcha 2017-05-09 15:59:42 +02:00
parent a69670a526
commit 8d5c554d8d
1 changed files with 6 additions and 1 deletions

View File

@ -71,6 +71,7 @@ func talk(broker *tg.Broker, update tg.APIMessage) {
return
}
text := *(update.Text)
quoted := false
// Make sure it's aimed at Clessy
if strings.Index(text, "@"+*botname) >= 0 {
@ -81,6 +82,7 @@ func talk(broker *tg.Broker, update tg.APIMessage) {
text = strings.TrimLeft(text[len("clessy"):], ":,")
} else if text[0] != '/' && update.ReplyTo != nil && update.ReplyTo.User.Username == *botname {
// Reply to Clessy (previous prompt?) which is not a command (such as unsplash), pass
quoted = true
} else if update.Chat.Username != nil {
// Private chat, pass
} else {
@ -191,7 +193,10 @@ func talk(broker *tg.Broker, update tg.APIMessage) {
reply += "\nAlternativamente:\n - " + strings.Join(result.Alternatives, "\n - ")
}
case "input.unknown":
// NOOP
// Don't reply if quoted (probably just a comment)
if quoted {
return
}
default:
log.Printf("[talk] Unknown action called:\n%s\n", record.Result.Action)
}