fix(reply): forward message_thread_id so replies stay in the same forum topic

Telegram routes outgoing messages with no message_thread_id to a forum
supergroup's General topic. Commands sent in a topic were being answered
in General. chathelper.Reply / ReplyHTML now take *models.Message and
forward both ChatID and MessageThreadID; help.go SendMessage and
loldle trySendSticker do the same. Adds regression tests asserting the
field is forwarded for forum topics and omitted for private/regular groups.
This commit is contained in:
tiennm99 committed 2026-05-16 12:10:56 +07:00
1 parent 82825661e3
commit 16c9cce91d
11 files changed
+247 -122

No files matched your search

+3 -3
View File
@@ -54,7 +54,7 @@ func pingCommand(deps modules.Deps) modules.Command {
if err := deps.KV.PutJSON(ctx, lastPingKey, payload); err != nil {
log.Error("kv put failed", "module", "misc", "command", "ping", "key", lastPingKey, "err", err)
}
return chathelper.Reply(ctx, b, update.Message.Chat.ID, "pong")
return chathelper.Reply(ctx, b, update.Message, "pong")
},
}
}
@@ -78,7 +78,7 @@ func mstatsCommand(deps modules.Deps) modules.Command {
case err != nil && !errors.Is(err, storage.ErrNotFound):
return fmt.Errorf("misc /mstats: %w", err)
}
return chathelper.Reply(ctx, b, update.Message.Chat.ID, text)
return chathelper.Reply(ctx, b, update.Message, text)
},
}
}
@@ -92,7 +92,7 @@ func fortytwoCommand() modules.Command {
if update.Message == nil {
return nil
}
return chathelper.Reply(ctx, b, update.Message.Chat.ID, "The answer.")
return chathelper.Reply(ctx, b, update.Message, "The answer.")
},
}
}