1
0
telegram/utils_sticker.go
Maxim Lebedev 3265acc0fc
♻️ Methods refactor
2018-08-21 16:05:04 +05:00

33 lines
682 B
Go

package telegram
// InSet checks that the current sticker in the stickers set.
//
// For uploaded WebP files this return false.
func (s *Sticker) InSet() bool {
return s != nil && s.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 (s *Sticker) Set(bot *Bot) *StickerSet {
if !s.InSet() || bot == nil {
return nil
}
set, err := bot.GetStickerSet(s.SetName)
if err != nil {
return nil
}
return set
}
func (s *Sticker) HasThumb() bool {
return s != nil && s.Thumb != nil
}
func (s *Sticker) IsMask() bool {
return s != nil && s.MaskPosition != nil
}