2017-10-17 11:08:09 +00:00
|
|
|
package telegram
|
|
|
|
|
2018-04-12 12:56:53 +00:00
|
|
|
import "fmt"
|
|
|
|
|
2017-10-17 11:08:09 +00:00
|
|
|
func (chat *Chat) IsPrivate() bool {
|
2018-01-25 12:09:15 +00:00
|
|
|
if chat == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2017-10-17 11:08:09 +00:00
|
|
|
return chat.Type == ChatPrivate
|
|
|
|
}
|
|
|
|
|
|
|
|
func (chat *Chat) IsGroup() bool {
|
2018-01-25 12:09:15 +00:00
|
|
|
if chat == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2017-10-17 11:08:09 +00:00
|
|
|
return chat.Type == ChatGroup
|
|
|
|
}
|
|
|
|
|
|
|
|
func (chat *Chat) IsSuperGroup() bool {
|
2018-01-25 12:09:15 +00:00
|
|
|
if chat == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2017-10-17 11:08:09 +00:00
|
|
|
return chat.Type == ChatSuperGroup
|
|
|
|
}
|
|
|
|
|
|
|
|
func (chat *Chat) IsChannel() bool {
|
2018-01-25 12:09:15 +00:00
|
|
|
if chat == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2017-10-17 11:08:09 +00:00
|
|
|
return chat.Type == ChatChannel
|
|
|
|
}
|
2018-01-25 12:09:15 +00:00
|
|
|
|
|
|
|
func (chat *Chat) HasPinnedMessage() bool {
|
2018-01-29 07:59:07 +00:00
|
|
|
if chat == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-01-25 12:09:15 +00:00
|
|
|
return chat.PinnedMessage != nil
|
|
|
|
}
|
2018-04-12 12:56:53 +00:00
|
|
|
|
|
|
|
func (chat *Chat) HasStickerSet() bool {
|
|
|
|
if chat == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
return chat.StickerSetName != ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (chat *Chat) StickerSet(bot *Bot) *StickerSet {
|
|
|
|
if !chat.HasStickerSet() {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if bot == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
set, err := bot.GetStickerSet(chat.StickerSetName)
|
|
|
|
if err != nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return set
|
|
|
|
}
|
|
|
|
|
|
|
|
func (chat *Chat) FullName() string {
|
|
|
|
if chat == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
if chat.LastName != "" {
|
|
|
|
return fmt.Sprintln(chat.FirstName, chat.LastName)
|
|
|
|
}
|
|
|
|
|
|
|
|
return chat.FirstName
|
|
|
|
}
|