1
0
telegram/utils_sticker.go

33 lines
682 B
Go
Raw Normal View History

2018-04-19 15:15:47 +00:00
package telegram
// InSet checks that the current sticker in the stickers set.
//
// For uploaded WebP files this return false.
2018-08-15 11:05:58 +00:00
func (s *Sticker) InSet() bool {
2018-08-21 11:05:04 +00:00
return s != nil && s.SetName != ""
2018-04-19 15:15:47 +00:00
}
// Set use bot for getting parent StickerSet if SetName is present.
//
// Return nil if current sticker has been uploaded by user as WebP file.
2018-08-15 11:05:58 +00:00
func (s *Sticker) Set(bot *Bot) *StickerSet {
if !s.InSet() || bot == nil {
2018-04-19 15:15:47 +00:00
return nil
}
2018-08-15 11:05:58 +00:00
set, err := bot.GetStickerSet(s.SetName)
2018-04-19 15:15:47 +00:00
if err != nil {
return nil
}
return set
}
2018-08-15 13:26:07 +00:00
func (s *Sticker) HasThumb() bool {
return s != nil && s.Thumb != nil
}
func (s *Sticker) IsMask() bool {
return s != nil && s.MaskPosition != nil
}