Error handling

This commit is contained in:
Caleb Denio 2021-05-17 23:07:08 -04:00
parent 73d27b6ecc
commit 52c652e4e3

View file

@ -73,12 +73,19 @@ func onMessage(slackClient *slack.Client, event *slackevents.MessageEvent) {
// Ignore numbers that aren't in order. // Ignore numbers that aren't in order.
if matchedNumber != lastValidNumber+1 { if matchedNumber != lastValidNumber+1 {
slackClient.AddReaction("bangbang", slack.ItemRef{ err = slackClient.AddReaction("bangbang", slack.ItemRef{
Channel: event.Channel, Channel: event.Channel,
Timestamp: event.TimeStamp, Timestamp: event.TimeStamp,
}) })
slackClient.PostEphemeral(event.Channel, event.User, slack.MsgOptionText( if err != nil {
log.Println(err)
}
_, err = slackClient.PostEphemeral(event.Channel, event.User, slack.MsgOptionText(
fmt.Sprintf("You counted incorrectly! The next valid number is supposed to be *%d*.", lastValidNumber+1), false)) fmt.Sprintf("You counted incorrectly! The next valid number is supposed to be *%d*.", lastValidNumber+1), false))
if err != nil {
log.Println(err)
}
return return
} }