all repos — telegram-bot-api @ 16acfd07b0b7a68a66e73cac65c9c48695243c6a

Golang bindings for the Telegram Bot API

types.go (view raw)

  1package tgbotapi
  2
  3import (
  4	"encoding/json"
  5)
  6
  7type ApiResponse struct {
  8	Ok          bool            `json:"ok"`
  9	Result      json.RawMessage `json:"result"`
 10	ErrorCode   int             `json:"error_code"`
 11	Description string          `json:"description"`
 12}
 13
 14type Update struct {
 15	UpdateId int     `json:"update_id"`
 16	Message  Message `json:"message"`
 17}
 18
 19type User struct {
 20	Id        int    `json:"id"`
 21	FirstName string `json:"first_name"`
 22	LastName  string `json:"last_name"`
 23	UserName  string `json:"username"`
 24}
 25
 26type GroupChat struct {
 27	Id    int    `json:"id"`
 28	Title string `json:"title"`
 29}
 30
 31type UserOrGroupChat struct {
 32	Id        int    `json:"id"`
 33	FirstName string `json:"first_name"`
 34	LastName  string `json:"last_name"`
 35	UserName  string `json:"username"`
 36	Title     string `json:"title"`
 37}
 38
 39type Message struct {
 40	MessageId           int             `json:"message_id"`
 41	From                User            `json:"from"`
 42	Date                int             `json:"date"`
 43	Chat                UserOrGroupChat `json:"chat"`
 44	ForwardFrom         User            `json:"forward_from"`
 45	ForwardDate         int             `json:"forward_date"`
 46	ReplyToMessage      *Message        `json:"reply_to_message"`
 47	Text                string          `json:"text"`
 48	Audio               Audio           `json:"audio"`
 49	Document            Document        `json:"document"`
 50	Photo               []PhotoSize     `json:"photo"`
 51	Sticker             Sticker         `json:"sticker"`
 52	Video               Video           `json:"video"`
 53	Contact             Contact         `json:"contact"`
 54	Location            Location        `json:"location"`
 55	NewChatParticipant  User            `json:"new_chat_participant"`
 56	LeftChatParticipant User            `json:"left_chat_participant"`
 57	NewChatTitle        string          `json:"new_chat_title"`
 58	NewChatPhoto        string          `json:"new_chat_photo"`
 59	DeleteChatPhoto     bool            `json:"delete_chat_photo"`
 60	GroupChatCreated    bool            `json:"group_chat_created"`
 61}
 62
 63type PhotoSize struct {
 64	FileId   string `json:"file_id"`
 65	Width    int    `json:"width"`
 66	Height   int    `json:"height"`
 67	FileSize int    `json:"file_size"`
 68}
 69
 70type Audio struct {
 71	FileId   string `json:"file_id"`
 72	Duration int    `json:"duration"`
 73	MimeType string `json:"mime_type"`
 74	FileSize int    `json:"file_size"`
 75}
 76
 77type Document struct {
 78	FileId   string    `json:"file_id"`
 79	Thumb    PhotoSize `json:"thumb"`
 80	FileName string    `json:"file_name"`
 81	MimeType string    `json:"mime_type"`
 82	FileSize int       `json:"file_size"`
 83}
 84
 85type Sticker struct {
 86	FileId   string    `json:"file_id"`
 87	Width    int       `json:"width"`
 88	Height   int       `json:"height"`
 89	Thumb    PhotoSize `json:"thumb"`
 90	FileSize int       `json:"file_size"`
 91}
 92
 93type Video struct {
 94	FileId   string    `json:"file_id"`
 95	Width    int       `json:"width"`
 96	Height   int       `json:"height"`
 97	Duration int       `json:"duration"`
 98	Thumb    PhotoSize `json:"thumb"`
 99	MimeType string    `json:"mime_type"`
100	FileSize int       `json:"file_size"`
101	Caption  string    `json:"caption"`
102}
103
104type Contact struct {
105	PhoneNumber string `json:"phone_number"`
106	FirstName   string `json:"first_name"`
107	LastName    string `json:"last_name"`
108	UserId      string `json:"user_id"`
109}
110
111type Location struct {
112	Longitude float32 `json:"longitude"`
113	Latitude  float32 `json:"latitude"`
114}
115
116type UserProfilePhotos struct {
117	TotalCount int         `json:"total_count"`
118	Photos     []PhotoSize `json:"photos"`
119}
120
121type ReplyKeyboardMarkup struct {
122	Keyboard        [][]string `json:"keyboard"`
123	ResizeKeyboard  bool       `json:"resize_keyboard"`
124	OneTimeKeyboard bool       `json:"one_time_keyboard"`
125	Selective       bool       `json:"selective"`
126}
127
128type ReplyKeyboardHide struct {
129	HideKeyboard bool `json:"hide_keyboard"`
130	Selective    bool `json:"selective"`
131}
132
133type ForceReply struct {
134	ForceReply bool `json:"force_reply"`
135	Selective  bool `json:"force_reply"`
136}