Skip to content

Commit

Permalink
Adding basic LogDebug into the updateHandler (#290)
Browse files Browse the repository at this point in the history
* Added logging to updatehandler loop

* warns if message data is broken, and warns user if a event does not exist yet
  • Loading branch information
kennedy committed Mar 30, 2020
1 parent d47bc1e commit 5730afe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/handlers/telegram/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ func updateHandler(tg *Client, updates tgbotapi.UpdatesChannel) {
for u := range updates {
switch {
case u.Message == nil:
tg.logger.LogError("Missing message data")
continue
case u.Message.Text != "":
tg.logger.LogDebug("messageHandler triggered")
messageHandler(tg, u)
case u.Message.Sticker != nil:
tg.logger.LogDebug("stickerHandler triggered")
stickerHandler(tg, u)
case u.Message.Document != nil:
tg.logger.LogDebug("documentHandler triggered")
documentHandler(tg, u.Message)
default:
tg.logger.LogWarning("triggered, but message type is currently unsupported")
continue
}
}
Expand Down

0 comments on commit 5730afe

Please sign in to comment.