28 lines
506 B
Go

package helpers
import (
"bytes"
"context"
"errors"
"github.com/go-telegram/bot"
"github.com/go-telegram/bot/models"
)
func SendPhotos(ctx context.Context, b *bot.Bot, update *models.Update, data []byte, title string)error{
if data == nil {
return errors.New("data cant be nil")
}
params := &bot.SendPhotoParams{
ChatID: update.Message.Chat.ID,
Photo: &models.InputFileUpload{
Data: bytes.NewReader(data),
},
Caption: title,
}
_, err := b.SendPhoto(ctx, params)
return err
}