PaulSonOfLars / gotgbot

Autogenerated Go wrapper for the telegram API. Inspired by the python-telegram-bot library.
MIT License
511 stars 119 forks source link

SendMessage with ThreadID and ReplyMessageID works wrong #196

Closed itbeard closed 2 months ago

itbeard commented 2 months ago

Hello! I'm trying to send a reply to the message to a different from the original thread (topic), but it looks like MessageThreadId is overridden by the replied message MessageThreadId. Is it expected behavior?

func (s *TelegramMessageSender) SendReplyToThread(
    chatId int64,
    threadId int64,
    replyMessageId int64,
    text string,
    entities []gotgbot.MessageEntity,
) (*gotgbot.Message, error) {
    var replyMessageParameters = &gotgbot.ReplyParameters{
        MessageId: replyMessageId,
    }

    return s.bot.SendMessage(chatId, text, &gotgbot.SendMessageOpts{
        Entities:        entities,
        MessageThreadId: threadId,
        ReplyParameters: replyMessageParameters,
    })
}

version v2.0.0-rc.29

PaulSonOfLars commented 2 months ago

Hey, thank you for raising :)

I'm afraid this is a telegram implementation detail, and not something handled by the library. Telegram threads are really just a chain of replies, so the reply takes priority.

You (might?) be able to override this if you specify the chatid in your Reply parameters, because that might make it an "external reply", but I'm not sure - you'll have to try that yourself I'm afraid!

itbeard commented 2 months ago

Hey, thank you for raising :)

I'm afraid this is a telegram implementation detail, and not something handled by the library. Telegram threads are really just a chain of replies, so the reply takes priority.

You (might?) be able to override this if you specify the chatid in your Reply parameters, because that might make it an "external reply", but I'm not sure - you'll have to try that yourself I'm afraid!

looks like there are no ways :) In any case thx for the quick response!