Skip to content

Commit

Permalink
Merge pull request o3ma#4 from V-inz/master
Browse files Browse the repository at this point in the history
auto-answer TextMessage, avoid recursive qoutes
  • Loading branch information
willnix authored Jan 4, 2017
2 parents c06cd4e + 71a0a24 commit ab0859f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ func main() {
// play the audio if you like
case o3.TextMessage:
// respond with a quote of what was send to us.

// but only if it's no a message we sent to ourselves, avoid recursive neverending qoutes
if (tid.String() == msg.Sender().String()) {
continue
}

// to make the quote render nicely in the app we use "markdown"
// of the form "> PERSONWEQUOTE: Text of qoute\nSomething we wanna add."
qoute := fmt.Sprintf("> %s: %s\n%s", msg.Sender(), msg.Text(), "Exactly!")
Expand Down

0 comments on commit ab0859f

Please sign in to comment.