New Telegram Chat type, instead of previous UserOrGroupChat type

bot-api-6.1
Syfaro 2015-10-09 09:26:38 -05:00
parent 7092cefe65
commit 8e71d1db32
1 changed files with 28 additions and 27 deletions

View File

@ -50,40 +50,41 @@ type GroupChat struct {
Title string `json:"title"` Title string `json:"title"`
} }
// UserOrGroupChat is returned in Message, because it's not clear which it is. // Chat is returned in Message, it contains information about the Chat a message was sent in.
type UserOrGroupChat struct { type Chat struct {
ID int `json:"id"` ID int `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
UserName string `json:"username"`
FirstName string `json:"first_name"` FirstName string `json:"first_name"`
LastName string `json:"last_name"` LastName string `json:"last_name"`
UserName string `json:"username"`
Title string `json:"title"`
} }
// Message is returned by almost every request, and contains data about almost anything. // Message is returned by almost every request, and contains data about almost anything.
type Message struct { type Message struct {
MessageID int `json:"message_id"` MessageID int `json:"message_id"`
From User `json:"from"` From User `json:"from"`
Date int `json:"date"` Date int `json:"date"`
Chat UserOrGroupChat `json:"chat"` Chat Chat `json:"chat"`
ForwardFrom User `json:"forward_from"` ForwardFrom User `json:"forward_from"`
ForwardDate int `json:"forward_date"` ForwardDate int `json:"forward_date"`
ReplyToMessage *Message `json:"reply_to_message"` ReplyToMessage *Message `json:"reply_to_message"`
Text string `json:"text"` Text string `json:"text"`
Audio Audio `json:"audio"` Audio Audio `json:"audio"`
Document Document `json:"document"` Document Document `json:"document"`
Photo []PhotoSize `json:"photo"` Photo []PhotoSize `json:"photo"`
Sticker Sticker `json:"sticker"` Sticker Sticker `json:"sticker"`
Video Video `json:"video"` Video Video `json:"video"`
Voice Voice `json:"voice"` Voice Voice `json:"voice"`
Caption string `json:"caption"` Caption string `json:"caption"`
Contact Contact `json:"contact"` Contact Contact `json:"contact"`
Location Location `json:"location"` Location Location `json:"location"`
NewChatParticipant User `json:"new_chat_participant"` NewChatParticipant User `json:"new_chat_participant"`
LeftChatParticipant User `json:"left_chat_participant"` LeftChatParticipant User `json:"left_chat_participant"`
NewChatTitle string `json:"new_chat_title"` NewChatTitle string `json:"new_chat_title"`
NewChatPhoto []PhotoSize `json:"new_chat_photo"` NewChatPhoto []PhotoSize `json:"new_chat_photo"`
DeleteChatPhoto bool `json:"delete_chat_photo"` DeleteChatPhoto bool `json:"delete_chat_photo"`
GroupChatCreated bool `json:"group_chat_created"` GroupChatCreated bool `json:"group_chat_created"`
} }
// Time converts the message timestamp into a Time. // Time converts the message timestamp into a Time.