Skip to content

Commit e1a0a81

Browse files
author
Syfaro
committed
Added a few helper methods for the type of Chat on the Chat type
1 parent 8e71d1d commit e1a0a81

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ type Chat struct {
6060
LastName string `json:"last_name"`
6161
}
6262

63+
// IsPrivate returns true if the Chat is a private conversation
64+
func (c *Chat) IsPrivate() bool {
65+
return c.Type == "private"
66+
}
67+
68+
// IsGroup returns true if the Chat is a group conversation
69+
func (c *Chat) IsGroup() bool {
70+
return c.Type == "group"
71+
}
72+
73+
// IsChannel returns true if the Chat is a channel
74+
func (c *Chat) IsChannel() bool {
75+
return c.Type == "channel"
76+
}
77+
6378
// Message is returned by almost every request, and contains data about almost anything.
6479
type Message struct {
6580
MessageID int `json:"message_id"`

0 commit comments

Comments
 (0)