summaryrefslogtreecommitdiffstats
path: root/bridge/telegram/handlers.go
diff options
context:
space:
mode:
authorThom Dickson <td3of4@gmail.com>2023-04-03 17:20:53 -0400
committerGitHub <noreply@github.com>2023-04-03 23:20:53 +0200
commit5feafcddbaee14965557584058389ca486f306b5 (patch)
tree0bb4117a813edc3456307725ac5812f5aff12caf /bridge/telegram/handlers.go
parent3e20a3d180afc4a33aa899b76ed01a782f2150a0 (diff)
downloadmatterbridge-msglm-5feafcddbaee14965557584058389ca486f306b5.tar.gz
matterbridge-msglm-5feafcddbaee14965557584058389ca486f306b5.tar.bz2
matterbridge-msglm-5feafcddbaee14965557584058389ca486f306b5.zip
Fix broken reply (telegram) (#2026)
Fixes #2021 * Fix broken reply * Fix reply/quoting logic with topics * Update handlers.go --------- Co-authored-by: Wim <wim@42.be>
Diffstat (limited to 'bridge/telegram/handlers.go')
-rw-r--r--bridge/telegram/handlers.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go
index 985397ef..9f8d1c38 100644
--- a/bridge/telegram/handlers.go
+++ b/bridge/telegram/handlers.go
@@ -97,7 +97,7 @@ func (b *Btelegram) handleForwarded(rmsg *config.Message, message *tgbotapi.Mess
// handleQuoting handles quoting of previous messages
func (b *Btelegram) handleQuoting(rmsg *config.Message, message *tgbotapi.Message) {
// Used to check if the message was a reply to the root topic
- if message.ReplyToMessage != nil && !(message.ReplyToMessage.MessageID == message.MessageThreadID) { //nolint:nestif
+ if message.ReplyToMessage != nil && (!message.IsTopicMessage || message.ReplyToMessage.MessageID != message.MessageThreadID) { //nolint:nestif
usernameReply := ""
if message.ReplyToMessage.From != nil {
if b.GetBool("UseFirstName") {
@@ -217,14 +217,14 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
// set the ID's from the channel or group message
rmsg.ID = strconv.Itoa(message.MessageID)
rmsg.Channel = strconv.FormatInt(message.Chat.ID, 10)
- if message.MessageThreadID != 0 {
+ if message.IsTopicMessage {
rmsg.Channel += "/" + strconv.Itoa(message.MessageThreadID)
}
// preserve threading from telegram reply
if message.ReplyToMessage != nil &&
// Used to check if the message was a reply to the root topic
- !(message.ReplyToMessage.MessageID == message.MessageThreadID) {
+ (!message.IsTopicMessage || message.ReplyToMessage.MessageID != message.MessageThreadID) {
rmsg.ParentID = strconv.Itoa(message.ReplyToMessage.MessageID)
}