Skip to content

Commit 8e71d1d

Browse files
author
Syfaro
committed
New Telegram Chat type, instead of previous UserOrGroupChat type
1 parent 7092cef commit 8e71d1d

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

types.go

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,40 +50,41 @@ type GroupChat struct {
5050
Title string `json:"title"`
5151
}
5252

53-
// UserOrGroupChat is returned in Message, because it's not clear which it is.
54-
type UserOrGroupChat struct {
53+
// Chat is returned in Message, it contains information about the Chat a message was sent in.
54+
type Chat struct {
5555
ID int `json:"id"`
56+
Type string `json:"type"`
57+
Title string `json:"title"`
58+
UserName string `json:"username"`
5659
FirstName string `json:"first_name"`
5760
LastName string `json:"last_name"`
58-
UserName string `json:"username"`
59-
Title string `json:"title"`
6061
}
6162

6263
// Message is returned by almost every request, and contains data about almost anything.
6364
type Message struct {
64-
MessageID int `json:"message_id"`
65-
From User `json:"from"`
66-
Date int `json:"date"`
67-
Chat UserOrGroupChat `json:"chat"`
68-
ForwardFrom User `json:"forward_from"`
69-
ForwardDate int `json:"forward_date"`
70-
ReplyToMessage *Message `json:"reply_to_message"`
71-
Text string `json:"text"`
72-
Audio Audio `json:"audio"`
73-
Document Document `json:"document"`
74-
Photo []PhotoSize `json:"photo"`
75-
Sticker Sticker `json:"sticker"`
76-
Video Video `json:"video"`
77-
Voice Voice `json:"voice"`
78-
Caption string `json:"caption"`
79-
Contact Contact `json:"contact"`
80-
Location Location `json:"location"`
81-
NewChatParticipant User `json:"new_chat_participant"`
82-
LeftChatParticipant User `json:"left_chat_participant"`
83-
NewChatTitle string `json:"new_chat_title"`
84-
NewChatPhoto []PhotoSize `json:"new_chat_photo"`
85-
DeleteChatPhoto bool `json:"delete_chat_photo"`
86-
GroupChatCreated bool `json:"group_chat_created"`
65+
MessageID int `json:"message_id"`
66+
From User `json:"from"`
67+
Date int `json:"date"`
68+
Chat Chat `json:"chat"`
69+
ForwardFrom User `json:"forward_from"`
70+
ForwardDate int `json:"forward_date"`
71+
ReplyToMessage *Message `json:"reply_to_message"`
72+
Text string `json:"text"`
73+
Audio Audio `json:"audio"`
74+
Document Document `json:"document"`
75+
Photo []PhotoSize `json:"photo"`
76+
Sticker Sticker `json:"sticker"`
77+
Video Video `json:"video"`
78+
Voice Voice `json:"voice"`
79+
Caption string `json:"caption"`
80+
Contact Contact `json:"contact"`
81+
Location Location `json:"location"`
82+
NewChatParticipant User `json:"new_chat_participant"`
83+
LeftChatParticipant User `json:"left_chat_participant"`
84+
NewChatTitle string `json:"new_chat_title"`
85+
NewChatPhoto []PhotoSize `json:"new_chat_photo"`
86+
DeleteChatPhoto bool `json:"delete_chat_photo"`
87+
GroupChatCreated bool `json:"group_chat_created"`
8788
}
8889

8990
// Time converts the message timestamp into a Time.

0 commit comments

Comments
 (0)