Skip to content

Commit

Permalink
try to get proper forward id for MsgHandler, just for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Oct 21, 2024
1 parent a02c7c0 commit a2e5a78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/umputun/baseimage/buildgo:latest as build
FROM ghcr.io/umputun/baseimage/buildgo:latest AS build

ARG GIT_BRANCH
ARG GITHUB_SHA
Expand Down
9 changes: 8 additions & 1 deletion app/events/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,16 @@ func (a *admin) MsgHandler(update tbapi.Update) error {
}
return string([]rune(inp)[:max]) + "..."
}

// try to get the forwarded user ID, this is just for logging
var fwdID int64
if update.Message.ForwardFrom != nil {
fwdID = update.Message.ForwardFrom.ID
}

log.Printf("[DEBUG] message from admin chat: msg id: %d, update id: %d, from: %s, sender: %q (%d)",
update.Message.MessageID, update.UpdateID, update.Message.From.UserName,
update.Message.ForwardSenderName, update.Message.ForwardFromMessageID)
update.Message.ForwardSenderName, fwdID)

if update.Message.ForwardSenderName == "" && update.Message.ForwardFrom == nil {
// this is a regular message from admin chat, not the forwarded one, ignore it
Expand Down

0 comments on commit a2e5a78

Please sign in to comment.