I have a telegram bot that sends a message to a channel. I want to implement the button attached to this post (inline keyboard button
), but I also want to see the comment
button. When you add an inline keyboard
, it disappears.
Comments
button:
Inline Keyboard Button
(the text doesn’t matter):
Code Example without keyboard (Golang):
message := tgbotapi.NewPhotoUpload(channel.ID, tgbotapi.FileBytes{
Name: "image-name",
Bytes: image,
})
message.Caption = "This is the caption"
message.ParseMode = "HTML"
response, err := bot.Send(message)
if err != nil {
fmt.Println(err)
}
Code Example with keyboard (Golang):
var keyboard = tgbotapi.NewInlineKeyboardMarkup(
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("Test", "test"),
),
)
message := tgbotapi.NewPhotoUpload(channel.ID, tgbotapi.FileBytes{
Name: "image-name",
Bytes: image,
})
message.Caption = "This is the caption"
message.ParseMode = "HTML"
message.ReplyMarkup = keyboard
response, err := bot.Send(message)
if err != nil {
fmt.Println(err)
}
Is there any way to use these feautures together?
3
Answers
You must create an inline URL button with a link, e.g.,
where
groupId
is the id of your group for comments, andgroupMessageId
is the id of message of your post in group for comments.I found a simpler link for this.
where
channelName
– is username of your channel,originalMessageId
is the id of the original message (not message id in the group for comments)update It seems this is not working with messages with the inline keyboard (only with native comment button).
You must create an inline URL button with a link, e.g.,
https://t.me/<channelName>/<originalMessageId>?thread=<originalMessageId>
where channelName – is username of your channel, originalMessageId is the id of the original message (not message id in the group for comments)