1
0
Fork 0

🚚 Split types.go on type specified files

This commit is contained in:
Maxim Lebedev 2018-10-12 13:54:37 +05:00
parent 8449d8370d
commit ed9fda7dda
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F
6 changed files with 1359 additions and 1288 deletions

1288
types.go

File diff suppressed because it is too large Load Diff

46
types_games.go Normal file
View File

@ -0,0 +1,46 @@
package telegram
type (
// Game represents a game. Use BotFather to create and edit games, their
// short names will act as unique identifiers.
Game struct {
// Title of the game
Title string `json:"title"`
// Description of the game
Description string `json:"description"`
// Brief description of the game or high scores included in the game
// message. Can be automatically edited to include current high scores
// for the game when the bot calls setGameScore, or manually edited
// using editMessageText. 0-4096 characters.
Text string `json:"text,omitempty"`
// Photo that will be displayed in the game message in chats.
Photo []PhotoSize `json:"photo"`
// Special entities that appear in text, such as usernames, URLs, bot
// commands, etc.
TextEntities []MessageEntity `json:"text_entities,omitempty"`
// Animation that will be displayed in the game message in chats. Upload
// via BotFather
Animation *Animation `json:"animation,omitempty"`
}
// CallbackGame a placeholder, currently holds no information. Use BotFather
// to set up your game.
CallbackGame struct{}
// GameHighScore represents one row of the high scores table for a game.
GameHighScore struct {
// Position in high score table for the game
Position int `json:"position"`
// Score
Score int `json:"score"`
// User
User *User `json:"user"`
}
)

827
types_inline_mode.go Normal file
View File

@ -0,0 +1,827 @@
package telegram
type (
// InlineQuery represents an incoming inline query. When the user sends an
// empty query, your bot could return some default or trending results.
InlineQuery struct {
// Unique identifier for this query
ID string `json:"id"`
// Text of the query (up to 512 characters)
Query string `json:"query"`
// Offset of the results to be returned, can be controlled by the bot
Offset string `json:"offset"`
// Sender
From *User `json:"from"`
// Sender location, only for bots that request user location
Location *Location `json:"location,omitempty"`
}
// InlineQueryResultArticle represents a link to an article or web page.
InlineQueryResultArticle struct {
// Type of the result, must be article
Type string `json:"type"`
// Unique identifier for this result, 1-64 Bytes
ID string `json:"id"`
// Title of the result
Title string `json:"title"`
// URL of the result
URL string `json:"url,omitempty"`
// Short description of the result
Description string `json:"description,omitempty"`
// Url of the thumbnail for the result
ThumbURL string `json:"thumb_url,omitempty"`
// Content of the message to be sent
InputMessageContent interface{} `json:"input_message_content"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Pass True, if you don't want the URL to be shown in the message
HideURL bool `json:"hide_url,omitempty"`
// Thumbnail width
ThumbWidth int `json:"thumb_width,omitempty"`
// Thumbnail height
ThumbHeight int `json:"thumb_height,omitempty"`
}
// InlineQueryResultPhoto represents a link to a photo. By default, this
// photo will be sent by the user with optional caption. Alternatively, you
// can use input_message_content to send a message with the specified content
// instead of the photo.
InlineQueryResultPhoto struct {
// Type of the result, must be photo
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid URL of the photo. Photo must be in jpeg format. Photo size
// must not exceed 5MB
PhotoURL string `json:"photo_url"`
// URL of the thumbnail for the photo
ThumbURL string `json:"thumb_url"`
// Title for the result
Title string `json:"title,omitempty"`
// Short description of the result
Description string `json:"description,omitempty"`
// Caption of the photo to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Width of the photo
PhotoWidth int `json:"photo_width,omitempty"`
// Height of the photo
PhotoHeight int `json:"photo_height,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the photo
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultGif represents a link to an animated GIF file. By
// default, this animated GIF file will be sent by the user with optional
// caption. Alternatively, you can use input_message_content to send a
// message with the specified content instead of the animation.
InlineQueryResultGif struct {
// Type of the result, must be gif
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid URL for the GIF file. File size must not exceed 1MB
GifURL string `json:"gif_url"`
// URL of the static thumbnail for the result (jpeg or gif)
ThumbURL string `json:"thumb_url"`
// Title for the result
Title string `json:"title,omitempty"`
// Caption of the GIF file to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Width of the GIF
GifWidth int `json:"gif_width,omitempty"`
// Height of the GIF
GifHeight int `json:"gif_height,omitempty"`
// Duration of the GIF
GifDuration int `json:"gif_duration,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the GIF animation
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultMpeg4Gif represents a link to a video animation
// (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4
// file will be sent by the user with optional caption. Alternatively, you
// can use input_message_content to send a message with the specified content
// instead of the animation.
InlineQueryResultMpeg4Gif struct {
// Type of the result, must be mpeg4_gif
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid URL for the MP4 file. File size must not exceed 1MB
Mpeg4URL string `json:"mpeg4_url"`
// URL of the static thumbnail (jpeg or gif) for the result
ThumbURL string `json:"thumb_url"`
// Title for the result
Title string `json:"title,omitempty"`
// Caption of the MPEG-4 file to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Video width
Mpeg4Width int `json:"mpeg4_width,omitempty"`
// Video height
Mpeg4Height int `json:"mpeg4_height,omitempty"`
// Video duration
Mpeg4Duration int `json:"mpeg4_duration,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the video animation
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultVideo represents a link to a page containing an embedded
// video player or a video file. By default, this video file will be sent by
// the user with an optional caption. Alternatively, you can use
// input_message_content to send a message with the specified content
// instead of the video.
//
// If an InlineQueryResultVideo message contains an embedded video (e.g.,
// YouTube), you must replace its content using input_message_content.
InlineQueryResultVideo struct {
// Type of the result, must be video
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid URL for the embedded video player or video file
VideoURL string `json:"video_url"`
// Mime type of the content of video url, "text/html" or "video/mp4"
MimeType string `json:"mime_type"`
// URL of the thumbnail (jpeg only) for the video
ThumbURL string `json:"thumb_url"`
// Title for the result
Title string `json:"title"`
// Caption of the video to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Short description of the result
Description string `json:"description,omitempty"`
// Video width
VideoWidth int `json:"video_width,omitempty"`
// Video height
VideoHeight int `json:"video_height,omitempty"`
// Video duration in seconds
VideoDuration int `json:"video_duration,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the video. This field is
// required if InlineQueryResultVideo is used to send an HTML-page as a
// result (e.g., a YouTube video).
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultAudio represents a link to an mp3 audio file. By default,
// this audio file will be sent by the user. Alternatively, you can use
// input_message_content to send a message with the specified content
// instead of the audio.
InlineQueryResultAudio struct {
// Type of the result, must be audio
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid URL for the audio file
AudioURL string `json:"audio_url"`
// Title
Title string `json:"title"`
// Caption, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Performer
Performer string `json:"performer,omitempty"`
// Audio duration in seconds
AudioDuration int `json:"audio_duration,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the audio
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultVoice represents a link to a voice recording in an .ogg
// container encoded with OPUS. By default, this voice recording will be
// sent by the user. Alternatively, you can use input_message_content to
// send a message with the specified content instead of the the voice message.
InlineQueryResultVoice struct {
// Type of the result, must be voice
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid URL for the voice recording
VoiceURL string `json:"voice_url"`
// Recording title
Title string `json:"title"`
// Caption, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Recording duration in seconds
VoiceDuration int `json:"voice_duration,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the voice recording
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultDocument represents a link to a file. By default, this
// file will be sent by the user with an optional caption. Alternatively,
// you can use input_message_content to send a message with the specified
// content instead of the file. Currently, only .PDF and .ZIP files can be
// sent using this method.
InlineQueryResultDocument struct {
// Type of the result, must be document
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// Title for the result
Title string `json:"title"`
// Caption of the document to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// A valid URL for the file
DocumentURL string `json:"document_url"`
// Mime type of the content of the file, either "application/pdf" or
// "application/zip"
MimeType string `json:"mime_type"`
// Short description of the result
Description string `json:"description,omitempty"`
// URL of the thumbnail (jpeg only) for the file
ThumbURL string `json:"thumb_url,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the file
InputMessageContent interface{} `json:"input_message_content,omitempty"`
// Thumbnail width
ThumbWidth int `json:"thumb_width,omitempty"`
// Thumbnail height
ThumbHeight int `json:"thumb_height,omitempty"`
}
// InlineQueryResultLocation represents a location on a map. By default, the
// location will be sent by the user. Alternatively, you can use
// input_message_content to send a message with the specified content
// instead of the location.
InlineQueryResultLocation struct {
// Type of the result, must be location
Type string `json:"type"`
// Unique identifier for this result, 1-64 Bytes
ID string `json:"id"`
// Location title
Title string `json:"title"`
// Url of the thumbnail for the result
ThumbURL string `json:"thumb_url,omitempty"`
// Location latitude in degrees
Latitude float32 `json:"latitude"`
// Location longitude in degrees
Longitude float32 `json:"longitude"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the location
InputMessageContent interface{} `json:"input_message_content,omitempty"`
// Thumbnail width
ThumbWidth int `json:"thumb_width,omitempty"`
// Thumbnail height
ThumbHeight int `json:"thumb_height,omitempty"`
}
// InlineQueryResultVenue represents a venue. By default, the venue will be
// sent by the user. Alternatively, you can use input_message_content to
// send a message with the specified content instead of the venue.
InlineQueryResultVenue struct {
// Type of the result, must be venue
Type string `json:"type"`
// Unique identifier for this result, 1-64 Bytes
ID string `json:"id"`
// Title of the venue
Title string `json:"title"`
// Address of the venue
Address string `json:"address"`
// Foursquare identifier of the venue if known
FoursquareID string `json:"foursquare_id,omitempty"`
// Foursquare type of the venue, if known. (For example,
// "arts_entertainment/default", "arts_entertainment/aquarium" or
// "food/icecream".)
FoursquareType string `json:"foursquare_type,omitempty"`
// Url of the thumbnail for the result
ThumbURL string `json:"thumb_url,omitempty"`
// Latitude of the venue location in degrees
Latitude float32 `json:"latitude"`
// Longitude of the venue location in degrees
Longitude float32 `json:"longitude"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the venue
InputMessageContent interface{} `json:"input_message_content,omitempty"`
// Thumbnail width
ThumbWidth int `json:"thumb_width,omitempty"`
// Thumbnail height
ThumbHeight int `json:"thumb_height,omitempty"`
}
// InlineQueryResultContact represents a contact with a phone number. By
// default, this contact will be sent by the user. Alternatively, you can
// use input_message_content to send a message with the specified content
// instead of the contact.
InlineQueryResultContact struct {
// Type of the result, must be contact
Type string `json:"type"`
// Unique identifier for this result, 1-64 Bytes
ID string `json:"id"`
// Contact's phone number
PhoneNumber string `json:"phone_number"`
// Contact's first name
FirstName string `json:"first_name"`
// Contact's last name
LastName string `json:"last_name,omitempty"`
// Additional data about the contact in the form of a vCard, 0-2048 bytes
VCard string `json:"vcard,omitempty"`
// Url of the thumbnail for the result
ThumbURL string `json:"thumb_url,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the contact
InputMessageContent interface{} `json:"input_message_content,omitempty"`
// Thumbnail width
ThumbWidth int `json:"thumb_width,omitempty"`
// Thumbnail height
ThumbHeight int `json:"thumb_height,omitempty"`
}
// InlineQueryResultGame represents a Game.
InlineQueryResultGame struct {
// Type of the result, must be game
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// Short name of the game
GameShortName string `json:"game_short_name"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
// InlineQueryResultCachedPhoto represents a link to a photo stored on the
// Telegram servers. By default, this photo will be sent by the user with an
// optional caption. Alternatively, you can use input_message_content to
// send a message with the specified content instead of the photo.
InlineQueryResultCachedPhoto struct {
// Type of the result, must be photo
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid file identifier of the photo
PhotoFileID string `json:"photo_file_id"`
// Title for the result
Title string `json:"title,omitempty"`
// Short description of the result
Description string `json:"description,omitempty"`
// Caption of the photo to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the photo
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultCachedGif represents a link to an animated GIF file
// stored on the Telegram servers. By default, this animated GIF file will
// be sent by the user with an optional caption. Alternatively, you can use
// input_message_content to send a message with specified content instead of
// the animation.
InlineQueryResultCachedGif struct {
// Type of the result, must be gif
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid file identifier for the GIF file
GifFileID string `json:"gif_file_id"`
// Title for the result
Title string `json:"title,omitempty"`
// Caption of the GIF file to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the GIF animation
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultCachedMpeg4Gif represents a link to a video animation
// (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By
// default, this animated MPEG-4 file will be sent by the user with an
// optional caption. Alternatively, you can use input_message_content to
// send a message with the specified content instead of the animation.
InlineQueryResultCachedMpeg4Gif struct {
// Type of the result, must be mpeg4_gif
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid file identifier for the MP4 file
Mpeg4FileID string `json:"mpeg4_file_id"`
// Title for the result
Title string `json:"title,omitempty"`
// Caption of the MPEG-4 file to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the video animation
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultCachedSticker represents a link to a sticker stored on
// the Telegram servers. By default, this sticker will be sent by the user.
// Alternatively, you can use input_message_content to send a message with
// the specified content instead of the sticker.
InlineQueryResultCachedSticker struct {
// Type of the result, must be sticker
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid file identifier of the sticker
StickerFileID string `json:"sticker_file_id"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the sticker
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultCachedDocument represents a link to a file stored on the
// Telegram servers. By default, this file will be sent by the user with an
// optional caption. Alternatively, you can use input_message_content to
// send a message with the specified content instead of the file.
InlineQueryResultCachedDocument struct {
// Type of the result, must be document
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// Title for the result
Title string `json:"title"`
// A valid file identifier for the file
DocumentFileID string `json:"document_file_id"`
// Short description of the result
Description string `json:"description,omitempty"`
// Caption of the document to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the file
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultCachedVideo represents a link to a video file stored on
// the Telegram servers. By default, this video file will be sent by the
// user with an optional caption. Alternatively, you can use
// input_message_content to send a message with the specified content
// instead of the video.
InlineQueryResultCachedVideo struct {
// Type of the result, must be video
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid file identifier for the video file
VideoFileID string `json:"video_file_id"`
// Title for the result
Title string `json:"title"`
// Short description of the result
Description string `json:"description,omitempty"`
// Caption of the video to be sent, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the video
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultCachedVoice represents a link to a voice message stored
// on the Telegram servers. By default, this voice message will be sent by
// the user. Alternatively, you can use input_message_content to send a
// message with the specified content instead of the voice message.
InlineQueryResultCachedVoice struct {
// Type of the result, must be voice
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid file identifier for the voice message
VoiceFileID string `json:"voice_file_id"`
// Voice message title
Title string `json:"title"`
// Caption, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the voice message
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InlineQueryResultCachedAudio represents a link to an mp3 audio file
// stored on the Telegram servers. By default, this audio file will be sent
// by the user. Alternatively, you can use input_message_content to send a
// message with the specified content instead of the audio.
InlineQueryResultCachedAudio struct {
// Type of the result, must be audio
Type string `json:"type"`
// Unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// A valid file identifier for the audio file
AudioFileID string `json:"audio_file_id"`
// Caption, 0-200 characters
Caption string `json:"caption,omitempty"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in the media caption.
ParseMode string `json:"parse_mode,omitempty"`
// Inline keyboard attached to the message
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// Content of the message to be sent instead of the audio
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
// InputTextMessageContent represents the content of a text message to be
// sent as the result of an inline query.
InputTextMessageContent struct {
// Text of the message to be sent, 1-4096 characters
MessageText string `json:"message_text"`
// Send Markdown or HTML, if you want Telegram apps to show bold, italic,
// fixed-width text or inline URLs in your bot's message.
ParseMode string `json:"parse_mode,omitempty"`
// Disables link previews for links in the sent message
DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`
}
// InputLocationMessageContent represents the content of a location message
// to be sent as the result of an inline query.
InputLocationMessageContent struct {
// Latitude of the location in degrees
Latitude float32 `json:"latitude"`
// Longitude of the location in degrees
Longitude float32 `json:"longitude"`
}
// InputVenueMessageContent represents the content of a venue message to be
// sent as the result of an inline query.
InputVenueMessageContent struct {
// Latitude of the venue in degrees
Latitude float32 `json:"latitude"`
// Longitude of the venue in degrees
Longitude float32 `json:"longitude"`
// Name of the venue
Title string `json:"title"`
// Address of the venue
Address string `json:"address"`
// Foursquare identifier of the venue, if known
FoursquareID string `json:"foursquare_id,omitempty"`
// Foursquare type of the venue, if known. (For example,
// "arts_entertainment/default", "arts_entertainment/aquarium" or
// "food/icecream".)
FoursquareType string `json:"foursquare_type,omitempty"`
}
// InputContactMessageContent represents the content of a contact message to
// be sent as the result of an inline query.
InputContactMessageContent struct {
// Contact's phone number
PhoneNumber string `json:"phone_number"`
// Contact's first name
FirstName string `json:"first_name"`
// Contact's last name
LastName string `json:"last_name,omitempty"`
// Additional data about the contact in the form of a vCard, 0-2048 bytes
VCard string `json:"vcard,omitempty"`
}
// ChosenInlineResult represents a result of an inline query that was chosen
// by the user and sent to their chat partner.
ChosenInlineResult struct {
// The unique identifier for the result that was chosen
ResultID string `json:"result_id"`
// Identifier of the sent inline message. Available only if there is an
// inline keyboard attached to the message. Will be also received in
// callback queries and can be used to edit the message.
InlineMessageID string `json:"inline_message_id,omitempty"`
// The query that was used to obtain the result
Query string `json:"query"`
// The user that chose the result
From *User `json:"from"`
// Sender location, only for bots that require user location
Location *Location `json:"location,omitempty"`
}
)

262
types_passport.go Normal file
View File

@ -0,0 +1,262 @@
package telegram
type (
// PassportData contains information about Telegram Passport data shared with
// the bot by the user.
PassportData struct {
// Array with information about documents and other Telegram Passport
// elements that was shared with the bot
Data []EncryptedPassportElement `json:"data"`
// Encrypted credentials required to decrypt the data
Credentials *EncryptedCredentials `json:"credentials"`
}
// PassportFile represents a file uploaded to Telegram Passport. Currently all
// Telegram Passport files are in JPEG format when decrypted and don't exceed
// 10MB.
PassportFile struct {
// Unique identifier for this file
FileID string `json:"file_id"`
// File size
FileSize int `json:"file_size"`
// Unix time when the file was uploaded
FileDate int64 `json:"file_date"`
}
// EncryptedPassportElement contains information about documents or other
// Telegram Passport elements shared with the bot by the user.
EncryptedPassportElement struct {
// Element type.
Type string `json:"type"`
// Base64-encoded encrypted Telegram Passport element data provided by
// the user, available for "personal_details", "passport",
// "driver_license", "identity_card", "identity_passport" and "address"
// types. Can be decrypted and verified using the accompanying
// EncryptedCredentials.
Data string `json:"data,omitempty"`
// User's verified phone number, available only for "phone_number" type
PhoneNumber string `json:"phone_number,omitempty"`
// User's verified email address, available only for "email" type
Email string `json:"email,omitempty"`
// Array of encrypted files with documents provided by the user,
// available for "utility_bill", "bank_statement", "rental_agreement",
// "passport_registration" and "temporary_registration" types. Files can
// be decrypted and verified using the accompanying EncryptedCredentials.
Files []PassportFile `json:"files,omitempty"`
// Encrypted file with the front side of the document, provided by the
// user. Available for "passport", "driver_license", "identity_card" and
// "internal_passport". The file can be decrypted and verified using the
// accompanying EncryptedCredentials.
FrontSide *PassportFile `json:"front_side,omitempty"`
// Encrypted file with the reverse side of the document, provided by the
// user. Available for "driver_license" and "identity_card". The file can
// be decrypted and verified using the accompanying EncryptedCredentials.
ReverseSide *PassportFile `json:"reverse_side,omitempty"`
// Encrypted file with the selfie of the user holding a document,
// provided by the user; available for "passport", "driver_license",
// "identity_card" and "internal_passport". The file can be decrypted
// and verified using the accompanying EncryptedCredentials.
Selfie *PassportFile `json:"selfie,omitempty"`
}
// EncryptedCredentials contains data required for decrypting and
// authenticating EncryptedPassportElement. See the Telegram Passport
// Documentation for a complete description of the data decryption and
// authentication processes.
EncryptedCredentials struct {
// Base64-encoded encrypted JSON-serialized data with unique user's
// payload, data hashes and secrets required for EncryptedPassportElement
// decryption and authentication
Data string `json:"data"`
// Base64-encoded data hash for data authentication
Hash string `json:"hash"`
// Base64-encoded secret, encrypted with the bot's public RSA key,
// required for data decryption
Secret string `json:"secret"`
}
// PassportElementError represents an error in the Telegram Passport element
// which was submitted that should be resolved by the user.
PassportElementError interface{}
// PassportElementErrorDataField represents an issue in one of the data
// fields that was provided by the user. The error is considered resolved
// when the field's value changes.
PassportElementErrorDataField struct {
// Error source, must be data
Source string `json:"source"`
// The section of the user's Telegram Passport which has the error, one
// of "personal_details", "passport", "driver_license", "identity_card",
// "internal_passport", "address"
Type string `json:"type"`
// Name of the data field which has the error
FieldName string `json:"field_name"`
// Base64-encoded data hash
DataHash string `json:"data_hash"`
// Error message
Message string `json:"message"`
}
// PassportElementErrorFrontSide represents an issue with the front side of
// a document. The error is considered resolved when the file with the front
// side of the document changes.
PassportElementErrorFrontSide struct {
// Error source, must be front_side
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "passport", "driver_license", "identity_card", "internal_passport"
Type string `json:"type"`
// Base64-encoded hash of the file with the front side of the document
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
// PassportElementErrorReverseSide represents an issue with the reverse side
// of a document. The error is considered resolved when the file with reverse
// side of the document changes.
PassportElementErrorReverseSide struct {
// Error source, must be reverse_side
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "driver_license", "identity_card"
Type string `json:"type"`
// Base64-encoded hash of the file with the reverse side of the document
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
// PassportElementErrorSelfie represents an issue with the selfie with a
// document. The error is considered resolved when the file with the selfie
// changes.
PassportElementErrorSelfie struct {
// Error source, must be selfie
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "passport", "driver_license", "identity_card", "internal_passport"
Type string `json:"type"`
// Base64-encoded hash of the file with the selfie
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
// PassportElementErrorFile represents an issue with a document scan. The
// error is considered resolved when the file with the document scan changes.
PassportElementErrorFile struct {
// Error source, must be file
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "utility_bill", "bank_statement", "rental_agreement",
// "passport_registration", "temporary_registration"
Type string `json:"type"`
// Base64-encoded file hash
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
// PassportElementErrorFiles represents an issue with a list of scans. The
// error is considered resolved when the list of files containing the scans
// changes.
PassportElementErrorFiles struct {
// Error source, must be files
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "utility_bill", "bank_statement", "rental_agreement",
// "passport_registration", "temporary_registration"
Type string `json:"type"`
// List of base64-encoded file hashes
FileHashes []string `json:"file_hashes"`
// Error message
Message string `json:"message"`
}
// PassportElementErrorTranslationFile represents an issue with one of the
// files that constitute the translation of a document. The error is
// considered resolved when the file changes.
PassportElementErrorTranslationFile struct {
// Error source, must be translation_file
Source string `json:"source"`
// Type of element of the user's Telegram Passport which has the issue,
// one of “passport”, “driver_license”, “identity_card”,
// “internal_passport”, “utility_bill”, “bank_statement”,
// “rental_agreement”, “passport_registration”, “temporary_registration”
Type string `json:"type"`
// Base64-encoded file hash
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
// PassportElementErrorTranslationFiles represents an issue with the translated
// version of a document. The error is considered resolved when a file with the
// document translation change.
PassportElementErrorTranslationFiles struct {
// Error source, must be translation_files
Source string `json:"source"`
// Type of element of the user's Telegram Passport which has the issue,
// one of “passport”, “driver_license”, “identity_card”,
// “internal_passport”, “utility_bill”, “bank_statement”,
// “rental_agreement”, “passport_registration”, “temporary_registration”
Type string `json:"type"`
// List of base64-encoded file hashes
FileHashes []string `json:"file_hashes"`
// Error message
Message string `json:"message"`
}
// PassportElementErrorUnspecified represents an issue in an unspecified place.
// The error is considered resolved when new data is added.
PassportElementErrorUnspecified struct {
// Error source, must be unspecified
Source string `json:"source"`
// Type of element of the user's Telegram Passport which has the issue
Type string `json:"type"`
// Base64-encoded element hash
ElementHash string `json:"element_hash"`
// Error message
Message string `json:"message"`
}
)

158
types_payments.go Normal file
View File

@ -0,0 +1,158 @@
package telegram
type (
// LabeledPrice represents a portion of the price for goods or services.
LabeledPrice struct {
// Portion label
Label string `json:"label"`
// Price of the product in the smallest units of the currency (integer,
// not float/double). For example, for a price of US$ 1.45 pass amount =
// 145. See the exp parameter in currencies.json, it shows the number of
// digits past the decimal point for each currency (2 for the majority
// of currencies).
Amount int `json:"amount"`
}
// Invoice contains basic information about an invoice.
Invoice struct {
// Product name
Title string `json:"title"`
// Product description
Description string `json:"description"`
// Unique bot deep-linking parameter that can be used to generate this
// invoice
StartParameter string `json:"start_parameter"`
// Three-letter ISO 4217 currency code
Currency string `json:"currency"`
// Total price in the smallest units of the currency (integer, not
// float/double). For example, for a price of US$ 1.45 pass amount = 145.
// See the exp parameter in currencies.json, it shows the number of
// digits past the decimal point for each currency (2 for the majority
// of currencies).
TotalAmount int `json:"total_amount"`
}
// ShippingAddress represents a shipping address.
ShippingAddress struct {
// ISO 3166-1 alpha-2 country code
CountryCode string `json:"country_code"`
// State, if applicable
State string `json:"state"`
// City
City string `json:"city"`
// First line for the address
StreetLine1 string `json:"street_line1"`
// Second line for the address
StreetLine2 string `json:"street_line2"`
// Address post code
PostCode string `json:"post_code"`
}
// OrderInfo represents information about an order.
OrderInfo struct {
// User name
Name string `json:"name,omitempty"`
// User's phone number
PhoneNumber string `json:"phone_number,omitempty"`
// User email
Email string `json:"email,omitempty"`
// User shipping address
ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}
// ShippingOption represents one shipping option.
ShippingOption struct {
// Shipping option identifier
ID string `json:"id"`
// Option title
Title string `json:"title"`
// List of price portions
Prices []LabeledPrice `json:"prices"`
}
// SuccessfulPayment contains basic information about a successful payment.
SuccessfulPayment struct {
// Three-letter ISO 4217 currency code
Currency string `json:"currency"`
// Bot specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// Identifier of the shipping option chosen by the user
ShippingOptionID string `json:"shipping_option_id,omitempty"`
// Telegram payment identifier
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
// Provider payment identifier
ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
// Total price in the smallest units of the currency (integer, not
// float/double). For example, for a price of US$ 1.45 pass amount = 145.
// See the exp parameter in currencies.json, it shows the number of
// digits past the decimal point for each currency (2 for the majority
// of currencies).
TotalAmount int `json:"total_amount"`
// Order info provided by the user
OrderInfo *OrderInfo `json:"order_info,omitempty"`
}
// ShippingQuery contains information about an incoming shipping query.
ShippingQuery struct {
// Unique query identifier
ID string `json:"id"`
// Bot specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// User who sent the query
From *User `json:"from"`
// User specified shipping address
ShippingAddress *ShippingAddress `json:"shipping_address"`
}
// PreCheckoutQuery contains information about an incoming pre-checkout query.
PreCheckoutQuery struct {
// Unique query identifier
ID string `json:"id"`
// Three-letter ISO 4217 currency code
Currency string `json:"currency"`
// Bot specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// Identifier of the shipping option chosen by the user
ShippingOptionID string `json:"shipping_option_id,omitempty"`
// User who sent the query
From *User `json:"from"`
// Total price in the smallest units of the currency (integer, not
// float/double). For example, for a price of US$ 1.45 pass amount = 145.
// See the exp parameter in currencies.json, it shows the number of
// digits past the decimal point for each currency (2 for the majority of
// currencies).
TotalAmount int `json:"total_amount"`
// Order info provided by the user
OrderInfo *OrderInfo `json:"order_info,omitempty"`
}
)

66
types_stickers.go Normal file
View File

@ -0,0 +1,66 @@
package telegram
type (
// Sticker represents a sticker.
Sticker struct {
// Unique identifier for this file
FileID string `json:"file_id"`
// Emoji associated with the sticker
Emoji string `json:"emoji,omitempty"`
// Name of the sticker set to which the sticker belongs
SetName string `json:"set_name,omitempty"`
// Sticker width
Width int `json:"width"`
// Sticker height
Height int `json:"height"`
// File size
FileSize int `json:"file_size,omitempty"`
// Sticker thumbnail in the .webp or .jpg format
Thumb *PhotoSize `json:"thumb,omitempty"`
// For mask stickers, the position where the mask should be placed
MaskPosition *MaskPosition `json:"mask_position,omitempty"`
}
// StickerSet represents a sticker set.
StickerSet struct {
// Sticker set name
Name string `json:"name"`
// Sticker set title
Title string `json:"title"`
// True, if the sticker set contains masks
ContainsMasks bool `json:"contains_masks"`
// List of all set stickers
Stickers []Sticker `json:"stickers"`
}
// MaskPosition describes the position on faces where a mask should be placed
// by default.
MaskPosition struct {
// The part of the face relative to which the mask should be placed. One
// of "forehead", "eyes", "mouth", or "chin".
Point string `json:"point"`
// Shift by X-axis measured in widths of the mask scaled to the face
// size, from left to right. For example, choosing -1.0 will place mask
// just to the left of the default mask position.
XShift float32 `json:"x_shift"`
// Shift by Y-axis measured in heights of the mask scaled to the face
// size, from top to bottom. For example, 1.0 will place the mask just
// below the default mask position.
YShift float32 `json:"y_shift"`
// Mask scaling coefficient. For example, 2.0 means double size.
Scale float32 `json:"scale"`
}
)