From a2e5a7833e807d5b2f1411c2a95f4f08b0e68011 Mon Sep 17 00:00:00 2001 From: Umputun Date: Mon, 21 Oct 2024 09:59:02 -0500 Subject: [PATCH] try to get proper forward id for MsgHandler, just for logging --- Dockerfile | 2 +- app/events/admin.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 71b5e89..08df71f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/app/events/admin.go b/app/events/admin.go index 323bcb6..89fd612 100644 --- a/app/events/admin.go +++ b/app/events/admin.go @@ -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