update Message struct for new fields, add IsSuperGroup to Chat struct
parent
a835dc9a96
commit
c3304ed8a7
11
types.go
11
types.go
|
@ -71,6 +71,11 @@ func (c *Chat) IsGroup() bool {
|
|||
return c.Type == "group"
|
||||
}
|
||||
|
||||
// IsSuperGroup returns true if the Chat is a supergroup conversation
|
||||
func (c *Chat) IsSuperGroup() bool {
|
||||
return c.Type == "supergroup"
|
||||
}
|
||||
|
||||
// IsChannel returns true if the Chat is a channel
|
||||
func (c *Chat) IsChannel() bool {
|
||||
return c.Type == "channel"
|
||||
|
@ -101,6 +106,10 @@ type Message struct {
|
|||
NewChatPhoto []PhotoSize `json:"new_chat_photo"`
|
||||
DeleteChatPhoto bool `json:"delete_chat_photo"`
|
||||
GroupChatCreated bool `json:"group_chat_created"`
|
||||
SuperGroupChatCreated bool `json:"supergroup_chat_created"`
|
||||
ChannelChatCreated bool `json:"channel_chat_created"`
|
||||
MigrateToChatID int `json:"migrate_to_chat_id"`
|
||||
MigrateFromChatID int `json:"migrate_from_chat_id"`
|
||||
}
|
||||
|
||||
// Time converts the message timestamp into a Time.
|
||||
|
@ -110,7 +119,7 @@ func (m *Message) Time() time.Time {
|
|||
|
||||
// IsGroup returns if the message was sent to a group.
|
||||
func (m *Message) IsGroup() bool {
|
||||
return m.From.ID != m.Chat.ID
|
||||
return m.Chat.IsGroup()
|
||||
}
|
||||
|
||||
// IsCommand returns true if message starts from /
|
||||
|
|
Loading…
Reference in New Issue