Documentation ¶
Overview ¶
Package telegram implements telegram api bot for lua.
Index ¶
- Constants
- func DeleteMessage(L *lua.LState) int
- func EditMessageCaption(L *lua.LState) int
- func EditMessageReplyMarkup(L *lua.LState) int
- func EditMessageText(L *lua.LState) int
- func ForwardMessage(L *lua.LState) int
- func GetOffset(L *lua.LState) int
- func GetUpdates(L *lua.LState) int
- func Loader(L *lua.LState) int
- func NewBot(L *lua.LState) int
- func Preload(L *lua.LState)
- func SendMessage(L *lua.LState) int
- func SendPhoto(L *lua.LState) int
- type APIResponse
- type Animation
- type AnimationConfig
- type Audio
- type AudioConfig
- type BaseChat
- type BaseEdit
- type BaseFile
- type CallbackConfig
- type CallbackGame
- type CallbackQuery
- type Chat
- type ChatActionConfig
- type ChatAnimation
- type ChatConfig
- type ChatConfigWithUser
- type ChatMember
- type ChatMemberConfig
- type ChatPhoto
- type Chattable
- type ChosenInlineResult
- type Contact
- type ContactConfig
- type Credentials
- type DataCredentials
- type DeleteChatPhotoConfig
- type DeleteMessageConfig
- type Document
- type DocumentConfig
- type EditMessageCaptionConfig
- type EditMessageReplyMarkupConfig
- type EditMessageTextConfig
- type EncryptedCredentials
- type EncryptedPassportElement
- type Error
- type File
- type FileBytes
- type FileConfig
- type FileCredentials
- type FileReader
- type Fileable
- type ForceReply
- type ForwardConfig
- type Game
- type GameConfig
- type GameHighScore
- type GetGameHighScoresConfig
- type GroupChat
- type IDDocumentData
- type InlineConfig
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type InlineQuery
- type InlineQueryResultArticle
- type InlineQueryResultAudio
- type InlineQueryResultDocument
- type InlineQueryResultGIF
- type InlineQueryResultGame
- type InlineQueryResultLocation
- type InlineQueryResultMPEG4GIF
- type InlineQueryResultPhoto
- type InlineQueryResultVideo
- type InlineQueryResultVoice
- type InputContactMessageContent
- type InputLocationMessageContent
- type InputMediaPhoto
- type InputMediaVideo
- type InputTextMessageContent
- type InputVenueMessageContent
- type Invoice
- type InvoiceConfig
- type KeyboardButton
- type KickChatMemberConfig
- type LabeledPrice
- type Location
- type LocationConfig
- type MediaGroupConfig
- type Message
- type MessageConfig
- type MessageEntity
- type OrderInfo
- type PassportData
- type PassportElementError
- type PassportElementErrorDataField
- type PassportElementErrorFile
- type PassportElementErrorFiles
- type PassportElementErrorFrontSide
- type PassportElementErrorReverseSide
- type PassportElementErrorSelfie
- type PassportFile
- type PassportRequestInfoConfig
- type PassportScope
- type PassportScopeElement
- type PassportScopeElementOne
- type PassportScopeElementOneOfSeveral
- type PersonalDetails
- type PhotoConfig
- type PhotoSize
- type PinChatMessageConfig
- type PreCheckoutConfig
- type PreCheckoutQuery
- type PromoteChatMemberConfig
- type ReplyKeyboardHide
- type ReplyKeyboardMarkup
- type ReplyKeyboardRemove
- type ResponseParameters
- type RestrictChatMemberConfig
- type SecureData
- type SecureValue
- type SetChatDescriptionConfig
- type SetChatPhotoConfig
- type SetChatTitleConfig
- type SetGameScoreConfig
- type ShippingAddress
- type ShippingConfig
- type ShippingOption
- type ShippingQuery
- type Sticker
- type StickerConfig
- type SuccessfulPayment
- type UnpinChatMessageConfig
- type Update
- type UpdateConfig
- type UpdatesChannel
- type User
- type UserProfilePhotos
- type UserProfilePhotosConfig
- type Venue
- type VenueConfig
- type Video
- type VideoConfig
- type VideoNote
- type VideoNoteConfig
- type Voice
- type VoiceConfig
- type WebhookConfig
- type WebhookInfo
Examples ¶
Constants ¶
const ( // APIEndpoint is the endpoint for all API methods, // with formatting for Sprintf. APIEndpoint = "https://api.telegram.org/bot%s/%s" // FileEndpoint is the endpoint for downloading a file from Telegram. FileEndpoint = "https://api.telegram.org/file/bot%s/%s" )
Telegram constants
const ( ChatTyping = "typing" ChatUploadPhoto = "upload_photo" ChatRecordVideo = "record_video" ChatUploadVideo = "upload_video" ChatRecordAudio = "record_audio" ChatUploadAudio = "upload_audio" ChatUploadDocument = "upload_document" ChatFindLocation = "find_location" )
Constant values for ChatActions
const ( ModeMarkdown = "Markdown" ModeHTML = "HTML" )
Constant values for ParseMode in MessageConfig
const ( // ErrBadFileType happens when you pass an unknown type ErrBadFileType = "bad file type" ErrBadURL = "bad or empty url" )
Library errors
const (
// ErrAPIForbidden happens when a token is bad
ErrAPIForbidden = "forbidden"
)
API errors
Variables ¶
This section is empty.
Functions ¶
func DeleteMessage ¶
EditMessageReplyMarkup lua telegram_bot_ud:deleteMessage(table) returns (bool, err)
Example ¶
example deleteMessage: https://core.telegram.org/bots/api#deletemessage
package main import ( "log" telegram "github.com/vadv/gopher-lua-libs/telegram" lua "github.com/yuin/gopher-lua" ) func main() { state := lua.NewState() telegram.Preload(state) source := ` local bot = telegram.bot("token") bot:forwardMessage({ chat_id = number, -- Unique identifier for the target chat message_id = number, -- Message identifier in the chat specified in from_chat_id }) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) } }
Output:
func EditMessageCaption ¶
EditMessageCaption lua telegram_bot_ud:editMessageCaption(table) returns (bool, err)
func EditMessageReplyMarkup ¶
EditMessageReplyMarkup lua telegram_bot_ud:editMessageReplyMarkup(table) returns (bool, err)
func EditMessageText ¶
EditMessageText lua telegram_bot_ud:editMessageText(table) returns (bool, err)
func ForwardMessage ¶
ForwardMessage lua telegram_bot_ud:forward(table) returns (table, err)
Example ¶
example forwardMessage: https://core.telegram.org/bots/api#forwardmessage
package main import ( "log" telegram "github.com/vadv/gopher-lua-libs/telegram" lua "github.com/yuin/gopher-lua" ) func main() { state := lua.NewState() telegram.Preload(state) source := ` local bot = telegram.bot("token") bot:forwardMessage({ chat_id = number, -- Unique identifier for the target chat chat_id or username = "", -- Username of the target channel (in the format @channelusername) from_chat_id = number, -- Unique identifier for the chat where the original message was sent disable_notification = false|true, -- Sends the message silently. Users will receive a notification with no sound. message_id = number, -- Message identifier in the chat specified in from_chat_id }) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) } }
Output:
func GetUpdates ¶
GetUpdates lua telegram_bot_ud:get_updates() returns (table, err)
Example ¶
example getUpdates: https://core.telegram.org/bots/api#getupdates
package main import ( "log" telegram "github.com/vadv/gopher-lua-libs/telegram" lua "github.com/yuin/gopher-lua" ) func main() { state := lua.NewState() telegram.Preload(state) source := ` local bot = telegram.bot("token") local updates, err = bot:getUpdates() -- auto offset for _, update in pairs(updates) do inspect(update) -- https://core.telegram.org/bots/api#message end ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) } }
Output:
func Preload ¶
Preload adds telegram to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:
local telegram = require("telegram")
func SendMessage ¶
SendMessage lua telegram_bot_ud:message(table) returns (table, err)
Example ¶
example sendMessage: https://core.telegram.org/bots/api#sendmessage
package main import ( "log" http "github.com/vadv/gopher-lua-libs/http" inspect "github.com/vadv/gopher-lua-libs/inspect" telegram "github.com/vadv/gopher-lua-libs/telegram" lua "github.com/yuin/gopher-lua" ) func main() { state := lua.NewState() telegram.Preload(state) http.Preload(state) inspect.Preload(state) source := ` local bot = telegram.bot("token") bot:sendMessage({ chat_id = number, -- Unique identifier for the target chat chat_id or username = "", -- Username of the target channel (in the format @channelusername) text = "", -- Text of the message to be sent parse_mode = "markdown|html", -- Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. disable_web_page_preview = false|true, -- Disables link previews for links in this message disable_notification = false|true, -- Sends the message silently. Users will receive a notification with no sound. reply_to_message_id = nil|number, -- If the message is a reply, ID of the original message reply_markup = nil | table, -- https://core.telegram.org/bots/api#inlinekeyboardmarkup, https://core.telegram.org/bots/api#replykeyboardmarkup, https://core.telegram.org/bots/api#replykeyboardremove, https://core.telegram.org/bots/api#forcereply }) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) } }
Output:
func SendPhoto ¶
SendPhoto lua telegram_bot_ud:photo(table) returns (table, err)
Example ¶
example sendPhoto: https://core.telegram.org/bots/api#sendphoto
package main import ( "log" telegram "github.com/vadv/gopher-lua-libs/telegram" lua "github.com/yuin/gopher-lua" ) func main() { state := lua.NewState() telegram.Preload(state) source := ` local bot = telegram.bot("token") bot:sendPhoto({ chat_id = number, -- Unique identifier for the target chat chat_id or username = "", -- Username of the target channel (in the format @channelusername) photo = "path/to/filename|inputfile", -- 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. https://core.telegram.org/bots/api#inputfile caption = "", -- Photo caption (may also be used when resending photos by file_id), 0-1024 characters parse_mode = "markdown|html", -- Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. disable_notification = false|true, -- Sends the message silently. Users will receive a notification with no sound. reply_to_message_id = nil|number, -- If the message is a reply, ID of the original message reply_markup = nil | table, -- https://core.telegram.org/bots/api#inlinekeyboardmarkup, https://core.telegram.org/bots/api#replykeyboardmarkup, https://core.telegram.org/bots/api#replykeyboardremove, https://core.telegram.org/bots/api#forcereply }) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) } }
Output:
Types ¶
type APIResponse ¶
type APIResponse struct { Ok bool `json:"ok"` Result json.RawMessage `json:"result"` ErrorCode int `json:"error_code"` Description string `json:"description"` Parameters *ResponseParameters `json:"parameters"` }
APIResponse is a response from the Telegram API with the result stored raw.
type Animation ¶
type Animation struct { FileID string `json:"file_id"` Thumb PhotoSize `json:"thumb"` FileName string `json:"file_name"` MimeType string `json:"mime_type"` FileSize int `json:"file_size"` }
Animation is a GIF animation demonstrating the game.
type AnimationConfig ¶
type AnimationConfig struct { BaseFile Duration int `json:"duration"` Caption string `json:"caption"` ParseMode string `json:"parse_mode"` }
AnimationConfig contains information about a SendAnimation request.
type Audio ¶
type Audio struct { FileID string `json:"file_id"` Duration int `json:"duration"` Performer string `json:"performer"` // optional Title string `json:"title"` // optional MimeType string `json:"mime_type"` // optional FileSize int `json:"file_size"` // optional }
Audio contains information about audio.
type AudioConfig ¶
type AudioConfig struct { BaseFile Caption string `json:"caption"` ParseMode string `json:"parse_mode"` Duration int `json:"duration"` Performer string `json:"performer"` Title string `json:"title"` }
AudioConfig contains information about a SendAudio request.
type BaseChat ¶
type BaseChat struct { ChatID int64 `json:"chat_id"` UserName string `json:"username"` ReplyToMessageID int `json:"reply_to_message_id,omitempty"` ReplyMarkup interface{} `json:"reply_markup,omitempty"` DisableNotification bool `json:"disable_notification"` }
BaseChat is base type for all chat config types.
type BaseEdit ¶
type BaseEdit struct { ChatID int64 `json:"chat_id"` ChannelUsername string `json:"username"` MessageID int `json:"message_id"` InlineMessageID string `json:"inline_message_id"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup"` }
BaseEdit is base type of all chat edits.
type BaseFile ¶
type BaseFile struct { BaseChat File interface{} `json:"photo,omitempty"` FileID string `json:"file_id,omitempty"` UseExisting bool MimeType string `json:"mime_type,omitempty"` FileSize int `json:"file_size,omitempty"` }
BaseFile is a base type for all file config types.
type CallbackConfig ¶
type CallbackConfig struct { CallbackQueryID string `json:"callback_query_id"` Text string `json:"text"` ShowAlert bool `json:"show_alert"` URL string `json:"url"` CacheTime int `json:"cache_time"` }
CallbackConfig contains information on making a CallbackQuery response.
type CallbackGame ¶
type CallbackGame struct{}
CallbackGame is for starting a game in an inline keyboard button.
type CallbackQuery ¶
type CallbackQuery struct { ID string `json:"id"` From *User `json:"from"` Message *Message `json:"message"` // optional InlineMessageID string `json:"inline_message_id"` // optional ChatInstance string `json:"chat_instance"` Data string `json:"data"` // optional GameShortName string `json:"game_short_name"` // optional }
CallbackQuery is data sent when a keyboard button with callback data is clicked.
type Chat ¶
type Chat struct { ID int64 `json:"id"` Type string `json:"type"` Title string `json:"title"` // optional UserName string `json:"username"` // optional FirstName string `json:"first_name"` // optional LastName string `json:"last_name"` // optional AllMembersAreAdmins bool `json:"all_members_are_administrators"` // optional Photo *ChatPhoto `json:"photo"` Description string `json:"description,omitempty"` // optional InviteLink string `json:"invite_link,omitempty"` // optional }
Chat contains information about the place a message was sent.
func (Chat) ChatConfig ¶
func (c Chat) ChatConfig() ChatConfig
ChatConfig returns a ChatConfig struct for chat related methods.
func (Chat) IsSuperGroup ¶
IsSuperGroup returns if the Chat is a supergroup.
type ChatActionConfig ¶
ChatActionConfig contains information about a SendChatAction request.
type ChatAnimation ¶
type ChatAnimation struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration"` Thumbnail *PhotoSize `json:"thumb"` // optional FileName string `json:"file_name"` // optional MimeType string `json:"mime_type"` // optional FileSize int `json:"file_size"` // optional }
ChatAnimation contains information about an animation.
type ChatConfig ¶
ChatConfig contains information about getting information on a chat.
type ChatConfigWithUser ¶
ChatConfigWithUser contains information about getting information on a specific user within a chat.
type ChatMember ¶
type ChatMember struct { User *User `json:"user"` Status string `json:"status"` UntilDate int64 `json:"until_date,omitempty"` // optional CanBeEdited bool `json:"can_be_edited,omitempty"` // optional CanChangeInfo bool `json:"can_change_info,omitempty"` // optional CanPostMessages bool `json:"can_post_messages,omitempty"` // optional CanEditMessages bool `json:"can_edit_messages,omitempty"` // optional CanDeleteMessages bool `json:"can_delete_messages,omitempty"` // optional CanInviteUsers bool `json:"can_invite_users,omitempty"` // optional CanRestrictMembers bool `json:"can_restrict_members,omitempty"` // optional CanPinMessages bool `json:"can_pin_messages,omitempty"` // optional CanPromoteMembers bool `json:"can_promote_members,omitempty"` // optional CanSendMessages bool `json:"can_send_messages,omitempty"` // optional CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"` // optional CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"` // optional CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` // optional }
ChatMember is information about a member in a chat.
func (ChatMember) HasLeft ¶
func (chat ChatMember) HasLeft() bool
HasLeft returns if the ChatMember left the chat.
func (ChatMember) IsAdministrator ¶
func (chat ChatMember) IsAdministrator() bool
IsAdministrator returns if the ChatMember is a chat administrator.
func (ChatMember) IsCreator ¶
func (chat ChatMember) IsCreator() bool
IsCreator returns if the ChatMember was the creator of the chat.
func (ChatMember) IsMember ¶
func (chat ChatMember) IsMember() bool
IsMember returns if the ChatMember is a current member of the chat.
func (ChatMember) WasKicked ¶
func (chat ChatMember) WasKicked() bool
WasKicked returns if the ChatMember was kicked from the chat.
type ChatMemberConfig ¶
type ChatMemberConfig struct { ChatID int64 SuperGroupUsername string ChannelUsername string UserID int }
ChatMemberConfig contains information about a user in a chat for use with administrative functions such as kicking or unbanning a user.
type ChatPhoto ¶
type ChatPhoto struct { SmallFileID string `json:"small_file_id"` BigFileID string `json:"big_file_id"` }
ChatPhoto represents a chat photo.
type Chattable ¶
type Chattable interface {
// contains filtered or unexported methods
}
Chattable is any config type that can be sent.
type ChosenInlineResult ¶
type ChosenInlineResult struct { ResultID string `json:"result_id"` From *User `json:"from"` Location *Location `json:"location"` InlineMessageID string `json:"inline_message_id"` Query string `json:"query"` }
ChosenInlineResult is an inline query result chosen by a User
type Contact ¶
type Contact struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name"` // optional UserID int `json:"user_id"` // optional }
Contact contains information about a contact.
Note that LastName and UserID may be empty.
type ContactConfig ¶
type ContactConfig struct { BaseChat PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name"` }
ContactConfig allows you to send a contact.
type Credentials ¶
type Credentials struct { Data SecureData `json:"secure_data"` // Nonce the same nonce given in the request Nonce string `json:"nonce"` }
Credentials contains encrypted data.
type DataCredentials ¶
type DataCredentials struct { // DataHash checksum of encrypted data DataHash string `json:"data_hash"` // Secret of encrypted data Secret string `json:"secret"` }
DataCredentials contains information required to decrypt data.
type DeleteChatPhotoConfig ¶
type DeleteChatPhotoConfig struct {
ChatID int64
}
DeleteChatPhotoConfig contains information for delete chat photo.
type DeleteMessageConfig ¶
DeleteMessageConfig contains information of a message in a chat to delete.
type Document ¶
type Document struct { FileID string `json:"file_id"` Thumbnail *PhotoSize `json:"thumb"` // optional FileName string `json:"file_name"` // optional MimeType string `json:"mime_type"` // optional FileSize int `json:"file_size"` // optional }
Document contains information about a document.
type DocumentConfig ¶
type DocumentConfig struct { BaseFile Caption string `json:"caption"` ParseMode string `json:"parse_mode"` }
DocumentConfig contains information about a SendDocument request.
type EditMessageCaptionConfig ¶
type EditMessageCaptionConfig struct { BaseEdit Caption string `json:"caption"` ParseMode string `json:"parse_mode"` }
EditMessageCaptionConfig allows you to modify the caption of a message.
type EditMessageReplyMarkupConfig ¶
type EditMessageReplyMarkupConfig struct {
BaseEdit
}
EditMessageReplyMarkupConfig allows you to modify the reply markup of a message.
type EditMessageTextConfig ¶
type EditMessageTextConfig struct { BaseEdit Text string `json:"text"` ParseMode string `json:"parse_mode"` DisableWebPagePreview bool `json:"disable_web_page_preview"` }
EditMessageTextConfig allows you to modify the text in a message.
type EncryptedCredentials ¶
type 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"` }
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.
type EncryptedPassportElement ¶
type 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"` }
EncryptedPassportElement contains information about documents or other Telegram Passport elements shared with the bot by the user.
type Error ¶
type Error struct { Message string ResponseParameters }
Error is an error containing extra information returned by the Telegram API.
type File ¶
type File struct { FileID string `json:"file_id"` FileSize int `json:"file_size"` // optional FilePath string `json:"file_path"` // optional }
File contains information about a file to download from Telegram.
type FileConfig ¶
type FileConfig struct {
FileID string
}
FileConfig has information about a file hosted on Telegram.
type FileCredentials ¶
type FileCredentials struct { // FileHash checksum of encrypted data FileHash string `json:"file_hash"` // Secret of encrypted data Secret string `json:"secret"` }
FileCredentials contains information required to decrypt files.
type FileReader ¶
FileReader contains information about a reader to upload as a File. If Size is -1, it will read the entire Reader into memory to calculate a Size.
type Fileable ¶
type Fileable interface { Chattable // contains filtered or unexported methods }
Fileable is any config type that can be sent that includes a file.
type ForceReply ¶
type ForceReply struct { ForceReply bool `json:"force_reply"` Selective bool `json:"selective"` // optional }
ForceReply allows the Bot to have users directly reply to it without additional interaction.
type ForwardConfig ¶
type ForwardConfig struct { BaseChat FromChatID int64 `json:"from_chat_id"` // required FromChannelUsername string MessageID int `json:"message_id"` // required }
ForwardConfig contains information about a ForwardMessage request.
type Game ¶
type Game struct { Title string `json:"title"` Description string `json:"description"` Photo []PhotoSize `json:"photo"` Text string `json:"text"` TextEntities []MessageEntity `json:"text_entities"` Animation Animation `json:"animation"` }
Game is a game within Telegram.
type GameConfig ¶
GameConfig allows you to send a game.
type GameHighScore ¶
type GameHighScore struct { Position int `json:"position"` User User `json:"user"` Score int `json:"score"` }
GameHighScore is a user's score and position on the leaderboard.
type GetGameHighScoresConfig ¶
type GetGameHighScoresConfig struct { UserID int ChatID int ChannelUsername string MessageID int InlineMessageID string }
GetGameHighScoresConfig allows you to fetch the high scores for a game.
type IDDocumentData ¶
type IDDocumentData struct { DocumentNumber string `json:"document_no"` ExpiryDate string `json:"expiry_date"` }
IDDocumentData https://core.telegram.org/passport#iddocumentdata
type InlineConfig ¶
type InlineConfig struct { InlineQueryID string `json:"inline_query_id"` Results []interface{} `json:"results"` CacheTime int `json:"cache_time"` IsPersonal bool `json:"is_personal"` NextOffset string `json:"next_offset"` SwitchPMText string `json:"switch_pm_text"` SwitchPMParameter string `json:"switch_pm_parameter"` }
InlineConfig contains information on making an InlineQuery response.
type InlineKeyboardButton ¶
type InlineKeyboardButton struct { Text string `json:"text"` URL *string `json:"url,omitempty"` // optional CallbackData *string `json:"callback_data,omitempty"` // optional SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` // optional SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` // optional CallbackGame *CallbackGame `json:"callback_game,omitempty"` // optional Pay bool `json:"pay,omitempty"` // optional }
InlineKeyboardButton is a button within a custom keyboard for inline query responses.
Note that some values are references as even an empty string will change behavior.
CallbackGame, if set, MUST be first button in first row.
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
InlineKeyboardMarkup is a custom keyboard presented for an inline bot.
type InlineQuery ¶
type InlineQuery struct { ID string `json:"id"` From *User `json:"from"` Location *Location `json:"location"` // optional Query string `json:"query"` Offset string `json:"offset"` }
InlineQuery is a Query from Telegram for an inline request.
type InlineQueryResultArticle ¶
type InlineQueryResultArticle struct { Type string `json:"type"` // required ID string `json:"id"` // required Title string `json:"title"` // required InputMessageContent interface{} `json:"input_message_content,omitempty"` // required ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` URL string `json:"url"` HideURL bool `json:"hide_url"` Description string `json:"description"` ThumbURL string `json:"thumb_url"` ThumbWidth int `json:"thumb_width"` ThumbHeight int `json:"thumb_height"` }
InlineQueryResultArticle is an inline query response article.
type InlineQueryResultAudio ¶
type InlineQueryResultAudio struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"audio_url"` // required Title string `json:"title"` // required Caption string `json:"caption"` Performer string `json:"performer"` Duration int `json:"audio_duration"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultAudio is an inline query response audio.
type InlineQueryResultDocument ¶
type InlineQueryResultDocument struct { Type string `json:"type"` // required ID string `json:"id"` // required Title string `json:"title"` // required Caption string `json:"caption"` URL string `json:"document_url"` // required MimeType string `json:"mime_type"` // required Description string `json:"description"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` ThumbURL string `json:"thumb_url"` ThumbWidth int `json:"thumb_width"` ThumbHeight int `json:"thumb_height"` }
InlineQueryResultDocument is an inline query response document.
type InlineQueryResultGIF ¶
type InlineQueryResultGIF struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"gif_url"` // required Width int `json:"gif_width"` Height int `json:"gif_height"` Duration int `json:"gif_duration"` ThumbURL string `json:"thumb_url"` Title string `json:"title"` Caption string `json:"caption"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultGIF is an inline query response GIF.
type InlineQueryResultGame ¶
type InlineQueryResultGame struct { Type string `json:"type"` ID string `json:"id"` GameShortName string `json:"game_short_name"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
InlineQueryResultGame is an inline query response game.
type InlineQueryResultLocation ¶
type InlineQueryResultLocation struct { Type string `json:"type"` // required ID string `json:"id"` // required Latitude float64 `json:"latitude"` // required Longitude float64 `json:"longitude"` // required Title string `json:"title"` // required ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` ThumbURL string `json:"thumb_url"` ThumbWidth int `json:"thumb_width"` ThumbHeight int `json:"thumb_height"` }
InlineQueryResultLocation is an inline query response location.
type InlineQueryResultMPEG4GIF ¶
type InlineQueryResultMPEG4GIF struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"mpeg4_url"` // required Width int `json:"mpeg4_width"` Height int `json:"mpeg4_height"` Duration int `json:"mpeg4_duration"` ThumbURL string `json:"thumb_url"` Title string `json:"title"` Caption string `json:"caption"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
type InlineQueryResultPhoto ¶
type InlineQueryResultPhoto struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"photo_url"` // required MimeType string `json:"mime_type"` Width int `json:"photo_width"` Height int `json:"photo_height"` ThumbURL string `json:"thumb_url"` Title string `json:"title"` Description string `json:"description"` Caption string `json:"caption"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultPhoto is an inline query response photo.
type InlineQueryResultVideo ¶
type InlineQueryResultVideo struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"video_url"` // required MimeType string `json:"mime_type"` // required ThumbURL string `json:"thumb_url"` Title string `json:"title"` Caption string `json:"caption"` Width int `json:"video_width"` Height int `json:"video_height"` Duration int `json:"video_duration"` Description string `json:"description"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultVideo is an inline query response video.
type InlineQueryResultVoice ¶
type InlineQueryResultVoice struct { Type string `json:"type"` // required ID string `json:"id"` // required URL string `json:"voice_url"` // required Title string `json:"title"` // required Caption string `json:"caption"` Duration int `json:"voice_duration"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultVoice is an inline query response voice.
type InputContactMessageContent ¶
type InputContactMessageContent struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name"` }
InputContactMessageContent contains a contact for displaying as an inline query result.
type InputLocationMessageContent ¶
type InputLocationMessageContent struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` }
InputLocationMessageContent contains a location for displaying as an inline query result.
type InputMediaPhoto ¶
type InputMediaPhoto struct { Type string `json:"type"` Media string `json:"media"` Caption string `json:"caption"` ParseMode string `json:"parse_mode"` }
InputMediaPhoto contains a photo for displaying as part of a media group.
type InputMediaVideo ¶
type InputMediaVideo struct { Type string `json:"type"` Media string `json:"media"` // thumb intentionally missing as it is not currently compatible Caption string `json:"caption"` ParseMode string `json:"parse_mode"` Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration"` SupportsStreaming bool `json:"supports_streaming"` }
InputMediaVideo contains a video for displaying as part of a media group.
type InputTextMessageContent ¶
type InputTextMessageContent struct { Text string `json:"message_text"` ParseMode string `json:"parse_mode"` DisableWebPagePreview bool `json:"disable_web_page_preview"` }
InputTextMessageContent contains text for displaying as an inline query result.
type InputVenueMessageContent ¶
type InputVenueMessageContent struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id"` }
InputVenueMessageContent contains a venue for displaying as an inline query result.
type Invoice ¶
type Invoice struct { Title string `json:"title"` Description string `json:"description"` StartParameter string `json:"start_parameter"` Currency string `json:"currency"` TotalAmount int `json:"total_amount"` }
Invoice contains basic information about an invoice.
type InvoiceConfig ¶
type InvoiceConfig struct { BaseChat Title string // required Description string // required Payload string // required ProviderToken string // required StartParameter string // required Currency string // required Prices *[]LabeledPrice // required PhotoURL string PhotoSize int PhotoWidth int PhotoHeight int NeedName bool NeedPhoneNumber bool NeedEmail bool NeedShippingAddress bool IsFlexible bool }
InvoiceConfig contains information for sendInvoice request.
type KeyboardButton ¶
type KeyboardButton struct { Text string `json:"text"` RequestContact bool `json:"request_contact"` RequestLocation bool `json:"request_location"` }
KeyboardButton is a button within a custom keyboard.
type KickChatMemberConfig ¶
type KickChatMemberConfig struct { ChatMemberConfig UntilDate int64 }
KickChatMemberConfig contains extra fields to kick user
type LabeledPrice ¶
LabeledPrice represents a portion of the price for goods or services.
type LocationConfig ¶
LocationConfig contains information about a SendLocation request.
type MediaGroupConfig ¶
type MediaGroupConfig struct { BaseChat InputMedia []interface{} }
MediaGroupConfig contains information about a sendMediaGroup request.
type Message ¶
type Message struct { MessageID int `json:"message_id"` From *User `json:"from"` // optional Date int `json:"date"` Chat *Chat `json:"chat"` ForwardFrom *User `json:"forward_from"` // optional ForwardFromChat *Chat `json:"forward_from_chat"` // optional ForwardFromMessageID int `json:"forward_from_message_id"` // optional ForwardDate int `json:"forward_date"` // optional ReplyToMessage *Message `json:"reply_to_message"` // optional EditDate int `json:"edit_date"` // optional Text string `json:"text"` // optional Entities *[]MessageEntity `json:"entities"` // optional Audio *Audio `json:"audio"` // optional Document *Document `json:"document"` // optional Animation *ChatAnimation `json:"animation"` // optional Game *Game `json:"game"` // optional Photo *[]PhotoSize `json:"photo"` // optional Sticker *Sticker `json:"sticker"` // optional Video *Video `json:"video"` // optional VideoNote *VideoNote `json:"video_note"` // optional Voice *Voice `json:"voice"` // optional Caption string `json:"caption"` // optional Contact *Contact `json:"contact"` // optional Location *Location `json:"location"` // optional Venue *Venue `json:"venue"` // optional NewChatMembers *[]User `json:"new_chat_members"` // optional LeftChatMember *User `json:"left_chat_member"` // optional NewChatTitle string `json:"new_chat_title"` // optional NewChatPhoto *[]PhotoSize `json:"new_chat_photo"` // optional DeleteChatPhoto bool `json:"delete_chat_photo"` // optional GroupChatCreated bool `json:"group_chat_created"` // optional SuperGroupChatCreated bool `json:"supergroup_chat_created"` // optional ChannelChatCreated bool `json:"channel_chat_created"` // optional MigrateToChatID int64 `json:"migrate_to_chat_id"` // optional MigrateFromChatID int64 `json:"migrate_from_chat_id"` // optional PinnedMessage *Message `json:"pinned_message"` // optional Invoice *Invoice `json:"invoice"` // optional SuccessfulPayment *SuccessfulPayment `json:"successful_payment"` // optional PassportData *PassportData `json:"passport_data,omitempty"` // optional }
Message is returned by almost every request, and contains data about almost anything.
func (*Message) Command ¶
Command checks if the message was a command and if it was, returns the command. If the Message was not a command, it returns an empty string.
If the command contains the at name syntax, it is removed. Use CommandWithAt() if you do not want that.
func (*Message) CommandArguments ¶
CommandArguments checks if the message was a command and if it was, returns all text after the command name. If the Message was not a command, it returns an empty string.
Note: The first character after the command name is omitted: - "/foo bar baz" yields "bar baz", not " bar baz" - "/foo-bar baz" yields "bar baz", too Even though the latter is not a command conforming to the spec, the API marks "/foo" as command entity.
func (*Message) CommandWithAt ¶
CommandWithAt checks if the message was a command and if it was, returns the command. If the Message was not a command, it returns an empty string.
If the command contains the at name syntax, it is not removed. Use Command() if you want that.
type MessageConfig ¶
type MessageConfig struct { BaseChat Text string `json:"text"` ParseMode string `json:"parse_mode"` DisableWebPagePreview bool `json:"disable_web_page_preview"` }
MessageConfig contains information about a SendMessage request.
type MessageEntity ¶
type MessageEntity struct { Type string `json:"type"` Offset int `json:"offset"` Length int `json:"length"` URL string `json:"url"` // optional User *User `json:"user"` // optional }
MessageEntity contains information about data in a Message.
type OrderInfo ¶
type OrderInfo struct { Name string `json:"name,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` Email string `json:"email,omitempty"` ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"` }
OrderInfo represents information about an order.
type PassportData ¶
type 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"` }
PassportData contains information about Telegram Passport data shared with the bot by the user.
type PassportElementError ¶
type PassportElementError interface{}
PassportElementError represents an error in the Telegram Passport element which was submitted that should be resolved by the user.
type PassportElementErrorDataField ¶
type 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"` }
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.
type PassportElementErrorFile ¶
type 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"` }
PassportElementErrorFile represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
type PassportElementErrorFiles ¶
type 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"` }
PassportElementErrorFiles represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
type PassportElementErrorFrontSide ¶
type 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"` }
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.
type PassportElementErrorReverseSide ¶
type 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"` }
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.
type PassportElementErrorSelfie ¶
type 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"` }
PassportElementErrorSelfie represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
type PassportFile ¶
type 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"` }
PassportFile represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
type PassportRequestInfoConfig ¶
type PassportRequestInfoConfig struct { BotID int `json:"bot_id"` Scope *PassportScope `json:"scope"` Nonce string `json:"nonce"` PublicKey string `json:"public_key"` }
PassportRequestInfoConfig allows you to request passport info
type PassportScope ¶
type PassportScope struct { V int `json:"v"` Data []PassportScopeElement `json:"data"` }
PassportScope is the requested scopes of data.
type PassportScopeElement ¶
type PassportScopeElement interface {
ScopeType() string
}
PassportScopeElement supports using one or one of several elements.
type PassportScopeElementOne ¶
type PassportScopeElementOne struct { Type string `json:"type"` // One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email” Selfie bool `json:"selfie"` Translation bool `json:"translation"` NativeNames bool `json:"native_name"` }
PassportScopeElementOne requires the specified element be provided.
func (*PassportScopeElementOne) ScopeType ¶
func (eo *PassportScopeElementOne) ScopeType() string
ScopeType is the scope type.
type PassportScopeElementOneOfSeveral ¶
type PassportScopeElementOneOfSeveral struct { }
PassportScopeElementOneOfSeveral allows you to request any one of the requested documents.
func (*PassportScopeElementOneOfSeveral) ScopeType ¶
func (eo *PassportScopeElementOneOfSeveral) ScopeType() string
ScopeType is the scope type.
type PersonalDetails ¶
type PersonalDetails struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` MiddleName string `json:"middle_name"` BirthDate string `json:"birth_date"` Gender string `json:"gender"` CountryCode string `json:"country_code"` ResidenceCountryCode string `json:"residence_country_code"` FirstNameNative string `json:"first_name_native"` LastNameNative string `json:"last_name_native"` MiddleNameNative string `json:"middle_name_native"` }
PersonalDetails https://core.telegram.org/passport#personaldetails
type PhotoConfig ¶
type PhotoConfig struct { BaseFile Caption string `json:"caption"` ParseMode string `json:"parse_mode"` }
PhotoConfig contains information about a SendPhoto request.
type PhotoSize ¶
type PhotoSize struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` FileSize int `json:"file_size"` // optional }
PhotoSize contains information about photos.
type PinChatMessageConfig ¶
PinChatMessageConfig contains information of a message in a chat to pin.
type PreCheckoutConfig ¶
type PreCheckoutConfig struct { PreCheckoutQueryID string // required OK bool // required ErrorMessage string }
PreCheckoutConfig contains information for answerPreCheckoutQuery request.
type PreCheckoutQuery ¶
type PreCheckoutQuery struct { ID string `json:"id"` From *User `json:"from"` Currency string `json:"currency"` TotalAmount int `json:"total_amount"` InvoicePayload string `json:"invoice_payload"` ShippingOptionID string `json:"shipping_option_id,omitempty"` OrderInfo *OrderInfo `json:"order_info,omitempty"` }
PreCheckoutQuery contains information about an incoming pre-checkout query.
type PromoteChatMemberConfig ¶
type PromoteChatMemberConfig struct { ChatMemberConfig CanChangeInfo *bool CanPostMessages *bool CanEditMessages *bool CanDeleteMessages *bool CanInviteUsers *bool CanRestrictMembers *bool CanPinMessages *bool CanPromoteMembers *bool }
PromoteChatMemberConfig contains fields to promote members of chat
type ReplyKeyboardHide ¶
type ReplyKeyboardHide struct { HideKeyboard bool `json:"hide_keyboard"` Selective bool `json:"selective"` // optional }
ReplyKeyboardHide allows the Bot to hide a custom keyboard.
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct { Keyboard [][]KeyboardButton `json:"keyboard"` ResizeKeyboard bool `json:"resize_keyboard"` // optional OneTimeKeyboard bool `json:"one_time_keyboard"` // optional Selective bool `json:"selective"` // optional }
ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
type ReplyKeyboardRemove ¶
type ReplyKeyboardRemove struct { RemoveKeyboard bool `json:"remove_keyboard"` Selective bool `json:"selective"` }
ReplyKeyboardRemove allows the Bot to hide a custom keyboard.
type ResponseParameters ¶
type ResponseParameters struct { MigrateToChatID int64 `json:"migrate_to_chat_id"` // optional RetryAfter int `json:"retry_after"` // optional }
ResponseParameters are various errors that can be returned in APIResponse.
type RestrictChatMemberConfig ¶
type RestrictChatMemberConfig struct { ChatMemberConfig UntilDate int64 CanSendMessages *bool CanSendMediaMessages *bool CanSendOtherMessages *bool CanAddWebPagePreviews *bool }
RestrictChatMemberConfig contains fields to restrict members of chat
type SecureData ¶
type SecureData map[string]*SecureValue
SecureData is a map of the fields and their encrypted values.
type SecureValue ¶
type SecureValue struct { Data *DataCredentials `json:"data"` FrontSide *FileCredentials `json:"front_side"` ReverseSide *FileCredentials `json:"reverse_side"` Selfie *FileCredentials `json:"selfie"` Translation []*FileCredentials `json:"translation"` Files []*FileCredentials `json:"files"` }
SecureValue contains encrypted values for a SecureData item.
type SetChatDescriptionConfig ¶
SetChatDescriptionConfig contains information for change chat description.
type SetChatPhotoConfig ¶
type SetChatPhotoConfig struct {
BaseFile
}
SetChatPhotoConfig contains information for change chat photo
type SetChatTitleConfig ¶
SetChatTitleConfig contains information for change chat title.
type SetGameScoreConfig ¶
type SetGameScoreConfig struct { UserID int Score int Force bool DisableEditMessage bool ChatID int64 ChannelUsername string MessageID int InlineMessageID string }
SetGameScoreConfig allows you to update the game score in a chat.
type ShippingAddress ¶
type ShippingAddress struct { CountryCode string `json:"country_code"` State string `json:"state"` City string `json:"city"` StreetLine1 string `json:"street_line1"` StreetLine2 string `json:"street_line2"` PostCode string `json:"post_code"` }
ShippingAddress represents a shipping address.
type ShippingConfig ¶
type ShippingConfig struct { ShippingQueryID string // required OK bool // required ShippingOptions *[]ShippingOption ErrorMessage string }
ShippingConfig contains information for answerShippingQuery request.
type ShippingOption ¶
type ShippingOption struct { ID string `json:"id"` Title string `json:"title"` Prices *[]LabeledPrice `json:"prices"` }
ShippingOption represents one shipping option.
type ShippingQuery ¶
type ShippingQuery struct { ID string `json:"id"` From *User `json:"from"` InvoicePayload string `json:"invoice_payload"` ShippingAddress *ShippingAddress `json:"shipping_address"` }
ShippingQuery contains information about an incoming shipping query.
type Sticker ¶
type Sticker struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Thumbnail *PhotoSize `json:"thumb"` // optional Emoji string `json:"emoji"` // optional FileSize int `json:"file_size"` // optional SetName string `json:"set_name"` // optional }
Sticker contains information about a sticker.
type StickerConfig ¶
type StickerConfig struct {
BaseFile
}
StickerConfig contains information about a SendSticker request.
type SuccessfulPayment ¶
type SuccessfulPayment struct { Currency string `json:"currency"` TotalAmount int `json:"total_amount"` InvoicePayload string `json:"invoice_payload"` ShippingOptionID string `json:"shipping_option_id,omitempty"` OrderInfo *OrderInfo `json:"order_info,omitempty"` TelegramPaymentChargeID string `json:"telegram_payment_charge_id"` ProviderPaymentChargeID string `json:"provider_payment_charge_id"` }
SuccessfulPayment contains basic information about a successful payment.
type UnpinChatMessageConfig ¶
type UnpinChatMessageConfig struct {
ChatID int64
}
UnpinChatMessageConfig contains information of chat to unpin.
type Update ¶
type Update struct { UpdateID int `json:"update_id"` Message *Message `json:"message"` EditedMessage *Message `json:"edited_message"` ChannelPost *Message `json:"channel_post"` EditedChannelPost *Message `json:"edited_channel_post"` InlineQuery *InlineQuery `json:"inline_query"` ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"` CallbackQuery *CallbackQuery `json:"callback_query"` ShippingQuery *ShippingQuery `json:"shipping_query"` PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"` }
Update is an update response, from GetUpdates.
type UpdateConfig ¶
UpdateConfig contains information about a GetUpdates request.
type UpdatesChannel ¶
type UpdatesChannel <-chan Update
UpdatesChannel is the channel for getting updates.
func (UpdatesChannel) Clear ¶
func (ch UpdatesChannel) Clear()
Clear discards all unprocessed incoming updates.
type User ¶
type User struct { ID int `json:"id"` FirstName string `json:"first_name"` LastName string `json:"last_name"` // optional UserName string `json:"username"` // optional LanguageCode string `json:"language_code"` // optional IsBot bool `json:"is_bot"` // optional }
User is a user on Telegram.
type UserProfilePhotos ¶
type UserProfilePhotos struct { TotalCount int `json:"total_count"` Photos [][]PhotoSize `json:"photos"` }
UserProfilePhotos contains a set of user profile photos.
type UserProfilePhotosConfig ¶
UserProfilePhotosConfig contains information about a GetUserProfilePhotos request.
type Venue ¶
type Venue struct { Location Location `json:"location"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id"` // optional }
Venue contains information about a venue, including its Location.
type VenueConfig ¶
type VenueConfig struct { BaseChat Latitude float64 // required Longitude float64 // required Title string // required Address string // required FoursquareID string }
VenueConfig contains information about a SendVenue request.
type Video ¶
type Video struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration"` Thumbnail *PhotoSize `json:"thumb"` // optional MimeType string `json:"mime_type"` // optional FileSize int `json:"file_size"` // optional }
Video contains information about a video.
type VideoConfig ¶
type VideoConfig struct { BaseFile Duration int `json:"duration"` Caption string `json:"caption"` ParseMode string `json:"parse_mode"` }
VideoConfig contains information about a SendVideo request.
type VideoNote ¶
type VideoNote struct { FileID string `json:"file_id"` Length int `json:"length"` Duration int `json:"duration"` Thumbnail *PhotoSize `json:"thumb"` // optional FileSize int `json:"file_size"` // optional }
VideoNote contains information about a video.
type VideoNoteConfig ¶
VideoNoteConfig contains information about a SendVideoNote request.
type Voice ¶
type Voice struct { FileID string `json:"file_id"` Duration int `json:"duration"` MimeType string `json:"mime_type"` // optional FileSize int `json:"file_size"` // optional }
Voice contains information about a voice.
type VoiceConfig ¶
type VoiceConfig struct { BaseFile Caption string `json:"caption"` ParseMode string `json:"parse_mode"` Duration int `json:"duration"` }
VoiceConfig contains information about a SendVoice request.
type WebhookConfig ¶
WebhookConfig contains information about a SetWebhook request.
type WebhookInfo ¶
type WebhookInfo struct { URL string `json:"url"` HasCustomCertificate bool `json:"has_custom_certificate"` PendingUpdateCount int `json:"pending_update_count"` LastErrorDate int `json:"last_error_date"` // optional LastErrorMessage string `json:"last_error_message"` // optional }
WebhookInfo is information about a currently set webhook.
func (WebhookInfo) IsSet ¶
func (info WebhookInfo) IsSet() bool
IsSet returns true if a webhook is currently set.