✨ Added Stickers utils
This commit is contained in:
parent
86a3f2148e
commit
2f199bb9a4
|
@ -0,0 +1,24 @@
|
|||
package telegram
|
||||
|
||||
// InSet checks that the current sticker in the stickers set.
|
||||
//
|
||||
// For uploaded WebP files this return false.
|
||||
func (sticker *Sticker) InSet() bool {
|
||||
return sticker != nil && sticker.SetName != ""
|
||||
}
|
||||
|
||||
// Set use bot for getting parent StickerSet if SetName is present.
|
||||
//
|
||||
// Return nil if current sticker has been uploaded by user as WebP file.
|
||||
func (sticker *Sticker) Set(bot *Bot) *StickerSet {
|
||||
if !sticker.InSet() || bot == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
set, err := bot.GetStickerSet(sticker.SetName)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return set
|
||||
}
|
Loading…
Reference in New Issue