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 APIResponseBase
- type APIResponseCommands
- type APIResponseMessage
- type APIResponseUpdate
- 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) SendStickerByID(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) SendVideoNoteByID(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 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 ( PARSE_MARKDOWN Option = "&parse_mode=markdown" PARSE_HTML = "&parse_mode=html" DISABLE_WEB_PAGE_PREVIEW = "&disable_web_page_preview=true" DISABLE_NOTIFICATION = "&disable_notification=true" )
const ( TYPING ChatAction = "typing" UPLOAD_PHOTO = "upload_photo" RECORD_VIDEO = "record_video" UPLOAD_VIDEO = "upload_video" RECORD_AUDIO = "record_audio" UPLOAD_AUDIO = "upload_audio" UPLOAD_DOCUMENT = "upload_document" FIND_LOCATION = "find_location" RECORD_VIDEO_NOTE = "record_video_note" UPLOAD_VIDEO_NOTE = "upload_video_note" )
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" )
Variables ¶
This section is empty.
Functions ¶
func SendGetRequest ¶
Types ¶
type APIResponseBase ¶
type APIResponseCommands ¶
type APIResponseCommands struct { APIResponseBase Result []BotCommand `json:"result,omitempty"` }
type APIResponseMessage ¶
type APIResponseMessage struct { APIResponseBase Result *Message `json:"result,omitempty"` }
This object 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 { APIResponseBase Result []*Update `json:"result,omitempty"` }
This object represents the incoming response from Telegram servers. Used by getUpdates (since it returns an array of Updates).
type Api ¶
type Api string
func (Api) AnswerCallbackQuery ¶
func (a Api) AnswerCallbackQuery(id, text string, showAlert bool) (APIResponseMessage, error)
func (Api) AnswerInlineQuery ¶ added in v2.1.0
func (a Api) AnswerInlineQuery(inlineQueryId string, results []InlineQueryResult) (APIResponseBase, error)
func (Api) AnswerInlineQueryOptions ¶ added in v2.1.0
func (a Api) AnswerInlineQueryOptions(inlineQueryId string, results []InlineQueryResult, opts InlineQueryOptions) (APIResponseBase, error)
func (Api) Command ¶
func (a Api) Command(command, description string) BotCommand
func (Api) DeleteMessage ¶
func (a Api) DeleteMessage(chatId int64, messageId int) (APIResponseMessage, error)
func (Api) DeleteWebhook ¶
func (a Api) DeleteWebhook() (APIResponseUpdate, error)
DeleteWebhook deletes webhook
func (Api) EditMessageReplyMarkup ¶
func (Api) EditMessageText ¶
func (Api) EditMessageTextWithKeyboard ¶
func (Api) GetMyCommands ¶
func (a Api) GetMyCommands() (APIResponseCommands, error)
func (Api) GetStickerSet ¶
func (a Api) GetStickerSet(name string) (StickerSet, error)
func (Api) GetUpdates ¶
func (a Api) GetUpdates(offset, timeout int) (APIResponseUpdate, error)
GetResponse returns the incoming updates from telegram.
func (Api) InlineKbdBtn ¶
func (a Api) InlineKbdBtn(text, url, callbackData string) InlineButton
Returns a new inline keyboard button with the provided data.
func (Api) InlineKbdBtnCbd ¶
func (a Api) InlineKbdBtnCbd(text, callbackData string) InlineButton
Same as InlineKbdBtn, but only with callbackData.
func (Api) InlineKbdBtnUrl ¶
func (a Api) InlineKbdBtnUrl(text, url string) InlineButton
Same as InlineKbdBtn, but only with url.
func (Api) InlineKbdMarkup ¶
func (a Api) InlineKbdMarkup(inlineKbdRows ...InlineKbdRow) (jsn []byte)
Returns a byte slice containing the inline keyboard json data.
func (Api) InlineKbdRow ¶
func (a Api) InlineKbdRow(inlineButtons ...InlineButton) InlineKbdRow
Returns a new inline keyboard row with the given buttons.
func (Api) KeyboardButton ¶
func (Api) KeyboardMarkup ¶
func (Api) KeyboardRemove ¶
func (Api) KeyboardRow ¶
func (Api) SendAnimation ¶ added in v2.0.1
func (Api) SendAnimationByID ¶ added in v2.0.1
func (Api) SendAnimationBytes ¶ added in v2.0.1
func (Api) SendAudioByID ¶
func (Api) SendAudioBytes ¶
func (Api) SendChatAction ¶
func (a Api) SendChatAction(action ChatAction, chatId int64) (APIResponseMessage, error)
func (Api) SendContact ¶
func (a Api) SendContact(phoneNumber, firstName, lastName string, chatId int64) (APIResponseMessage, error)
func (Api) SendDocument ¶
func (Api) SendDocumentByID ¶
func (Api) SendDocumentBytes ¶
func (Api) SendMessage ¶
func (Api) SendMessageReply ¶
func (a Api) SendMessageReply(text string, chatId int64, messageId int, opts ...Option) (APIResponseMessage, error)
Sends a message as a reply to a previously received one.
func (Api) SendMessageWithKeyboard ¶
func (Api) SendPhotoByID ¶
func (Api) SendPhotoBytes ¶
func (Api) SendPhotoWithKeyboard ¶
func (Api) SendPhotoWithKeyboardBytes ¶
func (Api) SendStickerByID ¶
func (a Api) SendStickerByID(stickerId string, chatId int64) (APIResponseMessage, error)
func (Api) SendVideoByID ¶
func (Api) SendVideoBytes ¶
func (Api) SendVideoNoteByID ¶
func (a Api) SendVideoNoteByID(videoId string, chatId int64) (APIResponseMessage, error)
func (Api) SendVoiceByID ¶
func (Api) SendVoiceBytes ¶
func (Api) SetMyCommands ¶
func (a Api) SetMyCommands(commands ...BotCommand) (APIResponseCommands, error)
func (Api) SetWebhook ¶
func (a Api) SetWebhook(url string) (APIResponseUpdate, error)
SetWebhook sets the webhook to bot on Telegram servers
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"` }
This object 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 ¶
type Button ¶
type Button struct { Text string `json:"text"` RequestContact bool `json:"request_contact,omitempty"` RequestLocation bool `json:"request_location,omitempty"` }
This object 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"` }
This object 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"` }
This object represents a chat.
type ChatAction ¶
type ChatAction string
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"` }
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"` }
This object represents a phone contact.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(token string, newBot NewBotFn) Dispatcher
NewDispatcher returns a new instance of the Dispatcher object; useful for polling telegram and dispatch every update to the corresponding Bot instance.
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(url 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"` }
This object 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"` }
This object represents a button in an inline keyboard.
type InlineKbdRow ¶
type InlineKbdRow []InlineButton
This object represents a row of buttons in an inline keyboard.
type InlineKeyboard ¶
type InlineKeyboard struct {
InlineKeyboard []InlineKbdRow `json:"inline_keyboard"`
}
This object 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"` }
This object 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 InlineQueryResult ¶ added in v2.1.0
type InlineQueryResult interface {
ImplementsInlineQueryResult()
}
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"` }
Represents a link to an article or web page.
func (InlineQueryResultArticle) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultArticle) ImplementsInlineQueryResult()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
Represents a Game.
func (InlineQueryResultGame) ImplementsInlineQueryResult ¶ added in v2.1.0
func (i InlineQueryResultGame) ImplementsInlineQueryResult()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
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"` }
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()
type InlineQueryType ¶ added in v2.1.0
type InlineQueryType string
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"` }
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()
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"` }
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()
type InputMessageContent ¶ added in v2.1.0
type InputMessageContent interface {
ImplementsInputMessageContent()
}
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"` }
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()
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"` }
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()
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"` }
This object represents a keyboard.
type KeyboardRemove ¶
type KeyboardRemove struct { RemoveKeyboard bool `json:"remove_keyboard"` Selective bool `json:"selective,omitempty"` }
This object 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"` }
This object 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"` }
WIP: this object 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"` }
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
type PhotoSize ¶
type PhotoSize struct { FileId string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` FileSize int `json:"FileSize"` }
This object 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"` }
This object 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"` }
This object 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"` }
This object 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"` }
This object 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"` }
This object represents a video file.