mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-09 15:40:27 +00:00
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>
This commit is contained in:
parent
3e20a3d180
commit
5feafcddba
@ -97,7 +97,7 @@ func (b *Btelegram) handleForwarded(rmsg *config.Message, message *tgbotapi.Mess
|
|||||||
// handleQuoting handles quoting of previous messages
|
// handleQuoting handles quoting of previous messages
|
||||||
func (b *Btelegram) handleQuoting(rmsg *config.Message, message *tgbotapi.Message) {
|
func (b *Btelegram) handleQuoting(rmsg *config.Message, message *tgbotapi.Message) {
|
||||||
// Used to check if the message was a reply to the root topic
|
// 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 := ""
|
usernameReply := ""
|
||||||
if message.ReplyToMessage.From != nil {
|
if message.ReplyToMessage.From != nil {
|
||||||
if b.GetBool("UseFirstName") {
|
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
|
// set the ID's from the channel or group message
|
||||||
rmsg.ID = strconv.Itoa(message.MessageID)
|
rmsg.ID = strconv.Itoa(message.MessageID)
|
||||||
rmsg.Channel = strconv.FormatInt(message.Chat.ID, 10)
|
rmsg.Channel = strconv.FormatInt(message.Chat.ID, 10)
|
||||||
if message.MessageThreadID != 0 {
|
if message.IsTopicMessage {
|
||||||
rmsg.Channel += "/" + strconv.Itoa(message.MessageThreadID)
|
rmsg.Channel += "/" + strconv.Itoa(message.MessageThreadID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// preserve threading from telegram reply
|
// preserve threading from telegram reply
|
||||||
if message.ReplyToMessage != nil &&
|
if message.ReplyToMessage != nil &&
|
||||||
// Used to check if the message was a reply to the root topic
|
// 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)
|
rmsg.ParentID = strconv.Itoa(message.ReplyToMessage.MessageID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user