Documentation ¶
Index ¶
- Constants
- func SendGetRequest(url string) ([]byte, error)
- func SendPostForm(reqURL string, keyVals map[string]string) ([]byte, error)
- func SendPostRequest(url, fname, ftype string, b []byte) ([]byte, error)
- type API
- func (a API) AnswerCallbackQuery(id, text string, showAlert bool) (APIResponseMessage, error)
- func (a API) AnswerInlineQuery(inlineQueryID string, results []InlineQueryResult) (APIResponseBase, error)
- func (a API) AnswerInlineQueryOptions(inlineQueryID string, results []InlineQueryResult, opts InlineQueryOptions) (APIResponseBase, error)
- func (a API) Command(command, description string) BotCommand
- func (a API) DeleteMessage(chatID int64, messageID int) (APIResponseMessage, error)
- func (a API) DeleteWebhook() (APIResponseUpdate, error)
- func (a API) EditMessageReplyMarkup(chatID int64, messageID int, keyboard []byte) (APIResponseMessage, error)
- func (a API) EditMessageText(chatID int64, messageID int, text string, opts ...Option) (APIResponseMessage, error)
- func (a API) EditMessageTextWithKeyboard(chatID int64, messageID int, text string, keyboard []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) GetChat(chatID int64) (Chat, error)
- func (a API) GetMyCommands() (APIResponseCommands, error)
- func (a API) GetStickerSet(name string) (StickerSet, error)
- func (a API) GetUpdates(offset, timeout int) (APIResponseUpdate, error)
- func (a API) InlineKbdBtn(text, url, callbackData string) InlineButton
- func (a API) InlineKbdBtnCbd(text, callbackData string) InlineButton
- func (a API) InlineKbdBtnURL(text, url string) InlineButton
- func (a API) InlineKbdMarkup(inlineKbdRows ...InlineKbdRow) (jsn []byte)
- func (a API) InlineKbdRow(inlineButtons ...InlineButton) InlineKbdRow
- func (a API) KeyboardButton(text string, requestContact, requestLocation bool) Button
- func (a API) KeyboardMarkup(resizeKeyboard, oneTimeKeyboard, selective bool, keyboardRows ...KbdRow) (kbd []byte)
- func (a API) KeyboardRemove(selective bool) (kbdrmv []byte)
- func (a API) KeyboardRow(buttons ...Button) (kbdRow KbdRow)
- func (a API) SendAnimation(filepath, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendAnimationByID(animationID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendAnimationBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendAudio(filepath, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendAudioByID(audioID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendAudioBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendChatAction(action ChatAction, chatID int64) (APIResponseMessage, error)
- func (a API) SendContact(phoneNumber, firstName, lastName string, chatID int64) (APIResponseMessage, error)
- func (a API) SendDocument(filepath, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendDocumentByID(documentID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendDocumentBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendMessage(text string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendMessageReply(text string, chatID int64, messageID int, opts ...Option) (APIResponseMessage, error)
- func (a API) SendMessageWithKeyboard(text string, chatID int64, keyboard []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendPhoto(filepath, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendPhotoByID(photoID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendPhotoBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendPhotoWithKeyboard(filepath, caption string, chatID int64, keyboard []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendPhotoWithKeyboardBytes(filepath, caption string, chatID int64, data []byte, keyboard []byte, ...) (APIResponseMessage, error)
- func (a API) SendSticker(stickerID string, chatID int64) (APIResponseMessage, error)
- func (a API) SendVideo(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendVideoByID(videoID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendVideoBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendVideoNote(videoID string, chatID int64) (APIResponseMessage, error)
- func (a API) SendVoice(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SendVoiceByID(voiceID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
- func (a API) SendVoiceBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
- func (a API) SetMyCommands(commands ...BotCommand) (APIResponseCommands, error)
- func (a API) SetWebhook(url string) (APIResponseUpdate, error)
- type APIResponseBase
- type APIResponseCommands
- type APIResponseMessage
- type APIResponseUpdate
- type Audio
- type Bot
- type BotCommand
- type Button
- type CallbackQuery
- type Chat
- type ChatAction
- type ChosenInlineResult
- type Contact
- type Dispatcher
- type Document
- type InlineButton
- type InlineKbdRow
- type InlineKeyboard
- type InlineQuery
- type InlineQueryOptions
- type InlineQueryResult
- type InlineQueryResultArticle
- type InlineQueryResultAudio
- type InlineQueryResultCachedAudio
- type InlineQueryResultCachedDocument
- type InlineQueryResultCachedGif
- type InlineQueryResultCachedMpeg4Gif
- type InlineQueryResultCachedPhoto
- type InlineQueryResultCachedSticker
- type InlineQueryResultCachedVideo
- type InlineQueryResultCachedVoice
- type InlineQueryResultContact
- type InlineQueryResultDocument
- type InlineQueryResultGame
- type InlineQueryResultGif
- type InlineQueryResultLocation
- type InlineQueryResultMpeg4Gif
- type InlineQueryResultPhoto
- type InlineQueryResultVenue
- type InlineQueryResultVideo
- type InlineQueryResultVoice
- type InlineQueryType
- type InputContactMessageContent
- type InputLocationMessageContent
- type InputMessageContent
- type InputTextMessageContent
- type InputVenueMessageContent
- type KbdRow
- type Keyboard
- type KeyboardRemove
- type Location
- type MaskPosition
- type Message
- type MessageEntity
- type NewBotFn
- type Option
- type PhotoSize
- type Sticker
- type StickerSet
- type Update
- type User
- type Video
- type VideoNote
- type Voice
Constants ¶
const ( ParseMarkdown Option = "&parse_mode=markdown" ParseHTML = "&parse_mode=html" DisableWebPagePreview = "&disable_web_page_preview=true" DisableNotification = "&disable_notification=true" )
These are all the possible options that can be used by some methods.
const ( Typing ChatAction = "typing" UploadPhoto = "upload_photo" RecordVideo = "record_video" UploadVideo = "upload_video" RecordAudio = "record_audio" UploadAudio = "upload_audio" UploadDocument = "upload_document" FindLocation = "find_location" RecordVideoNote = "record_video_note" UploadVideoNote = "upload_video_note" )
These are all the possible actions that can be sent through the SendChatAction method.
const ( ARTICLE InlineQueryType = "article" PHOTO = "photo" GIF = "gif" MPEG4GIF = "mpeg4_gif" VIDEO = "video" AUDIO = "audio" VOICE = "voice" DOCUMENT = "document" LOCATION = "location" VENUE = "venue" CONTACT = "contact" GAME = "game" STICKER = "sticker" )
These are all the possible types for the various InlineQueryResult*'s Type field.
Variables ¶
This section is empty.
Functions ¶
func SendGetRequest ¶
SendGetRequest is used to send an HTTP GET request.
func SendPostForm ¶
SendPostForm is used to send an "application/x-www-form-urlencoded" through an HTTP POST request.
Types ¶
type API ¶ added in v2.2.0
type API string
API is the object that contains all the functions that wrap those of the Telegram Bot API.
func (API) AnswerCallbackQuery ¶ added in v2.2.0
func (a API) AnswerCallbackQuery(id, text string, showAlert bool) (APIResponseMessage, error)
AnswerCallbackQuery is used to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
func (API) AnswerInlineQuery ¶ added in v2.2.0
func (a API) AnswerInlineQuery(inlineQueryID string, results []InlineQueryResult) (APIResponseBase, error)
AnswerInlineQuery is a wrapper method for AnswerInlineQueryOptions.
func (API) AnswerInlineQueryOptions ¶ added in v2.2.0
func (a API) AnswerInlineQueryOptions(inlineQueryID string, results []InlineQueryResult, opts InlineQueryOptions) (APIResponseBase, error)
AnswerInlineQueryOptions is used to send answers to an inline query.
func (API) Command ¶ added in v2.2.0
func (a API) Command(command, description string) BotCommand
Command is a wrapper method for the BotCommand type. It's used to create a new command for the bot.
func (API) DeleteMessage ¶ added in v2.2.0
func (a API) DeleteMessage(chatID int64, messageID int) (APIResponseMessage, error)
DeleteMessage is used to delete a message, including service messages, with the following limitations: - A message can only be deleted if it was sent less than 48 hours ago. - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
func (API) DeleteWebhook ¶ added in v2.2.0
func (a API) DeleteWebhook() (APIResponseUpdate, error)
DeleteWebhook is used to remove webhook integration if you decide to switch back to getUpdates.
func (API) EditMessageReplyMarkup ¶ added in v2.2.0
func (a API) EditMessageReplyMarkup(chatID int64, messageID int, keyboard []byte) (APIResponseMessage, error)
EditMessageReplyMarkup is used to edit only the reply markup of messages.
func (API) EditMessageText ¶ added in v2.2.0
func (a API) EditMessageText(chatID int64, messageID int, text string, opts ...Option) (APIResponseMessage, error)
EditMessageText is used to edit text and game messages.
func (API) EditMessageTextWithKeyboard ¶ added in v2.2.0
func (a API) EditMessageTextWithKeyboard(chatID int64, messageID int, text string, keyboard []byte, opts ...Option) (APIResponseMessage, error)
EditMessageTextWithKeyboard is the same as EditMessageText, but allows to send a custom keyboard.
func (API) GetChat ¶ added in v2.2.0
GetChat is used to get up to date information about the chat. (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.)
func (API) GetMyCommands ¶ added in v2.2.0
func (a API) GetMyCommands() (APIResponseCommands, error)
GetMyCommands is used to get the current list of the bot's commands.
func (API) GetStickerSet ¶ added in v2.2.0
func (a API) GetStickerSet(name string) (StickerSet, error)
GetStickerSet is used to get a sticker set.
func (API) GetUpdates ¶ added in v2.2.0
func (a API) GetUpdates(offset, timeout int) (APIResponseUpdate, error)
GetUpdates is used to receive incoming updates using long polling.
func (API) InlineKbdBtn ¶ added in v2.2.0
func (a API) InlineKbdBtn(text, url, callbackData string) InlineButton
InlineKbdBtn is a wrapper method for the InlineButton type. It's used to create a new inline keyboard button.
func (API) InlineKbdBtnCbd ¶ added in v2.2.0
func (a API) InlineKbdBtnCbd(text, callbackData string) InlineButton
InlineKbdBtnCbd is a wrapper method for InlineKbdBtn, but only with callbackData.
func (API) InlineKbdBtnURL ¶ added in v2.2.0
func (a API) InlineKbdBtnURL(text, url string) InlineButton
InlineKbdBtnURL is a wrapper method for InlineKbdBtn, but only with url.
func (API) InlineKbdMarkup ¶ added in v2.2.0
func (a API) InlineKbdMarkup(inlineKbdRows ...InlineKbdRow) (jsn []byte)
InlineKbdMarkup represents an inline keyboard that appears right next to the message it belongs to. This method generates the actual JSON that will be sent to Telegram to make the desired inline keyboard show up in a message.
func (API) InlineKbdRow ¶ added in v2.2.0
func (a API) InlineKbdRow(inlineButtons ...InlineButton) InlineKbdRow
InlineKbdRow is a wrapper method for the InlineKbdRow type. It's used to create a row of inline keyboard buttons.
func (API) KeyboardButton ¶ added in v2.2.0
KeyboardButton is a wrapper method for the Button type. It's used to create a new keyboard button.
func (API) KeyboardMarkup ¶ added in v2.2.0
func (a API) KeyboardMarkup(resizeKeyboard, oneTimeKeyboard, selective bool, keyboardRows ...KbdRow) (kbd []byte)
KeyboardMarkup represents a custom keyboard with reply options. This method generates the actual JSON that will be sent to Telegram to make the desired keyboard show up in a message.
func (API) KeyboardRemove ¶ added in v2.2.0
KeyboardRemove generates the object to send in a message to remove the current custom keyboard and display the default letter-keyboard.
func (API) KeyboardRow ¶ added in v2.2.0
KeyboardRow is a wrapper method for the KbdRow type. It's used to create a row of keyboard buttons.
func (API) SendAnimation ¶ added in v2.2.0
func (a API) SendAnimation(filepath, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendAnimation is used to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
func (API) SendAnimationByID ¶ added in v2.2.0
func (a API) SendAnimationByID(animationID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendAnimationByID is used to send animation files (GIF or H.264/MPEG-4 AVC video without sound) that already exist on the Telegram servers.
func (API) SendAnimationBytes ¶ added in v2.2.0
func (a API) SendAnimationBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
SendAnimationBytes is used to send animation files (GIF or H.264/MPEG-4 AVC video without sound) as a slice of bytes.
func (API) SendAudio ¶ added in v2.2.0
func (a API) SendAudio(filepath, caption string, chatID int64, opts ...Option) (APIResponseMessage, 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 or .M4A format.
func (API) SendAudioByID ¶ added in v2.2.0
func (a API) SendAudioByID(audioID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendAudioByID is used to send audio files that already exist on the Telegram servers, if you want Telegram clients to display them in the music player.
func (API) SendAudioBytes ¶ added in v2.2.0
func (a API) SendAudioBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
SendAudioBytes is used to send audio files as a slice of bytes, if you want Telegram clients to display them in the music player.
func (API) SendChatAction ¶ added in v2.2.0
func (a API) SendChatAction(action ChatAction, chatID int64) (APIResponseMessage, error)
SendChatAction is used 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).
func (API) SendContact ¶ added in v2.2.0
func (a API) SendContact(phoneNumber, firstName, lastName string, chatID int64) (APIResponseMessage, error)
SendContact is used to send phone contacts.
func (API) SendDocument ¶ added in v2.2.0
func (a API) SendDocument(filepath, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendDocument is used to send general files.
func (API) SendDocumentByID ¶ added in v2.2.0
func (a API) SendDocumentByID(documentID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendDocumentByID is used to send general files that already exist on the Telegram servers.
func (API) SendDocumentBytes ¶ added in v2.2.0
func (a API) SendDocumentBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
SendDocumentBytes is used to send general files as a slice of bytes.
func (API) SendMessage ¶ added in v2.2.0
SendMessage is used to send text messages.
func (API) SendMessageReply ¶ added in v2.2.0
func (a API) SendMessageReply(text string, chatID int64, messageID int, opts ...Option) (APIResponseMessage, error)
SendMessageReply is used to send a message as a reply to a previously received one.
func (API) SendMessageWithKeyboard ¶ added in v2.2.0
func (a API) SendMessageWithKeyboard(text string, chatID int64, keyboard []byte, opts ...Option) (APIResponseMessage, error)
SendMessageWithKeyboard is used to send a message with a keyboard.
func (API) SendPhoto ¶ added in v2.2.0
func (a API) SendPhoto(filepath, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendPhoto is used to send photos.
func (API) SendPhotoByID ¶ added in v2.2.0
func (a API) SendPhotoByID(photoID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendPhotoByID is used to send photos through an ID of a photo that already exists on the Telegram servers.
func (API) SendPhotoBytes ¶ added in v2.2.0
func (a API) SendPhotoBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
SendPhotoBytes is used to send photos as a slice of bytes.
func (API) SendPhotoWithKeyboard ¶ added in v2.2.0
func (a API) SendPhotoWithKeyboard(filepath, caption string, chatID int64, keyboard []byte, opts ...Option) (APIResponseMessage, error)
SendPhotoWithKeyboard is used to send photos with a keyboard.
func (API) SendPhotoWithKeyboardBytes ¶ added in v2.2.0
func (a API) SendPhotoWithKeyboardBytes(filepath, caption string, chatID int64, data []byte, keyboard []byte, opts ...Option) (APIResponseMessage, error)
SendPhotoWithKeyboardBytes is used to send photos as a slice of bytes with a keyboard.
func (API) SendSticker ¶ added in v2.2.0
func (a API) SendSticker(stickerID string, chatID int64) (APIResponseMessage, error)
SendSticker is used to send static .WEBP or animated .TGS stickers.
func (API) SendVideo ¶ added in v2.2.0
func (a API) SendVideo(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
SendVideo is used to send video files. Telegram clients support mp4 videos (other formats may be sent with SendDocument).
func (API) SendVideoByID ¶ added in v2.2.0
func (a API) SendVideoByID(videoID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendVideoByID is used to send video files that already exist on the Telegram servers.
func (API) SendVideoBytes ¶ added in v2.2.0
func (a API) SendVideoBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
SendVideoBytes is used to send video files as a slice of bytes.
func (API) SendVideoNote ¶ added in v2.2.0
func (a API) SendVideoNote(videoID string, chatID int64) (APIResponseMessage, error)
SendVideoNote is used to send video messages.
func (API) SendVoice ¶ added in v2.2.0
func (a API) SendVoice(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
SendVoice is used 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).
func (API) SendVoiceByID ¶ added in v2.2.0
func (a API) SendVoiceByID(voiceID, caption string, chatID int64, opts ...Option) (APIResponseMessage, error)
SendVoiceByID is used to send audio files that already exists on the Telegram servers, if you want Telegram clients to display the file as a playable voice message.
func (API) SendVoiceBytes ¶ added in v2.2.0
func (a API) SendVoiceBytes(filepath, caption string, chatID int64, data []byte, opts ...Option) (APIResponseMessage, error)
SendVoiceBytes is used to send audio files as a slice of bytes, if you want Telegram clients to display the file as a playable voice message.
func (API) SetMyCommands ¶ added in v2.2.0
func (a API) SetMyCommands(commands ...BotCommand) (APIResponseCommands, error)
SetMyCommands is used to change the list of the bot's commands.
func (API) SetWebhook ¶ added in v2.2.0
func (a API) SetWebhook(url string) (APIResponseUpdate, error)
SetWebhook is used to specify a url and receive incoming updates via an outgoing webhook.
type APIResponseBase ¶
type APIResponseBase struct { Ok bool `json:"ok"` ErrorCode int `json:"error_code,omitempty"` Description string `json:"description,omitempty"` }
APIResponseBase is a base type that represents the incoming response from Telegram servers. Used by APIResponse* to slim down the implementation.
type APIResponseCommands ¶
type APIResponseCommands struct { Result []BotCommand `json:"result,omitempty"` APIResponseBase }
APIResponseCommands represents the incoming response from Telegram servers. Used by SetMyCommands and GetMyCommands (since they return an array of BotCommands).
type APIResponseMessage ¶
type APIResponseMessage struct { Result *Message `json:"result,omitempty"` APIResponseBase }
APIResponseMessage represents the incoming response from Telegram servers. Used by the methods in the api.go module (since they return a Message).
type APIResponseUpdate ¶
type APIResponseUpdate struct { Result []*Update `json:"result,omitempty"` APIResponseBase }
APIResponseUpdate represents the incoming response from Telegram servers. Used by getUpdates (since it returns an array of Updates).
type Audio ¶
type Audio struct { FileID string `json:"file_id"` Duration int `json:"duration"` Performer string `json:"performer,omitempty"` Title string `json:"title,omitempty"` MimeType string `json:"mime_type,omitempty"` FileSize int `json:"file_size,omitempty"` Thumb *PhotoSize `json:"thumb,omitempty"` }
Audio represents an audio file to be treated as music by the Telegram clients.
type Bot ¶
type Bot interface { // Update will be called upon receiving any update from Telegram. Update(*Update) }
Bot is the interface that must be implemented by your definition of the struct thus it represent each open session with a user on Telegram.
type BotCommand ¶
BotCommand represents a bot command.
type Button ¶
type Button struct { Text string `json:"text"` RequestContact bool `json:"request_contact,omitempty"` RequestLocation bool `json:"request_location,omitempty"` }
Button represents a button in a keyboard.
type CallbackQuery ¶
type CallbackQuery struct { ID string `json:"id"` User *User `json:"from"` Message *Message `json:"message,omitempty"` InlineMessageID string `json:"inline_message_id,omitempty"` Data string `json:"data,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.
type Chat ¶
type Chat struct { ID int64 `json:"id"` Type string `json:"type"` Title string `json:"title,omitempty"` Username string `json:"username,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` AllMembersAreAdmin bool `json:"all_members_are_administrators,omitempty"` Description string `json:"description,omitempty"` InviteLink string `json:"invite_link,omitempty"` PinnedMessage *Message `json:"pinned_message,omitempty"` }
Chat represents a chat.
type ChatAction ¶
type ChatAction string
ChatAction is a custom type for the various actions that can be sent through the SendChatAction method.
type ChosenInlineResult ¶
type ChosenInlineResult struct { ResultID string `json:"result_id"` From *User `json:"from"` Location *Location `json:"location,omitempty"` InlineMessageID string `json:"inline_message_id,omitempty"` 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 { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name,omitempty"` UserID int `json:"user_id,omitempty"` Vcard string `json:"vcard,omitempty"` }
Contact represents a phone contact.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
The Dispatcher passes the updates from the Telegram Bot API to the Bot instance associated with each chatID. When a new chat ID is found, the provided function of type NewBotFn will be called.
func NewDispatcher ¶
func NewDispatcher(token string, newBotFn NewBotFn) *Dispatcher
NewDispatcher returns a new instance of the Dispatcher object. Calls the Update function of the bot associated with each chat ID. If a new chat ID is found, newBotFn will be called first.
func (*Dispatcher) AddSession ¶
func (d *Dispatcher) AddSession(chatID int64)
AddSession allows to arbitrarily create a new Bot instance.
func (*Dispatcher) DelSession ¶
func (d *Dispatcher) DelSession(chatID int64)
DelSession deletes the Bot instance, seen as a session, from the map with all of them.
func (*Dispatcher) ListenWebhook ¶
func (d *Dispatcher) ListenWebhook(webhookURL, listenURL string, internalPort int) error
ListenWebhook sets a webhook and listens for incoming updates
func (*Dispatcher) Poll ¶
func (d *Dispatcher) Poll() error
Poll starts the polling loop so that the dispatcher calls the function Update upon receiving any update from Telegram.
type Document ¶
type Document struct { FileID string `json:"file_id"` Thumb *PhotoSize `json:"thumb,omitempty"` FileName string `json:"file_name,omitempty"` MimeType string `json:"mime_type,omitempty"` FileSize int `json:"file_size,omitempty"` }
Document represents a general file (as opposed to photos, voice messages and audio files).
type InlineButton ¶
type InlineButton struct { Text string `json:"text"` URL string `json:"url,omitempty"` CallbackData string `json:"callback_data,omitempty"` }
InlineButton represents a button in an inline keyboard.
type InlineKbdRow ¶
type InlineKbdRow []InlineButton
InlineKbdRow represents a row of buttons in an inline keyboard.
type InlineKeyboard ¶
type InlineKeyboard struct {
InlineKeyboard []InlineKbdRow `json:"inline_keyboard"`
}
InlineKeyboard represents an inline keyboard.
type InlineQuery ¶
type InlineQuery struct { ID string `json:"id"` From *User `json:"from"` Location *Location `json:"location,omitempty"` Query string `json:"query"` 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 InlineQueryOptions ¶ added in v2.1.0
type InlineQueryOptions struct { CacheTime int IsPersonal bool NextOffset string SwitchPmText string SwitchPmParameter string }
InlineQueryOptions is a custom type which contains the various options required by the AnswerInlineQueryOptions method.
type InlineQueryResult ¶ added in v2.1.0
type InlineQueryResult interface {
ImplementsInlineQueryResult()
}
InlineQueryResult represents an interface that implements all the various InlineQueryResult* types.
type InlineQueryResultArticle ¶ added in v2.1.0
type InlineQueryResultArticle struct { Type InlineQueryType `json:"type"` ID string `json:"id"` Title string `json:"title"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` URL string `json:"url,omitempty"` HideURL bool `json:"hide_url,omitempty"` Description string `json:"description,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultArticle represents a link to an article or web page.
func (InlineQueryResultArticle) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultArticle) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultAudio ¶ added in v2.1.0
type InlineQueryResultAudio struct { Type InlineQueryType `json:"type"` ID string `json:"id"` AudioURL string `json:"audio_url"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` Performer string `json:"performer,omitempty"` AudioDuration int `json:"audio_duration,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultAudio represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the audio.
func (InlineQueryResultAudio) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultAudio) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultCachedAudio ¶ added in v2.1.0
type InlineQueryResultCachedAudio struct { Type InlineQueryType `json:"type"` ID string `json:"id"` AudioFileID string `json:"audio_file_id"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedAudio represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the audio.
func (InlineQueryResultCachedAudio) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultCachedAudio) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultCachedDocument ¶ added in v2.1.0
type InlineQueryResultCachedDocument struct { Type InlineQueryType `json:"type"` ID string `json:"id"` Title string `json:"title"` DocumentFileID string `json:"document_file_id"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedDocument represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the file.
func (InlineQueryResultCachedDocument) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultCachedDocument) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultCachedGif ¶ added in v2.1.0
type InlineQueryResultCachedGif struct { Type InlineQueryType `json:"type"` ID string `json:"id"` GifFileID string `json:"gif_file_id"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedGif represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with specified content instead of the animation.
func (InlineQueryResultCachedGif) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultCachedGif) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultCachedMpeg4Gif ¶ added in v2.1.0
type InlineQueryResultCachedMpeg4Gif struct { Type InlineQueryType `json:"type"` ID string `json:"id"` Mpeg4FileID string `json:"mpeg4_file_id"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedMpeg4Gif represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the animation.
func (InlineQueryResultCachedMpeg4Gif) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultCachedMpeg4Gif) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultCachedPhoto ¶ added in v2.1.0
type InlineQueryResultCachedPhoto struct { Type InlineQueryType `json:"type"` ID string `json:"id"` PhotoFileID string `json:"photo_file_id"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedPhoto represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the photo.
func (InlineQueryResultCachedPhoto) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultCachedPhoto) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultCachedSticker ¶ added in v2.1.0
type InlineQueryResultCachedSticker struct { Type InlineQueryType `json:"type"` ID string `json:"id"` StickerFileID string `json:"sticker_file_id"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedSticker represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the sticker.
func (InlineQueryResultCachedSticker) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultCachedSticker) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultCachedVideo ¶ added in v2.1.0
type InlineQueryResultCachedVideo struct { Type InlineQueryType `json:"type"` ID string `json:"id"` VideoFileID string `json:"video_file_id"` Title string `json:"title"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedVideo represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the video.
func (InlineQueryResultCachedVideo) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultCachedVideo) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultCachedVoice ¶ added in v2.1.0
type InlineQueryResultCachedVoice struct { Type InlineQueryType `json:"type"` ID string `json:"id"` VoiceFileID string `json:"voice_file_id"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedVoice represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the voice message.
func (InlineQueryResultCachedVoice) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultCachedVoice) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultContact ¶ added in v2.1.0
type InlineQueryResultContact struct { Type InlineQueryType `json:"type"` ID string `json:"id"` PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name,omitempty"` Vcard string `json:"vcard,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultContact represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the contact.
func (InlineQueryResultContact) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultContact) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultDocument ¶ added in v2.1.0
type InlineQueryResultDocument struct { Type InlineQueryType `json:"type"` ID string `json:"id"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` DocumentURL string `json:"document_url"` MimeType string `json:"mime_type"` Description string `json:"description,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultDocument represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
func (InlineQueryResultDocument) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultDocument) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultGame ¶ added in v2.1.0
type InlineQueryResultGame struct { Type InlineQueryType `json:"type"` ID string `json:"id"` GameShortName string `json:"game_short_name"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` }
InlineQueryResultGame represents a Game.
func (InlineQueryResultGame) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultGame) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultGif ¶ added in v2.1.0
type InlineQueryResultGif struct { Type InlineQueryType `json:"type"` ID string `json:"id"` GifURL string `json:"gif_url"` GifWidth int `json:"gif_width,omitempty"` GifHeight int `json:"gif_height,omitempty"` GifDuration int `json:"gif_duration,omitempty"` ThumbURL string `json:"thumb_url"` ThumbMimeType string `json:"thumb_mime_type,omitempty"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultGif represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the animation.
func (InlineQueryResultGif) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultGif) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultLocation ¶ added in v2.1.0
type InlineQueryResultLocation struct { Type InlineQueryType `json:"type"` ID string `json:"id"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Title string `json:"title"` HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` LivePeriod int `json:"live_period,omitempty"` Heading int `json:"heading,omitempty"` ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultLocation represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the location.
func (InlineQueryResultLocation) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultLocation) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultMpeg4Gif ¶ added in v2.1.0
type InlineQueryResultMpeg4Gif struct { Type InlineQueryType `json:"type"` ID string `json:"id"` Mpeg4URL string `json:"mpeg4_url"` Mpeg4Width int `json:"mpeg4_width,omitempty"` Mpeg4Height int `json:"mpeg4_height,omitempty"` Mpeg4Duration int `json:"mpeg4_duration,omitempty"` ThumbURL string `json:"thumb_url"` ThumbMimeType string `json:"thumb_mime_type,omitempty"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultMpeg4Gif represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the animation.
func (InlineQueryResultMpeg4Gif) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultMpeg4Gif) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultPhoto ¶ added in v2.1.0
type InlineQueryResultPhoto struct { Type InlineQueryType `json:"type"` ID string `json:"id"` PhotoURL string `json:"photo_url"` ThumbURL string `json:"thumb_url"` PhotoWidth int `json:"photo_width,omitempty"` PhotoHeight int `json:"photo_height,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultPhoto represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the photo.
func (InlineQueryResultPhoto) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultPhoto) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultVenue ¶ added in v2.1.0
type InlineQueryResultVenue struct { Type InlineQueryType `json:"type"` ID string `json:"id"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id,omitempty"` FoursquareType string `json:"foursquare_type,omitempty"` GooglePlaceID string `json:"google_place_id,omitempty"` GooglePlaceType string `json:"google_place_type,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultVenue represents a venue. By default, the venue will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the venue.
func (InlineQueryResultVenue) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultVenue) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultVideo ¶ added in v2.1.0
type InlineQueryResultVideo struct { Type InlineQueryType `json:"type"` ID string `json:"id"` VideoURL string `json:"video_url"` MimeType string `json:"mime_type"` ThumbURL string `json:"thumb_url"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` VideoWidth int `json:"video_width,omitempty"` VideoHeight int `json:"video_height,omitempty"` VideoDuration int `json:"video_duration,omitempty"` Description string `json:"description,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultVideo represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the video.
func (InlineQueryResultVideo) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultVideo) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryResultVoice ¶ added in v2.1.0
type InlineQueryResultVoice struct { Type InlineQueryType `json:"type"` ID string `json:"id"` VoiceURL string `json:"voice_url"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` VoiceDuration int `json:"voice_duration,omitempty"` ReplyMarkup *InlineKeyboard `json:"reply_markup,omitempty"` InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultVoice represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the the voice message.
func (InlineQueryResultVoice) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultVoice) ImplementsInlineQueryResult()
ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.
type InlineQueryType ¶ added in v2.1.0
type InlineQueryType string
InlineQueryType is a custom type for the various InlineQueryResult*'s Type field.
type InputContactMessageContent ¶ added in v2.1.0
type InputContactMessageContent struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name,omitempty"` Vcard string `json:"vcard,omitempty"` }
InputContactMessageContent represents the content of a contact message to be sent as the result of an inline query.
func (InputContactMessageContent) ImplementsInputMessageContent ¶ added in v2.1.0
func (i InputContactMessageContent) ImplementsInputMessageContent()
ImplementsInputMessageContent is used to implement the InlineQueryResult interface.
type InputLocationMessageContent ¶ added in v2.1.0
type InputLocationMessageContent struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` LivePeriod int `json:"live_period,omitempty"` Heading int `json:"heading,omitempty"` ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` }
InputLocationMessageContent represents the content of a location message to be sent as the result of an inline query.
func (InputLocationMessageContent) ImplementsInputMessageContent ¶ added in v2.1.0
func (i InputLocationMessageContent) ImplementsInputMessageContent()
ImplementsInputMessageContent is used to implement the InlineQueryResult interface.
type InputMessageContent ¶ added in v2.1.0
type InputMessageContent interface {
ImplementsInputMessageContent()
}
InputMessageContent represents an interface that implements all the various Input*MessageContent types.
type InputTextMessageContent ¶ added in v2.1.0
type InputTextMessageContent struct { MessageText string `json:"message_text"` ParseMode string `json:"parse_mode,omitempty"` Entities []*MessageEntity `json:"entities,omitempty"` DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` }
InputTextMessageContent represents the content of a text message to be sent as the result of an inline query.
func (InputTextMessageContent) ImplementsInputMessageContent ¶ added in v2.1.0
func (i InputTextMessageContent) ImplementsInputMessageContent()
ImplementsInputMessageContent is used to implement the InlineQueryResult interface.
type InputVenueMessageContent ¶ added in v2.1.0
type InputVenueMessageContent struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id,omitempty"` FoursquareType string `json:"foursquare_type,omitempty"` GooglePlaceID string `json:"google_place_id,omitempty"` GooglePlaceType string `json:"google_place_type,omitempty"` }
InputVenueMessageContent represents the content of a venue message to be sent as the result of an inline query.
func (InputVenueMessageContent) ImplementsInputMessageContent ¶ added in v2.1.0
func (i InputVenueMessageContent) ImplementsInputMessageContent()
ImplementsInputMessageContent is used to implement the InlineQueryResult interface.
type Keyboard ¶
type Keyboard struct { Keyboard []KbdRow `json:"keyboard"` ResizeKeyboard bool `json:"resize_keyboard,omitempty"` OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` Selective bool `json:"selective,omitempty"` }
Keyboard represents a keyboard.
type KeyboardRemove ¶
type KeyboardRemove struct { RemoveKeyboard bool `json:"remove_keyboard"` Selective bool `json:"selective,omitempty"` }
KeyboardRemove represents a keyboard removal request.
type MaskPosition ¶
type MaskPosition struct { Point string `json:"point"` XShift float32 `json:"x_shift"` YShift float32 `json:"y_shift"` Scale float32 `json:"scale"` }
MaskPosition describes the position on faces where a mask should be placed by default.
type Message ¶
type Message struct { ID int `json:"message_id"` User *User `json:"from"` Chat *Chat `json:"chat"` Date int64 `json:"date"` Text string `json:"text"` Entities []*MessageEntity `json:"entities,omitempty"` Audio *Audio `json:"audio,omitempty"` Document *Document `json:"document,omitempty"` Photo []*PhotoSize `json:"photo,omitempty"` MediaGroupID string `json:"media_group_id,omitempty"` Sticker *Sticker `json:"sticker,omitempty"` Video *Video `json:"video,omitempty"` VideoNote *VideoNote `json:"video_note,omitempty"` Voice *Voice `json:"voice,omitempty"` Caption string `json:"caption,omitempty"` Contact *Contact `json:"contact,omitempty"` Location *Location `json:"location,omitempty"` NewChatMember []*User `json:"new_chat_members,omitempty"` LeftChatMember *User `json:"left_chat_member,omitempty"` PinnedMessage *Message `json:"pinned_message,omitempty"` }
Message represents a message.
type MessageEntity ¶
type MessageEntity struct { Type string `json:"type"` Offset int `json:"offset"` Length int `json:"Length"` URL string `json:"url,omitempty"` User *User `json:"user,omitempty"` }
MessageEntity represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
type NewBotFn ¶
NewBotFn is called every time echotron receives an update with a chat ID never encountered before.
type Option ¶
type Option string
Option is a custom type for the various frequent options used by some methods of the API.
type PhotoSize ¶
type PhotoSize struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` FileSize int `json:"FileSize"` }
PhotoSize represents one size of a photo or a file/sticker thumbnail.
type Sticker ¶
type Sticker struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Thumb *PhotoSize `json:"thumb,omitempty"` Emoji string `json:"emoji,omitempty"` SetName string `json:"set_name,omitempty"` FileSize int `json:"file_size,omitempty"` MaskPosition MaskPosition `json:"mask_position"` }
Sticker represents a sticker.
type StickerSet ¶
type StickerSet struct { Name string `json:"name"` Title string `json:"title"` ContainsMasks bool `json:"contains_masks"` Stickers []*Sticker `json:"sticker"` }
StickerSet represents a sticker set.
type Update ¶
type Update struct { ID int `json:"update_id"` Message *Message `json:"message,omitempty"` EditedMessage *Message `json:"edited_message,omitempty"` ChannelPost *Message `json:"channel_post,omitempty"` EditedChannelPost *Message `json:"edited_channel_post,omitempty"` InlineQuery *InlineQuery `json:"inline_query,omitempty"` ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"` CallbackQuery *CallbackQuery `json:"callback_query,omitempty"` }
Update represents an incoming update. At most one of the optional parameters can be present in any given update.
type User ¶
type User struct { ID int64 `json:"id"` IsBot bool `json:"is_bot"` FirstName string `json:"first_name"` LastName string `json:"last_name,omitempty"` Username string `json:"username,omitempty"` LanguageCode string `json:"language_code,omitempty"` }
User represents a Telegram user or bot.
type Video ¶
type Video struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration"` Thumb *PhotoSize `json:"thumb,omitempty"` MimeType string `json:"mime_type,omitempty"` FileSize int `json:"file_size,omitempty"` }
Video represents a video file.