-
Notifications
You must be signed in to change notification settings - Fork 524
Open
Description
Hello. I'm tyring to add InlineKeyboard to an album.
The code is the following
type Alert struct {
Body string
Receiver string
Images []Image
Buttons [][]Button
}
var markup *tb.ReplyMarkup
markup = &tb.ReplyMarkup{}
var inlineKeyboard [][]tb.InlineButton
for _, rowButtons := range alert.Buttons {
var row []tb.InlineButton
for _, btnData := range rowButtons {
btn := tb.InlineButton{
Text: btnData.Text,
}
if btnData.URL != "" {
btn.URL = btnData.URL
} else if btnData.Data != "" {
btn.Unique = btnData.Data
btn.Data = btnData.Data
}
row = append(row, btn)
}
inlineKeyboard = append(inlineKeyboard, row)
}
markup.InlineKeyboard = inlineKeyboard
sendOpts := &tb.SendOptions{
ParseMode: tb.ModeHTML,
ReplyMarkup: markup,
}
album := tb.Album{}
for _, image := range alert.Images {
photo := &tb.Photo{
File: tb.FromReader(bytes.NewReader(image.Body)),
}
album = append(album, photo)
}
album.SetCaption(alert.Body)
_, err := telegramBot.SendAlbum(&receiver, album, sendOpts)
if err != nil {
log.Errorf("Error sending alert with images: %v", err)
}after this code the inline keyboard does not appear.
Thanks for the hints.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels