Documentation
¶
Overview ¶
Package tgwrap provides bindings for Telegram Bot API
Index ¶
- Constants
- func NewBot(token string) *bot
- func NewBotWithClient(token string, client *http.Client) *bot
- func NewBotWithClientAndURL(token string, client *http.Client, apiURL string) *bot
- type Animation
- type Audio
- type BotChatInterface
- type BotContactsInterface
- type BotInterface
- type BotLocationInterface
- type BotMediaInterface
- type BotMessagesInterface
- type BotUpdatesInterface
- type CallbackQuery
- type Chat
- type ChatActions
- type ChatPhoto
- type ChosenInlineResult
- type Contact
- type Document
- type EditMessageLiveLocationOpt
- type ForceReply
- type Game
- type GenericResponse
- type GetUpdatesOpt
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type InlineQuery
- type InputFile
- type InputFileLocal
- type Invoice
- type KeyboardButton
- type Location
- type Message
- type MessageEntity
- type OrderInfo
- type ParseModes
- type PhotoSize
- type PreCheckoutQuery
- type ReplyKeyboardMarkup
- type ReplyKeyboardRemove
- type SendAudioOpt
- type SendContactOpt
- type SendDocumentOpt
- type SendLocationOpt
- type SendMessageOpt
- type SendPhotoOpt
- type SendVenueOpt
- type SendVideoNoteOpt
- type SendVideoOpt
- type SendVoiceOpt
- type SetWebhookOpt
- type ShippingQuery
- type Sticker
- type StopMessageLiveLocationOpt
- type SuccessfulPayment
- type Update
- type User
- type Venue
- type Video
- type VideoNote
- type Voice
Constants ¶
const DefaultClientTimeout = time.Second * 50
DefaultClientTimeout is waiting for result interval used by default in default client
const TelegramBotAPI = "https://api.telegram.org/bot"
TelegramBotAPI is default api address used in default client
Variables ¶
This section is empty.
Functions ¶
func NewBotWithClient ¶
NewBotWithClient creates bot w/ associated token and optional HTTP client
Types ¶
type Animation ¶
type Animation struct {
//
// Unique file identifier
//
FileID string `json:"file_id"`
//
// Optional. Animation thumbnail as defined by sender
//
Thumb *PhotoSize `json:"thumb,omitempty"`
//
// Optional. Original animation filename as defined by sender
//
FileName string `json:"file_name,omitempty"`
//
// Optional. MIME type of the file as defined by sender
//
MIMEType string `json:"mime_type,omitempty"`
//
// Optional. File size
//
FileSize uint `json:"file_size,omitempty"`
}
Animation is a Telegram API object
You can provide an animation for your game so that it looks stylish in chats (check out Lumberjack for an example). This object represents an animation file to be displayed in the message containing a game.
type Audio ¶
type Audio struct {
//
// Unique identifier for this file
//
ID string `json:"file_id"`
//
// Duration of the audio in seconds as defined by sender
//
Duration uint `json:"duration"`
//
// Optional. Performer of the audio as defined by sender or by audio tags
//
Performer string `json:"performer,omitempty"`
//
// Optional. Title of the audio as defined by sender or by audio tags
//
Title string `json:"title,omitempty"`
//
// Optional. MIME type of the file as defined by sender
//
MIMEType string `json:"mime_type,omitempty"`
//
// Optional. File size
//
TitleSize uint `json:"file_size,omitempty"`
}
Audio represents an audio file to be treated as music by the Telegram clients.
type BotChatInterface ¶
type BotChatInterface interface {
//
// SendChatAction is used when you need to tell the user
// that something is happening on the bot's side. The status
// is set for 5 seconds or less (when a message arrives from
// your bot, Telegram clients clear its typing status).
// Returns True on success.
//
// chatID: unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// action: type of action to broadcast.
//
SendChatAction(chatID interface{}, action ChatActions) (bool, error)
}
BotChatInterface is a group of methods for chat manipulation used as a part of common BotInterface API interface
type BotContactsInterface ¶
type BotContactsInterface interface {
//
// SendContact is used to to send phone contacts.
// On success, the sent Message is returned.
//
// chatID: (uint64 or string) Unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// phoneNumber: (string) Contact's phone number.
//
// firstName: (string) Contact's first name.
//
// opt: (can be nil) optional params
//
SendContact(chatID interface{}, phoneNumber string, firstName string, opt *SendContactOpt) (*Message, error)
}
BotContactsInterface is a group of methods for sending contact-related information; used as a part of common BotInterface API interface
type BotInterface ¶
type BotInterface interface {
//
// GetMe is used for testing your bot's auth token.
// Requires no parameters. Returns basic information
// about the bot in form of a User object.Telegram API method
//
GetMe() (*User, error)
BotUpdatesInterface
BotMessagesInterface
BotChatInterface
BotMediaInterface
BotLocationInterface
BotContactsInterface
}
BotInterface is a summary declaration for nominal Telegram Bot API interface
type BotLocationInterface ¶
type BotLocationInterface interface {
// SendLocation is used to send point on the map.
// On success, the sent Message is returned.
//
// chatID: (uint64 or string) Unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// latitude: (float64) Latitude of the location.
//
// longitude: (float64) Longitude of the location.
//
// opt: (can be nil) optional params
//
SendLocation(chatID interface{}, latitude float64, longitude float64, opt *SendLocationOpt) (*Message, error)
// SendVenue is used to send information about a venue.
// On success, the sent Message is returned.
//
// chatID: (uint64 or string) Unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// latitude: (float64) Latitude of the venue.
//
// longitude: (float64) Longitude of the venue.
//
// title: (string) Name of the venue.
//
// address: (string) Address of the venue.
//
// opt: (can be nil) optional params
//
SendVenue(chatID interface{}, latitude float64, longitude float64, title string, address string, opt *SendVenueOpt) (*Message, error)
//
// StopMessageLiveLocation is used to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires.
// On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.
//
// opt: (can be nil) optional params
//
StopMessageLiveLocation(opt *StopMessageLiveLocationOpt) (interface{}, error)
//
// EditMessageLiveLocation is used to edit live location messages sent by the bot or via the bot (for inline bots).
// A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation.
// On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
//
// latitude: (float64) Latitude of new location.
//
// longitude: (float64) Longitude of new location.
//
// opt: (can be nil) optional params
//
EditMessageLiveLocation(latitude float64, longitude float64, opt *EditMessageLiveLocationOpt) (interface{}, error)
}
BotLocationInterface is a group of methods for location used as a part of common BotInterface API interface
type BotMediaInterface ¶
type BotMediaInterface interface {
//
// SendPhoto is used to send photos.
//
// chatID: (Integer or String) Unique identifier
// for the target chat or username of the target channel (in the format @channelusername)
//
// photo: (*InputFile or string) Photo to send. Pass a file_id as string to send
// a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a string
// for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data
// using &NewInputFileLocal("<file path>")
//
// opt: (can be nil) optional params
//
SendPhoto(chatID interface{}, photo interface{}, opt *SendPhotoOpt) (*Message, error)
//
// SendVideo is used to send video files, Telegram clients support mp4 videos
// (other formats may be sent as Document). On success, the sent Message is returned.
// Bots can currently send video files of up to 50 MB in size,
// this limit may be changed in the future.
//
// chatID: (uint64 or string) Unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// video: (*InputFile or string) Video to send. Pass a file_id as string to send
// a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a string
// for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data
// using &NewInputFileLocal("<file path>")
//
// opt: (can be nil) optional params
//
SendVideo(chatID interface{}, video interface{}, opt *SendVideoOpt) (*Message, error)
//
// SendAudio is used to send audio files, if you want Telegram clients to display them in the music player.
// Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently
// send audio files of up to 50 MB in size, this limit may be changed in the future.
//
// For sending voice messages, use the SendVoice method instead.
//
// chatID: (uint64 or string) Unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// audio: (*InputFile or string) Audio to send. Pass a file_id as string to send
// an audio that exists on the Telegram servers (recommended), pass an HTTP URL as a string
// for Telegram to get an audio from the Internet, or upload a new file using multipart/form-data.
// using &NewInputFileLocal("<file path>")
//
// opt: (can be nil) optional params
//
SendAudio(chatID interface{}, audio interface{}, opt *SendAudioOpt) (*Message, error)
//
// SendVoice to send audio files, if you want Telegram clients to display the file
// as a playable voice message. For this to work, your audio must be in an .ogg file
// encoded with OPUS (other formats may be sent as Audio or Document).
// On success, the sent Message is returned. Bots can currently send voice messages
// of up to 50 MB in size, this limit may be changed in the future.
//
// chatID: (uint64 or string) Unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// voice: (*InputFile or string) Audio to send. Pass a file_id as String to send
// an audio that exists on the Telegram servers (recommended), pass an HTTP URL as a String
// for Telegram to get an audio from the Internet, or upload a new file using multipart/form-data.
// using &NewInputFileLocal("<file path>")
//
// opt: (can be nil) optional params
//
SendVoice(chatID interface{}, voice interface{}, opt *SendVoiceOpt) (*Message, error)
//
// SendDocument to send general files. On success, the sent Message is returned.
// Bots can currently send files of any type of up to 50 MB in size, t
// his limit may be changed in the future.
//
// chatID: (uint64 or string) Unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// document: (*InputFile or string) File to send. Pass a file_id as String to send
// an audio that exists on the Telegram servers (recommended), pass an HTTP URL as a String
// for Telegram to get an audio from the Internet, or upload a new file using multipart/form-data.
// using &NewInputFileLocal("<file path>")
//
// opt: (can be nil) optional params
//
SendDocument(chatID interface{}, document interface{}, opt *SendDocumentOpt) (*Message, error)
// SendVideoNote is used to send video notes.
// As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.
// Use this method to send video messages. On success, the sent Message is returned.
//
// chatID: (uint64 or string) Unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// video: (*InputFile or string) Video note to send.
// Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or
// upload a new video using multipart/form-data.
// Sending video notes by a URL is currently unsupported
//
// opt: (can be nil) optional params
//
SendVideoNote(chatID interface{}, video interface{}, opt *SendVideoNoteOpt) (*Message, error)
}
BotMediaInterface is a group of methods for sending media used as a part of common BotInterface API interface
type BotMessagesInterface ¶
type BotMessagesInterface interface {
//
// SendMessage is used method to send text messages.
//
// chatID: unique identifier for the target chat
// or username(!) of the target channel (in the format @channelusername)
//
// text: text of the message to be sent
//
// opt: (can be nil) optional params
//
SendMessage(chatID interface{}, text string, opt *SendMessageOpt) (*Message, error)
//
// ForwardMessage is used to forward messages of any kind.
// On success, the sent Message is returned.
//
// chatID: unique identifier for the target chat
// or username of the target channel (in the format @channelusername)
//
// fromChatID: unique identifier for the chat
// where the original message was sent (or channel username
// in the format @channelusername)
//
// disableNotification: sends the message silently.
// Users will receive a notification with no sound.
//
// messageID: message identifier in the chat
// specified in fromChatID
//
ForwardMessage(chatID interface{}, fromChatID interface{},
disableNotification bool, messageID uint64) (*Message, error)
}
BotMessagesInterface is just a group of methods to have smaller interface files
type BotUpdatesInterface ¶
type BotUpdatesInterface interface {
//
// GetUpdates is used to receive incoming updates using [long] polling
//
// opt: (can be nil) optional params
//
GetUpdates(opt *GetUpdatesOpt) ([]*Update, error)
}
BotUpdatesInterface is a group of methods related to getting updates used as a part of common BotInterface API interface
type CallbackQuery ¶
type CallbackQuery struct {
//
// Unique identifier for this query
//
ID string `json:"id"`
//
// Sender
//
From *User `json:"from"`
//
// Optional. Message with the callback button that originated the query.
// Note that message content and message date will not be available
// if the message is too old
//
Message *Message `json:"message,omitempty"`
//
// Optional. Identifier of the message sent via the bot in inline mode,
// that originated the query.
//
InlineMessageID string `json:"inline_message_id,omitempty"`
//
// Global identifier, uniquely corresponding to the chat to which the message
// with the callback button was sent. Useful for high scores in games.
//
ChatInstance string `json:"chat_instance"`
//
// Optional. Data associated with the callback button.
// Be aware that a bad client can send arbitrary data in this field.
//
Data string `json:"data,omitempty"`
//
// Optional. Short name of a Game to be returned,
// serves as the unique identifier for the game
//
GameShortName string `json:"game_short_name,omitempty"`
}
CallbackQuery represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters).
type Chat ¶
type Chat struct {
//
// Unique identifier for this chat.
//
ID int64 `json:"id"`
//
// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
//
Type string `json:"type"`
//
// Optional. Title, for supergroups, channels and group chats
//
Title string `json:"title"`
//
// Optional. Username, for private chats, supergroups and channels if available
//
UserName string `json:"username"`
//
// Optional. First name of the other party in a private chat
//
FirstName string `json:"first_name"`
//
// Optional. Last name of the other party in a private chat
//
LastName string `json:"last_name"`
//
// Optional. True if a group has ‘All Members Are Admins’ enabled.
//
AllMembersAreAdministrators bool `json:"all_members_are_administrators"`
//
// Optional. Chat photo. Returned only in getChat.
//
Photo *ChatPhoto `json:"photo"`
//
// Optional. Description, for supergroups and channel chats. Returned only in getChat.
//
Description string `json:"description"`
//
// Optional. Chat invite link, for supergroups and channel chats. Returned only in getChat.
//
InviteLink string `json:"invite_link"`
//
// Optional. Pinned message, for supergroups and channel chats. Returned only in getChat.
//
PinnedMessage *Message `json:"pinned_message"`
//
// Optional. For supergroups, name of group sticker set. Returned only in getChat.
//
StickerSetName string `json:"sticker_set_name"`
//
// Optional. True, if the bot can change the group sticker set. Returned only in getChat.
//
CanSetStickerSet bool `json:"can_set_sticker_set"`
}
Chat is a Telegram API object
type ChatActions ¶
type ChatActions string
ChatActions type represent argument for SendChatAction (hello linter)
const ( // ChatActionTyping indicates bot is typing (this looks frighteningly sometimes) ChatActionTyping ChatActions = "typing" // ChatActionUploadPhoto indicates bot is uploading photo ChatActionUploadPhoto ChatActions = "upload_photo" // ChatActionRecordVideo indicates bot is recording video ChatActionRecordVideo ChatActions = "record_video" // ChatActionRecordAudio indicates bot is recording audio ChatActionRecordAudio ChatActions = "record_audio" // ChatActionUploadDocument indicates bot is uploading document ChatActionUploadDocument ChatActions = "upload_document" // // ChatActionFindLocation indicates bot is in search // for location (is it really working on any tg client?) // ChatActionFindLocation ChatActions = "find_location" // ChatActionRecordVideoNote indicates bot is recording video note ChatActionRecordVideoNote ChatActions = "record_video_note" // ChatActionUploadVideoNote indicates bot is uploading note ChatActionUploadVideoNote ChatActions = "upload_video_note" )
type ChatPhoto ¶
type ChatPhoto struct {
//
// Unique file identifier of small (160x160) chat photo.
// This file_id can be used only for photo download.
//
SmallFileID string `json:"small_file_id"`
//
// Unique file identifier of big (640x640) chat photo.
// This file_id can be used only for photo download.
//
BigFileID string `json:"big_file_id"`
}
ChatPhoto is a Telegram API object
type ChosenInlineResult ¶
type ChosenInlineResult struct {
//
// The unique identifier for the result that was chosen
//
ResultID string `json:"result_id"`
//
// The user that chose the result
//
From *User `json:"from"`
//
// Optional. Sender location, only for bots that require user location
//
Location *Location `json:"location,omitempty"`
//
// Optional. 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"`
}
ChosenInlineResult represents a result of an inline query that was chosen by the user and sent to their chat partner.
type Contact ¶
type Contact struct {
//
// Contact's phone number
//
PhoneNumber string `json:"phone_number"`
//
// Contact's first name
//
FirstName string `json:"first_name"`
//
// Optional. Contact's last name
//
LastName string `json:"last_name,omitempty"`
//
// Optional. Contact's user identifier in Telegram
//
UserID uint64 `json:"user_id,omitempty"`
}
Contact represents a phone contact.
type Document ¶
type Document struct {
//
// Unique file identifier
//
FileID string `json:"file_id"`
//
// Optional. Document thumbnail as defined by sender
//
Thumb *PhotoSize `json:"thumb,omitempty"`
//
// Optional. Original filename as defined by sender
//
FileName string `json:"file_name,omitempty"`
//
// Optional. MIME type of the file as defined by sender
//
MIMEType string `json:"mime_type,omitempty"`
//
// Optional. File size
//
FileSize uint `json:"file_size,omitempty"`
}
Document represents a general file (as opposed to photos, voice messages and audio files).
type EditMessageLiveLocationOpt ¶
type EditMessageLiveLocationOpt struct {
//
// Required if inline_message_id is not specified.
// Unique identifier for the target chat or username of the target channel (in the format @channelusername)
//
ChatID interface{} `json:"chat_id,omitempty"`
//
// Required if inline_message_id is not specified.
// Identifier of the sent message
//
MessageID uint `json:"message_id,omitempty"`
//
// Required if chat_id and message_id are not specified.
// Identifier of the inline message
//
InlineMessageID string `json:"inline_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
EditMessageLiveLocationOpt represents optional params for EditMessageLiveLocation
type ForceReply ¶
type ForceReply struct {
//
// Shows reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply'
//
// should be true
//
ForceReply bool `json:"force_reply"`
//
// Optional. Use this parameter if you want to force reply from specific users only.
//
// Targets:
// 1) users that are @mentioned in the text of the Message object;
//
// 2) if the bot's message is a reply (has reply_to_message_id),
// sender of the original message.
//
Selective bool `json:"selective,omitempty"`
}
ForceReply is a Telegram API object
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
type Game ¶
type Game struct {
//
// Title of the game
//
Title string `json:"title"`
//
// Description of the game
//
Description string `json:"description"`
//
// Photo that will be displayed in the game message in chats.
//
Photo []*PhotoSize `json:"photo"`
//
// Optional. 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"`
//
// Optional. Special entities that appear in text,
// such as usernames, URLs, bot commands, etc.
//
TextEntities []*MessageEntity `json:"text_entities,omitempty"`
//
// Optional. Animation that will be displayed in the game message in chats.
// Upload via BotFather
//
Animation *Animation `json:"animation,omitempty"`
}
Game represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
type GenericResponse ¶
type GenericResponse struct {
OK bool `json:"ok"`
Description string `json:"description,omitempty"`
ErrorCode int `json:"error_code,omitempty"`
}
GenericResponse is a common part of all the API responses Description and ErrorCode are provided in case of error
type GetUpdatesOpt ¶
type GetUpdatesOpt struct {
//
// Identifier of the first update to be returned.
// Must be greater by one than the highest among the identifiers
// of previously received updates. By default, updates starting
// with the earliest unconfirmed update are returned. An update
// is considered confirmed as soon as getUpdates is called with
// an offset higher than its update_id. The negative offset
// can be specified to retrieve updates starting from -offset
// update from the end of the updates queue.
// All previous updates will forgotten.
//
Offset int64 `json:"offset,omitempty"`
//
// Limits the number of updates to be retrieved.
// Values between 1—100 are accepted. Defaults to 100.
//
Limit uint `json:"limit,omitempty"`
//
// Timeout in seconds for long polling.
// Defaults to 0, i.e. usual short polling. Should be positive,
// short polling should be used for testing purposes only.
//
Timeout uint `json:"timeout,omitempty"`
//
// List the types of updates you want your bot to receive.
// For example, specify [“message”, “edited_channel_post”, “callback_query”]
// to only receive updates of these types. See Update for a complete list
// of available update types. Specify an empty list to receive all updates
// regardless of type (default). If not specified, the previous setting will be used.
//
// Please note that this parameter doesn't affect updates
// created before the call to the getUpdates, so unwanted
// updates may be received for a short period of time.
//
Allowed []string `json:"allowed_updates,omitempty"`
// contains filtered or unexported fields
}
GetUpdatesOpt represents optional params for GetUpdates()
type InlineKeyboardButton ¶
type InlineKeyboardButton struct {
//
// Label text on the button
//
Text string `json:"text"`
//
// Optional. HTTP url to be opened when button is pressed
//
URL string `json:"url,omitempty"`
//
// Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
//
CallbackData string `json:"callback_data,omitempty"`
//
// Optional. If set, pressing the button will prompt the user to select one of their chats,
// open that chat and insert the bot‘s username and the specified inline query in the input field.
// Can be empty, in which case just the bot’s username will be inserted.
//
// Note: This offers an easy way for users to start using your bot in inline mode when they
// are currently in a private chat with it. Especially useful when combined with switch_pm… actions
// – in this case the user will be automatically returned to the chat they switched from,
// skipping the chat selection screen.
//
SwitchInlineQuery string `json:"switch_inline_query,omitempty"`
//
// Optional. If set, pressing the button will insert the bot‘s username and the specified
// inline query in the current chat's input field. Can be empty, in which case only
// the bot’s username will be inserted.
//
// This offers a quick way for the user to open your bot in inline mode in the same chat
// – good for selecting something from multiple options.
//
SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"`
//
// Optional. Description of the game that will be launched when the user presses the button.
//
// NOTE: This type of button must always be the first button in the first row.
//
CallbackGame string `json:"callback_game,omitempty"`
//
// Optional. Specify True, to send a Pay button.
//
// NOTE: This type of button must always be the first button in the first row.
//
Pay string `json:"pay,omitempty"`
}
InlineKeyboardButton represents one button of an inline keyboard. You must use exactly one of the optional fields.
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
//
// Array of button rows, each represented
// by an Array of InlineKeyboardButton objects
//
InlineKeyboard [][]*InlineKeyboardButton `json:"inline_keyboard"`
}
InlineKeyboardMarkup represents an inline keyboard that appears right next to the message it belongs to.
type InlineQuery ¶
type InlineQuery struct {
//
// Unique identifier for this query
//
ID string `json:"id"`
//
// Sender
//
From *User `json:"from"`
//
// Optional. Sender location, only for bots that request user location
//
Location *Location `json:"location,omitempty"`
//
// 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"`
}
InlineQuery represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
type InputFile ¶
type InputFile struct {
// contains filtered or unexported fields
}
InputFile is used to store file_id, URL, or localFileName to encode as multipart/form-data
func NewInputFileFromID ¶
NewInputFileFromID is used to create InputFile with file_id stored inside
func NewInputFileFromURL ¶
NewInputFileFromURL is used to create InputFile with URL stored inside
func (*InputFile) MarshalText ¶
MarshalText implements TextMarshaler and returns fileID or URL
type InputFileLocal ¶
type InputFileLocal struct {
// contains filtered or unexported fields
}
InputFileLocal is used to store localFileName to encode as multipart/form-data
func NewInputFileLocal ¶
func NewInputFileLocal(path string) *InputFileLocal
NewInputFileLocal is used to create InputFile with localFileName stored inside
func (*InputFileLocal) MarshalText ¶
func (p *InputFileLocal) MarshalText() (text []byte, err error)
MarshalText implements TextMarshaler
func (*InputFileLocal) String ¶
func (p *InputFileLocal) String() string
String implements stringer interface
type Invoice ¶
type 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](https://core.telegram.org/bots/payments#supported-currencies)
//
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 https://core.telegram.org/bots/payments/currencies.json
// it shows the number of digits past the decimal point
// for each currency (2 for the majority of currencies,
// and zero for remaining ).
//
TotalAmount int `json:"total_amount"`
}
Invoice contains basic information about an invoice.
type KeyboardButton ¶
type KeyboardButton struct {
//
// Text of the button. If none of the optional fields are used,
// it will be sent as a message when the button is pressed
//
Text string `json:"text"`
//
// Optional. If True, the user's phone number will be sent
// as a contact when the button is pressed. Available in private chats only
//
RequestContact string `json:"request_contact,omitempty"`
//
// Optional. If True, the user's current location will be sent
// when the button is pressed. Available in private chats only
//
RequestLocation string `json:"request_location,omitempty"`
}
KeyboardButton represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.
Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
type Location ¶
type Location struct {
//
// Longitude as defined by sender
//
Longitude float64 `json:"longitude"`
//
// Latitude as defined by sender
//
Latitude float64 `json:"latitude"`
}
Location represents a point on the map.
type Message ¶
type Message struct {
//
// Unique message identifier inside this chat
//
ID int64 `json:"message_id"`
//
// Optional. Sender, empty for messages sent to channels
//
From *User `json:"from,omitempty"`
//
// Date the message was sent in Unix time
//
Date int64 `json:"date"`
//
// Conversation the message belongs to
//
Chat *Chat `json:"chat"`
//
// Optional. For forwarded messages, sender of the original message
//
ForwardFrom *User `json:"forward_from,omitempty"`
//
// Optional. For messages forwarded from channels, information about the original channel
//
ForwardFromChat *Chat `json:"forward_from_chat,omitempty"`
//
// Optional. For messages forwarded from channels, identifier of the original message in the channel
//
ForwardFromMessageID uint64 `json:"forward_from_message_id,omitempty"`
//
// Optional. For messages forwarded from channels, signature of the post author if present
//
ForwardSignature string `json:"forward_signature,omitempty"`
//
// Optional. For forwarded messages, date the original message was sent in Unix time
//
ForwardDate int64 `json:"forward_date,omitempty"`
//
// Optional. For replies, the original message.
// Note that the Message object in this field
// will not contain further reply_to_message fields
// even if it itself is a reply.
//
ReplyToMessage *Message `json:"reply_to_message,omitempty"`
//
// Optional. Date the message was last edited in Unix time
//
EditDate int64 `json:"edit_date,omitempty"`
//
// Optional. The unique identifier of a media message group this message belongs to
//
MediaGroupID uint64 `json:"media_group_id,omitempty"`
//
// Optional. Signature of the post author for messages in channels
//
AuthorSignature string `json:"author_signature,omitempty"`
//
// Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters.
//
Text string `json:"text,omitempty"`
//
// Optional. For text messages, special entities
// like usernames, URLs, bot commands, etc. that appear in the text
//
Entities []*MessageEntity `json:"entities,omitempty"`
//
// Optional. For messages with a caption, special entities
// like usernames, URLs, bot commands, etc. that appear in the caption
//
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
//
// Optional. Message is an audio file, information about the file
//
Audio *Audio `json:"audio,omitempty"`
//
// Optional. Message is a general file, information about the file
//
Document *Document `json:"document,omitempty"`
//
// Optional. Message is a game, information about the game
//
Game *Game `json:"game,omitempty"`
//
// Optional. Message is a photo, available sizes of the photo
//
Photo []*PhotoSize `json:"photo,omitempty"`
//
// Optional. Message is a sticker, information about the sticker
//
Sticker *Sticker `json:"sticker,omitempty"`
//
// Optional. Message is a video, information about the video
//
Video *Video `json:"video,omitempty"`
//
// Optional. Message is a voice message, information about the file
//
Voice *Voice `json:"voice,omitempty"`
//
// Optional. Message is a video note, information about the video message
//
VideoNote *VideoNote `json:"video_note,omitempty"`
//
// Optional. Caption for the audio, document, photo, video or voice, 0-200 characters
//
Caption string `json:"caption,omitempty"`
//
// Optional. Message is a shared contact, information about the contact
//
Contact *Contact `json:"contact,omitempty"`
//
// Optional. Message is a shared location, information about the location
//
Location *Location `json:"location,omitempty"`
//
// Optional. Message is a venue, information about the venue
//
Venue *Venue `json:"venue,omitempty"`
//
// Optional. New members that were added to the group
// or supergroup and information about them
// (the bot itself may be one of these members)
//
NewChatMembers []*User `json:"new_chat_members,omitempty"`
//
// Optional. A member was removed from the group,
// information about them (this member may be the bot itself)
//
LeftChatMembers *User `json:"left_chat_member,omitempty"`
//
// Optional. A chat title was changed to this value
//
NewChatTitle string `json:"new_chat_title,omitempty"`
//
// Optional. A chat photo was change to this value
//
NewChatPhoto []*PhotoSize `json:"new_chat_photo,omitempty"`
//
// Optional. Service message: the chat photo was deleted
//
DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`
//
// Optional. Service message: the group has been created
//
GroupChatCreated bool `json:"group_chat_created,omitempty"`
//
// Optional. Service message: the supergroup has been created.
// This field can‘t be received in a message coming through updates,
// because bot can’t be a member of a supergroup when it is created.
// It can only be found in reply_to_message if someone replies
// to a very first message in a directly created supergroup.
//
SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
//
// Optional. Service message: the channel has been created.
// This field can‘t be received in a message coming through updates,
// because bot can’t be a member of a channel when it is created.
// It can only be found in reply_to_message if someone replies
// to a very first message in a channel.
//
ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
//
// Optional. The group has been migrated to a supergroup
// with the specified identifier. This number may be greater
// than 32 bits and some programming languages may have
// difficulty/silent defects in interpreting it. But
// it is smaller than 52 bits, so a signed 64 bit
// integer or double-precision float type are safe
// for storing this identifier.
//
MigrateChatID uint64 `json:"migrate_to_chat_id,omitempty"`
//
// Optional. The supergroup has been migrated from a group
// with the specified identifier. This number may be greater
// than 32 bits and some programming languages may have
// difficulty/silent defects in interpreting it. But
// it is smaller than 52 bits, so a signed 64 bit
// integer or double-precision float type are safe
// for storing this identifier.
//
MigrateFromChatID uint64 `json:"migrate_from_chat_id,omitempty"`
//
// Optional. Specified message was pinned.
// Note that the Message object in this field
// will not contain further reply_to_message fields
// even if it is itself a reply.
//
PinnedMessage *Message `json:"pinned_message,omitempty"`
//
// Optional. Message is an invoice for a payment,
// information about the invoice.
//
Invoice *Invoice `json:"invoice,omitempty"`
//
// Optional. Message is a service message about
// a successful payment, information about the payment.
//
SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
}
Message is a Telegram API object
func (*Message) ForwardTime ¶
ForwardTime returns Message.ForwardDate in time.Time format
type MessageEntity ¶
type MessageEntity struct {
//
// Type of the entity. Can be
// mention (@username),
// hashtag,
// bot_command,
// url,
// email,
// bold (bold text),
// italic (italic text),
// code (monowidth string),
// pre (monowidth block),
// text_link (for clickable text URLs),
// text_mention (for users without usernames)
//
Type string `json:"type"`
//
// Offset in UTF-16 code units to the start of the entity
//
Offset int `json:"offset"`
//
// Length of the entity in UTF-16 code units
//
Length int `json:"length"`
//
// Optional. For “text_link” only, url that will be opened after user taps on the text
//
URL string `json:"url"`
//
// Optional. For “text_mention” only, the mentioned user
//
User *User `json:"user"`
}
MessageEntity represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
type ParseModes ¶
type ParseModes string
ParseModes represents formatting optiona for SendMessage()
The Bot API supports basic formatting for messages. You can use bold and italic text, as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.
Note that Telegram clients will display an alert to the user before opening an inline link (‘Open this link?’ together with the full URL).
Links 'tg://user?id=<user_id>' can be used to mention a user by their id without using a username. Please note: These links will work only if they are used inside an inline link. These mentions are only guaranteed to work if the user has contacted the bot in the past or is a member in the group where he was mentioned.
const ( // // ParseModeDefault is simple text by default // ParseModeDefault ParseModes = "" // // ParseModeHTML The following tags are currently supported: // // <b>bold</b>, <strong>bold</strong> // <i>italic</i>, <em>italic</em> // <a href="http://www.example.com/">inline URL</a> // <a href="tg://user?id=123456789">inline mention of a user</a> // <code>inline fixed-width code</code> // <pre>pre-formatted fixed-width code block</pre> // ParseModeHTML ParseModes = "HTML" // // ParseModeMarkdown Use the following syntax in your message: // // *bold text* // _italic text_ // [inline URL](http://www.example.com/) // [inline mention of a user](tg://user?id=123456789) // `inline fixed-width code` // “`block_language // pre-formatted fixed-width code block // “` // ParseModeMarkdown ParseModes = "Markdown" )
type PhotoSize ¶
type PhotoSize struct {
//
// Unique identifier for this file
//
FileID string `json:"file_id"`
//
// Photo width
//
Width uint `json:"width"`
//
// Photo height
//
Height uint `json:"height"`
//
// Optional. File size
//
FileSize uint `json:"file_size,omitempty"`
}
PhotoSize represents one size of a photo or a file / sticker thumbnail.
type PreCheckoutQuery ¶
type PreCheckoutQuery struct {
}
PreCheckoutQuery is a Telegram API object TODO: implement fields
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct {
//
// Array of button rows, each represented by an Array of KeyboardButton objects
//
Keyboard [][]*KeyboardButton `json:"keyboard"`
//
// Optional. Requests clients to resize the keyboard vertically for optimal fit
// (e.g., make the keyboard smaller if there are just two rows of buttons).
// Defaults to false, in which case the custom keyboard is always
// of the same height as the app's standard keyboard.
//
ResizeKeyboard [][]*KeyboardButton `json:"resize_keyboard,omitempty"`
//
// Optional. Requests clients to hide the keyboard as soon as it's been used.
// The keyboard will still be available, but clients will automatically display
// the usual letter-keyboard in the chat – the user can press a special button
// in the input field to see the custom keyboard again. Defaults to false.
//
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
//
// Optional. Use this parameter if you want to show the keyboard to specific users only.
// Targets:
// 1) users that are @mentioned in the text of the Message object;
//
// 2) if the bot's message is a reply (has reply_to_message_id),
// sender of the original message.
//
Selective bool `json:"selective,omitempty"`
}
ReplyKeyboardMarkup represents a custom keyboard with reply options (see Introduction to bots for details and examples).
type ReplyKeyboardRemove ¶
type ReplyKeyboardRemove struct {
RemoveKeyboard [][]*InlineKeyboardButton `json:"remove_keyboard"`
Selective bool `json:"selective"`
}
ReplyKeyboardRemove is a Telegram API object
Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
type SendAudioOpt ¶
type SendAudioOpt struct {
//
// Audio caption, 0-200 characters
// 0-200 characters
//
Caption string `json:"caption,omitempty"`
//
// Duration of the audio in seconds
//
Duration uint `json:"duration,omitempty"`
//
// Performer of the track
//
Performer string `json:"performer,omitempty"`
//
// Track name
//
Title string `json:"title,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendAudioOpt represents optional params for SendAudio
type SendContactOpt ¶
type SendContactOpt struct {
//
// Contact's last name
//
LastName string `json:"last_name,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendContactOpt represents optional params for SendContact
type SendDocumentOpt ¶
type SendDocumentOpt struct {
//
// Document caption, 0-200 characters
// 0-200 characters
//
Caption string `json:"caption,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendDocumentOpt represents optional params for SendDocument
type SendLocationOpt ¶
type SendLocationOpt struct {
//
// Period in seconds for which the location will be updated (see Live Locations), should be between 60 and 86400.
//
LivePeriod uint `json:"live_period,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendLocationOpt represents optional params for SendLocation
type SendMessageOpt ¶
type SendMessageOpt struct {
//
// 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 ParseModes `json:"parse_mode,omitempty"`
//
// Disables link previews for links in this message
//
DisableWebPreview bool `json:"disable_web_page_preview,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendMessageOpt represents optional params for SendMessage
type SendPhotoOpt ¶
type SendPhotoOpt struct {
//
// Photo caption (may also be used when resending photos by file_id),
// 0-200 characters
//
Caption string `json:"caption,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendPhotoOpt represents optional params for SendPhoto
type SendVenueOpt ¶
type SendVenueOpt struct {
//
// Foursquare identifier of the venue.
//
FoursquareID uint `json:"foursquare_id,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendVenueOpt represents optional params for SendVenue
type SendVideoNoteOpt ¶
type SendVideoNoteOpt struct {
//
// Duration of sent video in seconds
//
Duration uint `json:"duration,omitempty"`
//
// Video length
//
Length uint `json:"width,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendVideoNoteOpt represents optional params for SendVideoNote
type SendVideoOpt ¶
type SendVideoOpt struct {
//
// Video caption (may also be used when resending photos by file_id),
// 0-200 characters
//
Caption string `json:"caption,omitempty"`
//
// Duration of sent video in seconds
//
Duration uint `json:"duration,omitempty"`
//
// Video width
//
Width uint `json:"width,omitempty"`
//
// Video height
//
Height uint `json:"height,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendVideoOpt represents optional params for SendVideo
type SendVoiceOpt ¶
type SendVoiceOpt struct {
//
// Audio caption, 0-200 characters
// 0-200 characters
//
Caption string `json:"caption,omitempty"`
//
// Duration of the audio in seconds
//
Duration uint `json:"duration,omitempty"`
//
// Sends the message silently. Users will receive a notification with no sound.
//
DisableNotification bool `json:"disable_notification,omitempty"`
//
// If the message is a reply, ID of the original message
//
ReplyToID uint64 `json:"reply_to_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
SendVoiceOpt represents optional params for SendVoice
type SetWebhookOpt ¶
type SetWebhookOpt struct {
//
// Upload your public key certificate
// so that the root certificate in use can be checked.
// See our self-signed guide for details.
// https://core.telegram.org/bots/self-signed
//
Certificate *InputFile `json:"certificate,omitempty"`
//
// Maximum allowed number of simultaneous HTTPS connections
// to the webhook for update delivery, 1-100. Defaults to 40.
// Use lower values to limit the load on your bot‘s server,
// and higher values to increase your bot’s throughput.
//
MaxConnections uint `json:"max_connections,omitempty"`
//
// List the types of updates you want your bot to receive.
// For example, specify [“message”, “edited_channel_post”,
// “callback_query”] to only receive updates of these types.
// See Update for a complete list of available update types.
// Specify an empty list to receive all updates regardless
// of type (default). If not specified, the previous setting
// will be used.
//
// Please note that this parameter doesn't affect updates
// created before the call to the setWebhook, so unwanted
// updates may be received for a short period of time.
//
AllowedUpdates []string `json:"allowed_updates,omitempty"`
// contains filtered or unexported fields
}
SetWebhookOpt represents optional params for SetWebhook
type ShippingQuery ¶
type ShippingQuery struct {
}
ShippingQuery is a Telegram API object TODO: implement fields
type StopMessageLiveLocationOpt ¶
type StopMessageLiveLocationOpt struct {
//
// Required if inline_message_id is not specified.
// Unique identifier for the target chat or username of the target channel (in the format @channelusername)
//
ChatID interface{} `json:"chat_id,omitempty"`
//
// Required if inline_message_id is not specified.
// Identifier of the sent message
//
MessageID uint `json:"message_id,omitempty"`
//
// Required if chat_id and message_id are not specified.
// Identifier of the inline message
//
InlineMessageID string `json:"inline_message_id,omitempty"`
//
// Additional interface options. A JSON-serialized object
// for an inline keyboard, custom reply keyboard,
// instructions to remove reply keyboard
// or to force a reply from the user.
//
ReplyMarkup interface{} `json:"reply_markup,omitempty"`
// contains filtered or unexported fields
}
StopMessageLiveLocationOpt represents optional params for StopMessageLiveLocation
type SuccessfulPayment ¶
type SuccessfulPayment struct {
//
// Three-letter ISO 4217 currency code
// https://core.telegram.org/bots/payments#supported-currencies
//
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 https://core.telegram.org/bots/payments/currencies.json
// it shows the number of digits past the decimal point
// for each currency (2 for the majority of currencies,
// and zero for remaining ).
//
TotalAmount int `json:"total_amount"`
//
// Bot specified invoice payload
//
InvoicePayload string `json:"invoice_payload"`
//
// Optional. Identifier of the shipping option chosen by the user
//
ShippingOptionID string `json:"shipping_option_id,omitempty"`
//
// Optional. Order info provided by the user
//
OrderInfo *OrderInfo `json:"order_info,omitempty"`
//
// Telegram payment identifier
//
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
//
// Provider payment identifier
//
ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
}
SuccessfulPayment contains basic information about a successful payment.
type Update ¶
type Update struct {
//
// The update‘s unique identifier. Update identifiers start
// from a certain positive number and increase sequentially.
// This ID becomes especially handy if you’re using Webhooks,
// since it allows you to ignore repeated updates or to restore
// the correct update sequence, should they get out of order.
// If there are no new updates for at least a week, then identifier
// of the next update will be chosen randomly instead of sequentially.
//
ID uint64 `json:"update_id"`
//
// Optional. New incoming message of any kind — text, photo, sticker, etc.
//
Message *Message `json:"message"`
//
// Optional. New version of a message that is known to the bot and was edited
//
EditedMessage *Message `json:"edited_message"`
//
// Optional. New incoming channel post of any kind — text, photo, sticker, etc.
//
ChannelPost *Message `json:"channel_post"`
//
// Optional. New version of a channel post that is known to the bot and was edited
//
EditedChannelPost *Message `json:"edited_channel_post"`
//
// Optional. New incoming inline query
//
InlineQuery *InlineQuery `json:"inline_query"`
//
// Optional. The result of an inline query that was chosen
// by a user and sent to their chat partner. Please see our
// documentation on the feedback collecting for details
// on how to enable these updates for your bot.
//
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"`
//
// Optional. New incoming callback query
//
CallbackQuery *CallbackQuery `json:"callback_query"`
//
// Optional. New incoming shipping query.
// Only for invoices with flexible price
//
ShippingQuery *ShippingQuery `json:"shipping_query"`
//
// Optional. New incoming pre-checkout query.
// Contains full information about checkout
//
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"`
}
Update is a Telegram API object
type User ¶
type User struct {
//
// User‘s or bot’s id
//
ID uint64 `json:"id"`
//
// True for bot
//
IsBot bool `json:"is_bot"`
//
// User‘s or bot’s first name
//
FirstName string `json:"first_name"`
//
// Optional. User‘s or bot’s last name
//
LastName string `json:"last_name"`
//
// Optional. User‘s or bot’s username
//
UserName string `json:"username"`
//
// Optional. IETF language tag of the user's language
//
LanguageCode string `json:"language_code"`
}
User represents a Telegram user or bot.
type Venue ¶
type Venue struct {
//
// Venue location
//
Location *Location `json:"location"`
//
// Name of the venue
//
Title string `json:"title"`
//
// Address of the venue
//
Address string `json:"address"`
//
// Optional. Foursquare identifier of the venue
//
FoursquareID string `json:"foursquare_id,omitempty"`
}
Venue represents a place, meeting point, event point
type Video ¶
type Video struct {
//
// Unique identifier for this file
//
ID string `json:"file_id"`
//
// Video width as defined by sender
//
Width uint `json:"width"`
//
// Video height as defined by sender
//
Height uint `json:"height"`
//
// Duration of the video in seconds as defined by sender
//
Duration uint `json:"duration"`
//
// Optional. Video thumbnail
//
Thumb *PhotoSize `json:"thumb,omitempty"`
//
// Optional. Mime type of a file as defined by sender
//
MIMEType string `json:"mime_type,omitempty"`
//
// Optional. File size
//
FileSize uint `json:"file_size,omitempty"`
}
Video represents a video file.
type VideoNote ¶
type VideoNote struct {
//
// Unique identifier for this file
//
ID string `json:"file_id"`
//
// Video width and height as defined by sender
//
Length uint `json:"length"`
//
// Duration of the video in seconds as defined by sender
//
Duration uint `json:"duration"`
//
// Optional. Video thumbnail
//
Thumb *PhotoSize `json:"thumb,omitempty"`
//
// Optional. File size
//
FileSize uint `json:"file_size,omitempty"`
}
VideoNote represents a video message (available in Telegram apps as of v.4.0).
type Voice ¶
type Voice struct {
//
// Unique identifier for this file
//
ID string `json:"file_id"`
//
// Duration of the audio in seconds as defined by sender
//
Duration uint `json:"duration"`
//
// Optional. MIME type of the file as defined by sender
//
MIMEType string `json:"mime_type,omitempty"`
//
// Optional. File size
//
FileSize uint `json:"file_size,omitempty"`
}
Voice represents a voice note.
Source Files
¶
- api-Inline-keyboard.go
- api-animation.go
- api-audio.go
- api-callback-query.go
- api-chat-photo.go
- api-chat.go
- api-chosen-inline-result.go
- api-contact.go
- api-document.go
- api-force-reply.go
- api-game.go
- api-inline-query.go
- api-input-file.go
- api-invoice.go
- api-location.go
- api-message-entity.go
- api-message.go
- api-order-info.go
- api-photo-size.go
- api-precheckout-query.go
- api-reply-keyboard.go
- api-shipping-query.go
- api-sticker.go
- api-successful-payment.go
- api-update.go
- api-user.go
- api-venue.go
- api-video-note.go
- api-video.go
- api-voice.go
- doc.go
- interface-bot-chat.go
- interface-bot-contacts.go
- interface-bot-location.go
- interface-bot-media.go
- interface-bot-messages.go
- interface-bot-updates.go
- interface-bot.go
- new.go
- wrap-command.go
- wrap-edit-message-live-location.go
- wrap-forward-message.go
- wrap-get-me.go
- wrap-get-updates.go
- wrap-send-audio.go
- wrap-send-chat-action.go
- wrap-send-contact.go
- wrap-send-document.go
- wrap-send-location.go
- wrap-send-message.go
- wrap-send-photo.go
- wrap-send-venue.go
- wrap-send-video-note.go
- wrap-send-video.go
- wrap-send-voice.go
- wrap-set-chat-title.go
- wrap-set-webhook.go
- wrap-stop-message-live-location.go
- wrap-unban-chat-member.go