Documentation ¶
Overview ¶
Package telegram contains bindings for the Telegram API
Index ¶
- Constants
- Variables
- func NewInlineMentionURL(userID int) *url.URL
- type Animation
- type AnswerCallbackQueryParameters
- type AnswerInlineQueryParameters
- type AnswerPreCheckoutQueryParameters
- type AnswerShippingQueryParameters
- type Audio
- type Bot
- func (bot *Bot) AnswerCallbackQuery(params *AnswerCallbackQueryParameters) (bool, error)
- func (bot *Bot) AnswerInlineQuery(params *AnswerInlineQueryParameters) (bool, error)
- func (bot *Bot) AnswerPreCheckoutQuery(params *AnswerShippingQueryParameters) (bool, error)
- func (bot *Bot) AnswerShippingQuery(params *AnswerShippingQueryParameters) (bool, error)
- func (bot *Bot) DeleteChatPhoto(chatID int64) (bool, error)
- func (bot *Bot) DeleteChatStickerSet(chatID int64) (bool, error)
- func (bot *Bot) DeleteMessage(chatID int64, messageID int) (bool, error)
- func (bot *Bot) DeleteStickerFromSet(sticker string) (bool, error)
- func (bot *Bot) DeleteWebhook() (bool, error)
- func (bot *Bot) EditMessageCaption(params *EditMessageCaptionParameters) (*Message, error)
- func (bot *Bot) EditMessageLiveLocation(params *EditMessageLiveLocationParameters) (*Message, error)
- func (bot *Bot) EditMessageReplyMarkup(params *EditMessageReplyMarkupParameters) (*Message, error)
- func (bot *Bot) EditMessageText(params *EditMessageTextParameters) (*Message, error)
- func (bot *Bot) ExportChatInviteLink(chatID int64) (string, error)
- func (bot *Bot) ForwardMessage(params *ForwardMessageParameters) (*Message, error)
- func (bot *Bot) GetChat(chatID int64) (*Chat, error)
- func (bot *Bot) GetChatAdministrators(chatID int64) ([]ChatMember, error)
- func (bot *Bot) GetChatMember(chatID int64, userID int) (*ChatMember, error)
- func (bot *Bot) GetChatMembersCount(chatID int64) (int, error)
- func (bot *Bot) GetFile(fileID string) (*File, error)
- func (bot *Bot) GetGameHighScores(params *GetGameHighScoresParameters) ([]GameHighScore, error)
- func (bot *Bot) GetMe() (*User, error)
- func (bot *Bot) GetStickerSet(name string) (*StickerSet, error)
- func (bot *Bot) GetUpdates(params *GetUpdatesParameters) ([]Update, error)
- func (bot *Bot) GetUserProfilePhotos(params *GetUserProfilePhotosParameters) (*UserProfilePhotos, error)
- func (bot *Bot) GetWebhookInfo() (*WebhookInfo, error)
- func (bot *Bot) IsCommandToMe(msg *Message) bool
- func (bot *Bot) IsForwardFromMe(msg *Message) bool
- func (bot *Bot) IsForwardMentionsMe(msg *Message) bool
- func (bot *Bot) IsMessageFromMe(msg *Message) bool
- func (bot *Bot) IsMessageMentionsMe(msg *Message) bool
- func (bot *Bot) IsMessageToMe(msg *Message) bool
- func (bot *Bot) IsReplyMentionsMe(msg *Message) bool
- func (bot *Bot) IsReplyToMe(msg *Message) bool
- func (bot *Bot) KickChatMember(params *KickChatMemberParameters) (bool, error)
- func (bot *Bot) LeaveChat(chatID int64) (bool, error)
- func (bot *Bot) NewFileURL(filePath string) *url.URL
- func (bot *Bot) NewLongPollingChannel(params *GetUpdatesParameters) UpdatesChannel
- func (bot *Bot) NewRedirectURL(param string, group bool) *url.URL
- func (bot *Bot) NewWebhookChannel(params *SetWebhookParameters, certFile, keyFile, set, listen, serve string) (updates UpdatesChannel)
- func (bot *Bot) PinChatMessage(params *PinChatMessageParameters) (bool, error)
- func (bot *Bot) SendChatAction(chatID int64, action string) (bool, error)
- func (bot *Bot) SendContact(params *SendContactParameters) (*Message, error)
- func (bot *Bot) SendDocument(params *SendDocumentParameters) (*Message, error)
- func (bot *Bot) SendGame(params *SendGameParameters) (*Message, error)
- func (bot *Bot) SendInvoice(params *SendInvoiceParameters) (*Message, error)
- func (bot *Bot) SendLocation(params *SendLocationParameters) (*Message, error)
- func (bot *Bot) SendMediaGroup(params *SendMediaGroupParameters) ([]Message, error)
- func (bot *Bot) SendMessage(params *SendMessageParameters) (*Message, error)
- func (bot *Bot) SendPhoto(params *SendPhotoParameters) (*Message, error)
- func (bot *Bot) SendVenue(params *SendVenueParameters) (*Message, error)
- func (bot *Bot) SetChatDescription(chatID int64, description string) (bool, error)
- func (bot *Bot) SetChatPhoto(chatID int64, chatPhoto interface{}) (bool, error)
- func (bot *Bot) SetChatStickerSet(chatID int64, stickerSetName string) (bool, error)
- func (bot *Bot) SetChatTitle(chatID int64, title string) (bool, error)
- func (bot *Bot) SetGameScore(params *SetGameScoreParameters) (*Message, error)
- func (bot *Bot) SetStickerPositionInSet(sticker string, position int) (bool, error)
- func (bot *Bot) SetWebhook(params *SetWebhookParameters) (bool, error)
- func (bot *Bot) UnbanChatMember(chatID int64, userID int) (bool, error)
- func (bot *Bot) UnpinChatMessage(chatID int64) (bool, error)
- func (bot *Bot) Upload(method, key, name string, file InputFile, args fmt.Stringer) (*Response, error)
- type CallbackGame
- type CallbackQuery
- type Chat
- func (chat *Chat) FullName() string
- func (chat *Chat) HasPinnedMessage() bool
- func (chat *Chat) HasStickerSet() bool
- func (chat *Chat) IsChannel() bool
- func (chat *Chat) IsGroup() bool
- func (chat *Chat) IsPrivate() bool
- func (chat *Chat) IsSuperGroup() bool
- func (chat *Chat) StickerSet(bot *Bot) *StickerSet
- type ChatMember
- func (member *ChatMember) IsAdministrator() bool
- func (member *ChatMember) IsCreator() bool
- func (member *ChatMember) IsKicked() bool
- func (member *ChatMember) IsLeft() bool
- func (member *ChatMember) IsMember() bool
- func (member *ChatMember) IsRestricted() bool
- func (member *ChatMember) UntilTime() time.Time
- type ChatPhoto
- type ChosenInlineResult
- type Contact
- type DeleteChatPhotoParameters
- type DeleteChatStickerSetParameters
- type DeleteMessageParameters
- type DeleteStickerFromSetParameters
- type Document
- type EditMessageCaptionParameters
- type EditMessageLiveLocationParameters
- type EditMessageReplyMarkupParameters
- type EditMessageTextParameters
- type ExportChatInviteLinkParameters
- type File
- type ForceReply
- type ForwardMessageParameters
- type Game
- type GameHighScore
- type GetChatAdministratorsParameters
- type GetChatMemberParameters
- type GetChatMembersCountParameters
- type GetChatParameters
- type GetFileParameters
- type GetGameHighScoresParameters
- type GetStickerSetParameters
- type GetUpdatesParameters
- type GetUserProfilePhotosParameters
- type InlineKeyboardButton
- func NewInlineKeyboardButton(text, data string) InlineKeyboardButton
- func NewInlineKeyboardButtonGame(text string) InlineKeyboardButton
- func NewInlineKeyboardButtonPay(text string) InlineKeyboardButton
- func NewInlineKeyboardButtonSwitch(text, query string) InlineKeyboardButton
- func NewInlineKeyboardButtonSwitchSelf(text, query string) InlineKeyboardButton
- func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton
- func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton
- type InlineKeyboardMarkup
- type InlineQuery
- 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 InputContactMessageContent
- type InputFile
- type InputLocationMessageContent
- type InputMedia
- type InputMediaPhoto
- type InputMediaVideo
- type InputMessageContent
- type InputTextMessageContent
- type InputVenueMessageContent
- type Invoice
- type KeyboardButton
- type KickChatMemberParameters
- type LabeledPrice
- type LeaveChatParameters
- type Location
- type MaskPosition
- type Message
- func (msg *Message) Command() string
- func (msg *Message) CommandArgument() string
- func (msg *Message) EditTime() time.Time
- func (msg *Message) ForwardTime() time.Time
- func (msg *Message) HasAuthorSignature() bool
- func (msg *Message) HasBeenEdited() bool
- func (msg *Message) HasCaption() bool
- func (msg *Message) HasCaptionEntities() bool
- func (msg *Message) HasCaptionMentions() bool
- func (msg *Message) HasCommandArgument() bool
- func (msg *Message) HasEntities() bool
- func (msg *Message) HasMentions() bool
- func (msg *Message) IsAudio() bool
- func (msg *Message) IsChannelChatCreatedEvent() bool
- func (msg *Message) IsCommand() bool
- func (msg *Message) IsCommandEqual(command string) bool
- func (msg *Message) IsContact() bool
- func (msg *Message) IsDeleteChatPhotoEvent() bool
- func (msg *Message) IsDocument() bool
- func (msg *Message) IsForward() bool
- func (msg *Message) IsGame() bool
- func (msg *Message) IsGroupChatCreatedEvent() bool
- func (msg *Message) IsInvoice() bool
- func (msg *Message) IsLeftChatMemberEvent() bool
- func (msg *Message) IsLocation() bool
- func (msg *Message) IsNewChatMembersEvent() bool
- func (msg *Message) IsNewChatPhotoEvent() bool
- func (msg *Message) IsNewChatTitleEvent() bool
- func (msg *Message) IsPhoto() bool
- func (msg *Message) IsPinnedMessage() bool
- func (msg *Message) IsReply() bool
- func (msg *Message) IsSticker() bool
- func (msg *Message) IsSuccessfulPayment() bool
- func (msg *Message) IsSupergroupChatCreatedEvent() bool
- func (msg *Message) IsText() bool
- func (msg *Message) IsVenue() bool
- func (msg *Message) IsVideo() bool
- func (msg *Message) IsVideoNote() bool
- func (msg *Message) IsVoice() bool
- func (msg *Message) RawCommand() string
- func (msg *Message) Time() time.Time
- type MessageEntity
- func (entity *MessageEntity) IsBold() bool
- func (entity *MessageEntity) IsBotCommand() bool
- func (entity *MessageEntity) IsCode() bool
- func (entity *MessageEntity) IsEmail() bool
- func (entity *MessageEntity) IsHashtag() bool
- func (entity *MessageEntity) IsItalic() bool
- func (entity *MessageEntity) IsMention() bool
- func (entity *MessageEntity) IsPre() bool
- func (entity *MessageEntity) IsTextLink() bool
- func (entity *MessageEntity) IsTextMention() bool
- func (entity *MessageEntity) IsURL() bool
- func (entity *MessageEntity) ParseURL(messageText string) *url.URL
- func (entity *MessageEntity) TextLink() *url.URL
- type OrderInfo
- type PhotoSize
- type PinChatMessageParameters
- type PreCheckoutQuery
- type ReplyKeyboardMarkup
- type ReplyKeyboardRemove
- type ReplyMarkup
- type Response
- type ResponseParameters
- type SendChatActionParameters
- type SendContactParameters
- type SendDocumentParameters
- type SendGameParameters
- type SendInvoiceParameters
- type SendLocationParameters
- type SendMediaGroupParameters
- type SendMessageParameters
- type SendPhotoParameters
- type SendVenueParameters
- type SetChatDescriptionParameters
- type SetChatPhotoParameters
- type SetChatStickerSetParameters
- type SetChatTitleParameters
- type SetGameScoreParameters
- type SetStickerPositionInSetParameters
- type SetWebhookParameters
- type ShippingAddress
- type ShippingOption
- type ShippingQuery
- type Sticker
- type StickerSet
- type SuccessfulPayment
- type UnbanChatMemberParameters
- type UnpinChatMessageParameters
- type Update
- func (upd *Update) IsCallbackQuery() bool
- func (upd *Update) IsChannelPost() bool
- func (upd *Update) IsChosenInlineResult() bool
- func (upd *Update) IsEditedChannelPost() bool
- func (upd *Update) IsEditedMessage() bool
- func (upd *Update) IsInlineQuery() bool
- func (upd *Update) IsMessage() bool
- func (upd *Update) IsPreCheckoutQuery() bool
- func (upd *Update) IsShippingQuery() bool
- func (upd *Update) Type() string
- type UpdatesChannel
- type User
- type UserProfilePhotos
- type Venue
- type Video
- type VideoNote
- type Voice
- type WebhookInfo
Constants ¶
const ( ActionFindLocation = "find_location" ActionRecordAudio = "record_audio" ActionRecordVideo = "record_video" ActionRecordVideoNote = "record_video_note" ActionTyping = "typing" ActionUploadAudio = "upload_audio" ActionUploadDocument = "upload_document" ActionUploadPhoto = "upload_photo" ActionUploadVideo = "upload_video" ActionUploadVideoNote = "upload_video_note" )
Action... represents available and supported status actions of bot
const ( ChatChannel = "channel" ChatGroup = "group" ChatPrivate = "private" ChatSuperGroup = "supergroup" )
Chat... represents available and supported chat types
const ( EntityBold = "bold" EntityBotCommand = "bot_command" EntityCode = "code" EntityEmail = "email" EntityHashtag = "hashtag" EntityItalic = "italic" EntityMention = "mention" EntityPre = "pre" EntityTextLink = "text_link" EntityTextMention = "text_mention" EntityURL = "url" )
Entity... represents available and supported entity types
const ( MethodAddStickerToSet = "addStickerToSet" MethodAnswerCallbackQuery = "answerCallbackQuery" MethodAnswerInlineQuery = "answerInlineQuery" MethodAnswerPreCheckoutQuery = "answerPreCheckoutQuery" MethodAnswerShippingQuery = "answerShippingQuery" MethodCreateNewStickerSet = "createNewStickerSet" MethodDeleteChatPhoto = "deleteChatPhoto" MethodDeleteChatStickerSet = "deleteChatStickerSet" MethodDeleteMessage = "deleteMessage" MethodDeleteStickerFromSet = "deleteStickerFromSet" MethodDeleteWebhook = "deleteWebhook" MethodEditMessageCaption = "editMessageCaption" MethodEditMessageLiveLocation = "editMessageLiveLocation" MethodEditMessageReplyMarkup = "editMessageReplyMarkup" MethodEditMessageText = "editMessageText" MethodExportChatInviteLink = "exportChatInviteLink" MethodForwardMessage = "forwardMessage" MethodGetChat = "getChat" MethodGetChatAdministrators = "getChatAdministrators" MethodGetChatMember = "getChatMember" MethodGetChatMembersCount = "getChatMembersCount" MethodGetFile = "getFile" MethodGetGameHighScores = "getGameHighScores" MethodGetMe = "getMe" MethodGetStickerSet = "getStickerSet" MethodGetUpdates = "getUpdates" MethodGetUserProfilePhotos = "getUserProfilePhotos" MethodGetWebhookInfo = "getWebhookInfo" MethodKickChatMember = "kickChatMember" MethodLeaveChat = "leaveChat" MethodPinChatMessage = "pinChatMessage" MethodPromoteChatMember = "promoteChatMember" MethodRestrictChatMember = "restrictChatMember" MethodSendAudio = "sendAudio" MethodSendChatAction = "sendChatAction" MethodSendContact = "sendContact" MethodSendDocument = "sendDocument" MethodSendGame = "sendGame" MethodSendInvoice = "sendInvoice" MethodSendLocation = "sendLocation" MethodSendMediaGroup = "sendMediaGroup" MethodSendMessage = "sendMessage" MethodSendPhoto = "sendPhoto" MethodSendSticker = "sendSticker" MethodSendVenue = "sendVenue" MethodSendVideo = "sendVideo" MethodSendVideoNote = "sendVideoNote" MethodSendVoice = "sendVoice" MethodSetChatDescription = "setChatDescription" MethodSetChatPhoto = "setChatPhoto" MethodSetChatStickerSet = "setChatStickerSet" MethodSetChatTitle = "setChatTitle" MethodSetGameScore = "setGameScore" MethodSetStickerPositionInSet = "setStickerPositionInSet" MethodSetWebhook = "setWebhook" MethodStopMessageLiveLocation = "stopMessageLiveLocation" MethodUnbanChatMember = "unbanChatMember" MethodUnpinChatMessage = "unpinChatMessage" MethodUploadStickerFile = "uploadStickerFile" )
Method... represents available and supported Telegram API methods
const ( ModeHTML = "html" ModeMarkdown = "markdown" )
Mode... represents available and supported parsing modes of messages
const ( MimeHTML = "text/html" MimeMP4 = "video/mp4" MimePDF = "application/pdf" MimeZIP = "application/zip" )
Mime... represents available and supported MIME types of data
const ( SchemeAttach = "attach" SchemeTelegram = "tg" )
Scheme... represents optional schemes for URLs
const ( StatusAdministrator = "administrator" StatusCreator = "creator" StatusKicked = "kicked" StatusLeft = "left" StatusMember = "member" StatusRestricted = "restricted" )
Status... represents available and supported statuses of ID
const ( TypeArticle = "article" TypeAudio = "audio" TypeContact = "contact" TypeDocument = "document" TypeGame = "game" TypeGIF = "gif" TypeLocation = "location" TypeMpeg4Gif = "mpeg4_gif" TypePhoto = "photo" TypeSticker = "sticker" TypeVenue = "venue" TypeVideo = "video" TypeVoice = "voice" )
Type... represents available and supported types of data
const ( UpdateCallbackQuery = "callback_query" UpdateChannelPost = "channel_post" UpdateChosenInlineResult = "chosen_inline_result" UpdateEditedChannelPost = "edited_channel_post" UpdateEditedMessage = "edited_message" UpdateInlineQuery = "inline_query" UpdateMessage = "message" UpdatePreCheckoutQuery = "pre_checkout_query" UpdateShippingQuery = "shipping_query" )
Update... represents available and supported types of updates
const Version = 3.6
Version represents current version of Telegram API supported by this package
Variables ¶
var ErrBadFileType = errors.New("bad file type")
ErrBadFileType describes error of the unsupported file data type for uploading
Functions ¶
func NewInlineMentionURL ¶
NewInlineMentionURL creates a url.URL for the mention user without username.
Types ¶
type Animation ¶
type Animation struct { // Unique file identifier FileID string `json:"file_id"` // Original animation filename as defined by sender FileName string `json:"file_name,omitempty"` // MIME type of the file as defined by sender MimeType string `json:"mime_type,omitempty"` // Animation thumbnail as defined by sender Thumb *PhotoSize `json:"thumb,omitempty"` // File size FileSize int `json:"file_size,omitempty"` }
Animation provide an animation for your game so that it looks stylish in chats (check out Lumberjack for an example). This object represents an animation file to be displayed in the message containing a game.
type AnswerCallbackQueryParameters ¶
type AnswerCallbackQueryParameters struct { // Unique identifier for the query to be answered CallbackQueryID string `json:"callback_query_id"` // Text of the notification. If not specified, nothing will be shown to the // user, 0-200 characters Text string `json:"text,omitempty"` // URL that will be opened by the user's client. If you have created a Game // and accepted the conditions via @Botfather, specify the URL that opens // your game – note that this will only work if the query comes from a // callback_game button. // // Otherwise, you may use links like t.me/your_bot?start=XXXX that open your // bot with a parameter. URL string `json:"url,omitempty"` // If true, an alert will be shown by the client instead of a notification at // the top of the chat screen. Defaults to false. ShowAlert bool `json:"show_alert,omitempty"` // The maximum amount of time in seconds that the result of the callback // query may be cached client-side. Telegram apps will support caching // starting in version 3.14. Defaults to 0. CacheTime int `json:"cache_time,omitempty"` }
AnswerCallbackQueryParameters represents data for AnswerCallbackQuery method.
func NewAnswerCallbackQuery ¶
func NewAnswerCallbackQuery(callbackQueryID string) *AnswerCallbackQueryParameters
NewAnswerCallbackQuery creates AnswerCallbackQueryParameters only with required parameters.
type AnswerInlineQueryParameters ¶
type AnswerInlineQueryParameters struct { // Unique identifier for the answered query InlineQueryID string `json:"inline_query_id"` // Pass the offset that a client should send in the next query with the same // text to receive more results. Pass an empty string if there are no more // results or if you don‘t support pagination. Offset length can’t exceed 64 // bytes. NextOffset string `json:"next_offset,omitempty"` // If passed, clients will display a button with specified text that switches // the user to a private chat with the bot and sends the bot a start message // with the parameter switch_pm_parameter SwitchPrivateMessageText string `json:"switch_pm_text,omitempty"` // Deep-linking parameter for the /start message sent to the bot when user // presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - // are allowed. SwitchPrivateMessageParameter string `json:"switch_pm_parameter,omitempty"` // A JSON-serialized array of results for the inline query Results []interface{} `json:"results"` // The maximum amount of time in seconds that the result of the inline query // may be cached on the server. Defaults to 300. CacheTime int `json:"cache_time,omitempty"` // Pass True, if results may be cached on the server side only for the user // that sent the query. By default, results may be returned to any user who // sends the same query IsPersonal bool `json:"is_personal,omitempty"` }
AnswerInlineQueryParameters represents data for AnswerInlineQuery method.
func NewAnswerInlineQuery ¶
func NewAnswerInlineQuery(inlineQueryID string, results ...interface{}) *AnswerInlineQueryParameters
NewAnswerInlineQuery creates AnswerInlineQueryParameters only with required parameters.
type AnswerPreCheckoutQueryParameters ¶
type AnswerPreCheckoutQueryParameters struct { // Unique identifier for the query to be answered PreCheckoutQueryID string `json:"pre_checkout_query_id"` // Required if ok is False. Error message in human readable form that // explains the reason for failure to proceed with the checkout (e.g. "Sorry, // somebody just bought the last of our amazing black T-shirts while you were // busy filling out your payment details. Please choose a different color or // garment!"). Telegram will display this message to the user. ErrorMessage string `json:"error_message,omitempty"` // Specify True if everything is alright (goods are available, etc.) and the // bot is ready to proceed with the order. Use False if there are any // problems. Ok bool `json:"ok"` }
AnswerPreCheckoutQueryParameters represents data for AnswerPreCheckoutQuery method.
func NewAnswerPreCheckoutQuery ¶
func NewAnswerPreCheckoutQuery(preCheckoutQueryID string, ok bool) *AnswerPreCheckoutQueryParameters
NewAnswerPreCheckoutQuery creates AnswerPreCheckoutQueryParameters only with required parameters.
type AnswerShippingQueryParameters ¶
type AnswerShippingQueryParameters struct { // Unique identifier for the query to be answered ShippingQueryID string `json:"shipping_query_id"` // Required if ok is False. Error message in human readable form that // explains why it is impossible to complete the order (e.g. "Sorry, delivery // to your desired address is unavailable'). Telegram will display this // message to the user. ErrorMessage string `json:"error_message,omitempty"` // Specify True if delivery to the specified address is possible and False // if there are any problems (for example, if delivery to the specified // address is not possible) Ok bool `json:"ok"` // Required if ok is True. A JSON-serialized array of available shipping // options. ShippingOptions []ShippingOption `json:"shipping_options,omitempty"` }
AnswerShippingQueryParameters represents data for AnswerShippingQuery method.
func NewAnswerShippingQuery ¶
func NewAnswerShippingQuery(shippingQueryID string, ok bool) *AnswerShippingQueryParameters
NewAnswerShippingQuery creates AnswerShippingQueryParameters only with required parameters.
type Audio ¶
type Audio struct { // Unique identifier for this file FileID string `json:"file_id"` // Performer of the audio as defined by sender or by audio tags Performer string `json:"performer,omitempty"` // Title of the audio as defined by sender or by audio tags Title string `json:"title,omitempty"` // MIME type of the file as defined by sender MimeType string `json:"mime_type,omitempty"` // Duration of the audio in seconds as defined by sender Duration int `json:"duration"` // File size FileSize int `json:"file_size,omitempty"` }
Audio represents an audio file to be treated as music by the Telegram clients.
type Bot ¶
Bot represents a bot user with access token getted from @BotFather.
func (*Bot) AnswerCallbackQuery ¶
func (bot *Bot) AnswerCallbackQuery(params *AnswerCallbackQueryParameters) (bool, error)
AnswerCallbackQuery 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. On success, True is returned.
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
func (*Bot) AnswerInlineQuery ¶
func (bot *Bot) AnswerInlineQuery(params *AnswerInlineQueryParameters) (bool, error)
AnswerInlineQuery send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed.
func (*Bot) AnswerPreCheckoutQuery ¶
func (bot *Bot) AnswerPreCheckoutQuery(params *AnswerShippingQueryParameters) (bool, error)
AnswerPreCheckoutQuery respond to such pre-checkout queries.
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned.
Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
func (*Bot) AnswerShippingQuery ¶
func (bot *Bot) AnswerShippingQuery(params *AnswerShippingQueryParameters) (bool, error)
AnswerShippingQuery reply to shipping queries.
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. On success, True is returned.
func (*Bot) DeleteChatPhoto ¶
DeleteChatPhoto delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
Note: In regular groups (non-supergroups), this method will only work if the 'All Members Are Admins' setting is off in the target group.
func (*Bot) DeleteChatStickerSet ¶
DeleteChatStickerSet delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
func (*Bot) DeleteMessage ¶
DeleteMessage 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; Bots can delete outgoing messages in groups and supergroups; 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. Returns True on success.
func (*Bot) DeleteStickerFromSet ¶
DeleteStickerFromSet delete a sticker from a set created by the bot. Returns True on success.
func (*Bot) DeleteWebhook ¶
DeleteWebhook remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.
func (*Bot) EditMessageCaption ¶
func (bot *Bot) EditMessageCaption(params *EditMessageCaptionParameters) (*Message, error)
EditMessageCaption edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
func (*Bot) EditMessageLiveLocation ¶
func (bot *Bot) EditMessageLiveLocation(params *EditMessageLiveLocationParameters) (*Message, error)
EditMessageLiveLocation edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
func (*Bot) EditMessageReplyMarkup ¶
func (bot *Bot) EditMessageReplyMarkup(params *EditMessageReplyMarkupParameters) (*Message, error)
EditMessageReplyMarkup edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
func (*Bot) EditMessageText ¶
func (bot *Bot) EditMessageText(params *EditMessageTextParameters) (*Message, error)
EditMessageText edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
func (*Bot) ExportChatInviteLink ¶
ExportChatInviteLink export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns exported invite link as String on success.
func (*Bot) ForwardMessage ¶
func (bot *Bot) ForwardMessage(params *ForwardMessageParameters) (*Message, error)
ForwardMessage forward messages of any kind. On success, the sent Message is returned.
func (*Bot) GetChat ¶
GetChat 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.). Returns a Chat object on success.
func (*Bot) GetChatAdministrators ¶
func (bot *Bot) GetChatAdministrators(chatID int64) ([]ChatMember, error)
GetChatAdministrators get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
func (*Bot) GetChatMember ¶
func (bot *Bot) GetChatMember(chatID int64, userID int) (*ChatMember, error)
GetChatMember get information about a member of a chat. Returns a ChatMember object on success.
func (*Bot) GetChatMembersCount ¶
GetChatMembersCount get the number of members in a chat. Returns Int on success.
func (*Bot) GetFile ¶
GetFile get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
func (*Bot) GetGameHighScores ¶
func (bot *Bot) GetGameHighScores(params *GetGameHighScoresParameters) ([]GameHighScore, error)
GetGameHighScores get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.
func (*Bot) GetMe ¶
GetMe testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.
func (*Bot) GetStickerSet ¶
func (bot *Bot) GetStickerSet(name string) (*StickerSet, error)
GetStickerSet get a sticker set. On success, a StickerSet object is returned.
func (*Bot) GetUpdates ¶
func (bot *Bot) GetUpdates(params *GetUpdatesParameters) ([]Update, error)
GetUpdates receive incoming updates using long polling (wiki). An Array of Update objects is returned.
func (*Bot) GetUserProfilePhotos ¶
func (bot *Bot) GetUserProfilePhotos(params *GetUserProfilePhotosParameters) (*UserProfilePhotos, error)
GetUserProfilePhotos get a list of profile pictures for a user. Returns a UserProfilePhotos object.
func (*Bot) GetWebhookInfo ¶
func (bot *Bot) GetWebhookInfo() (*WebhookInfo, error)
GetWebhookInfo get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.
func (*Bot) IsCommandToMe ¶
IsCommandToMe checks that the input message is a command for the current bot.
func (*Bot) IsForwardFromMe ¶
IsForwardFromMe checks that the input message is a forwarded message from the current bot.
func (*Bot) IsForwardMentionsMe ¶
IsForwardMentionsMe checks that the input forwarded message mentions the current bot.
func (*Bot) IsMessageFromMe ¶
IsMessageFromMe checks that the input message is a message from the current bot.
func (*Bot) IsMessageMentionsMe ¶
IsMessageMentionsMe checks that the input message mentions the current bot.
func (*Bot) IsMessageToMe ¶
IsMessageToMe checks that the input message is addressed to the current bot.
func (*Bot) IsReplyMentionsMe ¶
IsReplyMentionsMe checks that the input message mentions the current bot.
func (*Bot) IsReplyToMe ¶
IsReplyToMe checks that the input message is a reply to the current bot.
func (*Bot) KickChatMember ¶
func (bot *Bot) KickChatMember(params *KickChatMemberParameters) (bool, error)
KickChatMember kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
Note: In regular groups (non-supergroups), this method will only work if the 'All Members Are Admins' setting is off in the target group. Otherwise members may only be removed by the group's creator or by the member that added them.
func (*Bot) NewFileURL ¶
NewFileURL creates a url.URL to file with path getted from GetFile method.
func (*Bot) NewLongPollingChannel ¶
func (bot *Bot) NewLongPollingChannel(params *GetUpdatesParameters) UpdatesChannel
NewLongPollingChannel creates channel for receive incoming updates using long polling.
func (*Bot) NewRedirectURL ¶
NewRedirectURL creates new url.URL for redirecting from one chat to another.
func (*Bot) NewWebhookChannel ¶
func (bot *Bot) NewWebhookChannel(params *SetWebhookParameters, certFile, keyFile, set, listen, serve string) (updates UpdatesChannel)
NewWebhookChannel creates channel for receive incoming updates via an outgoing webhook.
func (*Bot) PinChatMessage ¶
func (bot *Bot) PinChatMessage(params *PinChatMessageParameters) (bool, error)
PinChatMessage pin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in the supergroup or 'can_edit_messages' admin right in the channel. Returns True on success.
func (*Bot) SendChatAction ¶
SendChatAction tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
func (*Bot) SendContact ¶
func (bot *Bot) SendContact(params *SendContactParameters) (*Message, error)
SendContact send phone contacts. On success, the sent Message is returned.
func (*Bot) SendDocument ¶
func (bot *Bot) SendDocument(params *SendDocumentParameters) (*Message, error)
SendDocument send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
func (*Bot) SendGame ¶
func (bot *Bot) SendGame(params *SendGameParameters) (*Message, error)
SendGame send a game. On success, the sent Message is returned.
func (*Bot) SendInvoice ¶
func (bot *Bot) SendInvoice(params *SendInvoiceParameters) (*Message, error)
SendInvoice send invoices. On success, the sent Message is returned.
func (*Bot) SendLocation ¶
func (bot *Bot) SendLocation(params *SendLocationParameters) (*Message, error)
SendLocation send point on the map. On success, the sent Message is returned.
func (*Bot) SendMediaGroup ¶
func (bot *Bot) SendMediaGroup(params *SendMediaGroupParameters) ([]Message, error)
SendMediaGroup send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
func (*Bot) SendMessage ¶
func (bot *Bot) SendMessage(params *SendMessageParameters) (*Message, error)
SendMessage send text messages. On success, the sent Message is returned.
func (*Bot) SendPhoto ¶
func (bot *Bot) SendPhoto(params *SendPhotoParameters) (*Message, error)
SendPhoto send photos. On success, the sent Message is returned.
func (*Bot) SendVenue ¶
func (bot *Bot) SendVenue(params *SendVenueParameters) (*Message, error)
SendVenue send information about a venue. On success, the sent Message is returned.
func (*Bot) SetChatDescription ¶
SetChatDescription change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
func (*Bot) SetChatPhoto ¶
SetChatPhoto set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
Note: In regular groups (non-supergroups), this method will only work if the 'All Members Are Admins' setting is off in the target group.
func (*Bot) SetChatStickerSet ¶
SetChatStickerSet set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
func (*Bot) SetChatTitle ¶
SetChatTitle change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
Note: In regular groups (non-supergroups), this method will only work if the 'All Members Are Admins' setting is off in the target group.
func (*Bot) SetGameScore ¶
func (bot *Bot) SetGameScore(params *SetGameScoreParameters) (*Message, error)
SetGameScore set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
func (*Bot) SetStickerPositionInSet ¶
SetStickerPositionInSet move a sticker in a set created by the bot to a specific position. Returns True on success.
func (*Bot) SetWebhook ¶
func (bot *Bot) SetWebhook(params *SetWebhookParameters) (bool, error)
SetWebhook specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns true.
If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us.
func (*Bot) UnbanChatMember ¶
UnbanChatMember unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success.
func (*Bot) UnpinChatMessage ¶
UnpinChatMessage unpin a message in a supergroup chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
func (*Bot) Upload ¶
func (bot *Bot) Upload(method, key, name string, file InputFile, args fmt.Stringer) (*Response, error)
Upload is a helper method which provide are three ways to send files (photos, stickers, audio, media, etc.):
1. If the file is already stored somewhere on the Telegram servers, you don't need to reupload it: each file object has a file_id field, simply pass this file_id as a parameter instead of uploading. There are no limits for files sent this way.
2. Provide Telegram with an *url.URL for the file to be sent. Telegram will download and send the file. 5 MB max size for photos and 20 MB max for other types of content.
3. Post the file using multipart/form-data in the usual way that files are uploaded via the browser. Use []byte or io.Reader for this. 10 MB max size for photos, 50 MB for other files.
Sending by FileID ¶
* It is not possible to change the file type when resending by file_id. I.e. a video can't be sent as a photo, a photo can't be sent as a document, etc.
* It is not possible to resend thumbnails.
* Resending a photo by file_id will send all of its sizes.
* file_id is unique for each individual bot and can't be transferred from one bot to another.
Sending by URL ¶
* When sending by *url.URL the target file must have the correct MIME type (e.g., audio/mpeg for sendAudio, etc.).
* In sendDocument, sending by URL will currently only work for gif, pdf and zip files.
* To use SendVoice, the file must have the type audio/ogg and be no more than 1MB in size. 1–20MB voice notes will be sent as files.
* Other configurations may work but we can't guarantee that they will.
type CallbackGame ¶
type CallbackGame struct{}
CallbackGame a placeholder, currently holds no information. Use BotFather to set up your game.
type CallbackQuery ¶
type CallbackQuery struct { // Unique identifier for this query ID string `json:"id"` // Identifier of the message sent via the bot in inline mode, that // originated the query. InlineMessageID string `json:"inline_message_id,omitempty"` // Global identifier, uniquely corresponding to the chat to which the // message with the callback button was sent. Useful for high scores in // games. ChatInstance string `json:"chat_instance"` // Data associated with the callback button. Be aware that a bad client // can send arbitrary data in this field. Data string `json:"data,omitempty"` // Short name of a Game to be returned, serves as the unique identifier // for the game GameShortName string `json:"game_short_name,omitempty"` // Sender From *User `json:"from"` // Message with the callback button that originated the query. Note that // message content and message date will not be available if the message // is too old Message *Message `json:"message,omitempty"` }
CallbackQuery represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters).
type Chat ¶
type Chat struct { // Unique identifier for this chat. ID int64 `json:"id"` // Type of chat, can be either "private", "group", "supergroup" or // "channel" Type string `json:"type"` // Title, for supergroups, channels and group chats Title string `json:"title,omitempty"` // Username, for private chats, supergroups and channels if available Username string `json:"username,omitempty"` // First name of the other party in a private chat FirstName string `json:"first_name,omitempty"` // Last name of the other party in a private chat LastName string `json:"last_name,omitempty"` // Description, for supergroups and channel chats. Returned only in // getChat. Description string `json:"description,omitempty"` // Chat invite link, for supergroups and channel chats. Returned only in // getChat. InviteLink string `json:"invite_link,omitempty"` // For supergroups, name of Group sticker set. Returned only in getChat. StickerSetName string `json:"sticker_set_name,omitempty"` // True if a group has ‘All Members Are Admins’ enabled. AllMembersAreAdministrators bool `json:"all_members_are_administrators,omitempty"` // True, if the bot can change group the sticker set. Returned only in // getChat. CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"` // Chat photo. Returned only in getChat. Photo *ChatPhoto `json:"photo,omitempty"` // Pinned message, for supergroups. Returned only in getChat. PinnedMessage *Message `json:"pinned_message,omitempty"` }
Chat represents a chat.
func (*Chat) FullName ¶
FullName returns the full name of chat or FirstName if LastName is not available.
func (*Chat) HasPinnedMessage ¶
HasPinnedMessage checks that the current chat has a pinned message.
func (*Chat) HasStickerSet ¶
HasStickerSet checks that the current chat has a sticker set.
func (*Chat) IsSuperGroup ¶
IsSuperGroup checks that the current chat is a supergroup.
func (*Chat) StickerSet ¶
func (chat *Chat) StickerSet(bot *Bot) *StickerSet
StickerSet return StickerSet structure if StickerSetName is available.
type ChatMember ¶
type ChatMember struct { // Information about the user User *User `json:"user"` // The member's status in the chat. Can be "creator", "administrator", // "member", "restricted", "left" or "kicked" Status string `json:"status"` // Restictred and kicked only. Date when restrictions will be lifted for // this user, unix time UntilDate int64 `json:"until_date,omitempty"` // Administrators only. True, if the bot is allowed to edit administrator // privileges of that user CanBeEdited bool `json:"can_be_edited,omitempty"` // Administrators only. True, if the administrator can change the chat // title, photo and other settings CanChangeInfo bool `json:"can_change_info,omitempty"` // Administrators only. True, if the administrator can post in the // channel, channels only CanPostMessages bool `json:"can_post_messages,omitempty"` // Administrators only. True, if the administrator can edit messages of // other users, channels only CanEditMessages bool `json:"can_edit_messages,omitempty"` // Administrators only. True, if the administrator can delete messages of // other users CanDeleteMessages bool `json:"can_delete_messages,omitempty"` // Administrators only. True, if the administrator can invite new users // to the chat CanInviteUsers bool `json:"can_invite_users,omitempty"` // Administrators only. True, if the administrator can restrict, ban or // unban chat members CanRestrictMembers bool `json:"can_restrict_members,omitempty"` // Administrators only. True, if the administrator can pin messages, // supergroups only CanPinMessages bool `json:"can_pin_messages,omitempty"` // Administrators only. True, if the administrator can add new // administrators with a subset of his own privileges or demote // administrators that he has promoted, directly or indirectly (promoted // by administrators that were appointed by the user) CanPromoteMembers bool `json:"can_promote_members,omitempty"` // Restricted only. True, if the user can send text messages, contacts, // locations and venues CanSendMessages bool `json:"can_send_messages,omitempty"` // Restricted only. True, if the user can send audios, documents, photos, // videos, video notes and voice notes, implies can_send_messages CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"` // Restricted only. True, if the user can send animations, games, // stickers and use inline bots, implies can_send_media_messages CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"` // Restricted only. True, if user may add web page previews to his // messages, implies can_send_media_messages CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` }
ChatMember contains information about one member of a chat.
func (*ChatMember) IsAdministrator ¶
func (member *ChatMember) IsAdministrator() bool
IsAdministrator checks that current member is administrator.
func (*ChatMember) IsCreator ¶
func (member *ChatMember) IsCreator() bool
IsCreator checks that current member is creator.
func (*ChatMember) IsKicked ¶
func (member *ChatMember) IsKicked() bool
IsKicked checks that current member has been kicked.
func (*ChatMember) IsLeft ¶
func (member *ChatMember) IsLeft() bool
IsLeft checks that current member has left the chat.
func (*ChatMember) IsMember ¶
func (member *ChatMember) IsMember() bool
IsMember checks that current member is a member.
func (*ChatMember) IsRestricted ¶
func (member *ChatMember) IsRestricted() bool
IsRestricted checks that current member has been restricted.
func (*ChatMember) UntilTime ¶
func (member *ChatMember) UntilTime() time.Time
UntilTime parse UntilDate of restrictions and returns time.Time.
type ChatPhoto ¶
type ChatPhoto struct { // Unique file identifier of small (160x160) chat photo. This file_id can // be used only for photo download. SmallFileID string `json:"small_file_id"` // Unique file identifier of big (640x640) chat photo. This file_id can // be used only for photo download. BigFileID string `json:"big_file_id"` }
ChatPhoto represents a chat photo.
type ChosenInlineResult ¶
type ChosenInlineResult struct { // The unique identifier for the result that was chosen ResultID string `json:"result_id"` // Identifier of the sent inline message. Available only if there is an // inline keyboard attached to the message. Will be also received in // callback queries and can be used to edit the message. InlineMessageID string `json:"inline_message_id,omitempty"` // The query that was used to obtain the result Query string `json:"query"` // The user that chose the result From *User `json:"from"` // Sender location, only for bots that require user location Location *Location `json:"location,omitempty"` }
ChosenInlineResult represents a result of an inline query that was chosen by the user and sent to their chat partner.
type Contact ¶
type Contact struct { // Contact's phone number PhoneNumber string `json:"phone_number"` // Contact's first name FirstName string `json:"first_name"` // Contact's last name LastName string `json:"last_name,omitempty"` // Contact's user identifier in Telegram UserID int `json:"user_id,omitempty"` }
Contact represents a phone contact.
type DeleteChatPhotoParameters ¶
type DeleteChatPhotoParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` }
DeleteChatPhotoParameters represents data for DeleteChatPhoto method.
type DeleteChatStickerSetParameters ¶
type DeleteChatStickerSetParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` }
DeleteChatStickerSetParameters represents data for DeleteChatStickerSet method.
type DeleteMessageParameters ¶
type DeleteMessageParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` MessageID int `json:"message_id"` }
DeleteMessageParameters represents data for DeleteMessage method.
type DeleteStickerFromSetParameters ¶
type DeleteStickerFromSetParameters struct {
Sticker string `json:"sticker"`
}
DeleteStickerFromSetParameters represents data for DeleteStickerFromSet method.
type Document ¶
type Document struct { // Unique file identifier FileID string `json:"file_id"` // Original filename as defined by sender FileName string `json:"file_name,omitempty"` // MIME type of the file as defined by sender MimeType string `json:"mime_type,omitempty"` // Document thumbnail as defined by sender Thumb *PhotoSize `json:"thumb,omitempty"` // File size FileSize int `json:"file_size,omitempty"` }
Document represents a general file (as opposed to photos, voice messages and audio files).
type EditMessageCaptionParameters ¶
type EditMessageCaptionParameters struct { // Required if inline_message_id is not specified. Unique identifier for the // target chat or username of the target channel (in the format // @channelusername) ChatID int64 `json:"chat_id,omitempty"` // Required if inline_message_id is not specified. Identifier of // the sent message MessageID int `json:"message_id,omitempty"` // Required if chat_id and message_id are not specified. Identifier of the // inline message InlineMessageID string `json:"inline_message_id,omitempty"` // New caption of the message Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // A JSON-serialized object for an inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
EditMessageCaptionParameters represents data for EditMessageCaption method.
type EditMessageLiveLocationParameters ¶
type EditMessageLiveLocationParameters struct { // Required if inline_message_id is not specified. Unique identifier for the // target chat or username of the target channel (in the format // @channelusername) ChatID int64 `json:"chat_id,omitempty"` // Required if inline_message_id is not specified. Identifier of the sent // message MessageID int `json:"message_id,omitempty"` // Required if chat_id and message_id are not specified. Identifier of the // inline message InlineMessageID string `json:"inline_message_id,omitempty"` // Latitude of new location Latitude float32 `json:"latitude"` // Longitude of new location Longitude float32 `json:"longitude"` // A JSON-serialized object for a new inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
EditMessageLiveLocationParameters represents data for EditMessageLiveLocation method.
func NewLiveLocation ¶
func NewLiveLocation(latitude, longitude float32) *EditMessageLiveLocationParameters
NewLiveLocation creates EditMessageLiveLocationParameters only with required parameters.
type EditMessageReplyMarkupParameters ¶
type EditMessageReplyMarkupParameters struct { // Required if inline_message_id is not specified. Unique identifier for the // target chat or username of the target channel (in the format // @channelusername) ChatID int64 `json:"chat_id,omitempty"` // Required if inline_message_id is not specified. Identifier of the sent // message MessageID int `json:"message_id,omitempty"` // Required if chat_id and message_id are not specified. Identifier of the // inline message InlineMessageID string `json:"inline_message_id,omitempty"` // A JSON-serialized object for an inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
EditMessageReplyMarkupParameters represents data for EditMessageReplyMarkup method.
type EditMessageTextParameters ¶
type EditMessageTextParameters struct { // Required if inline_message_id is not specified. Unique identifier for the // target chat or username of the target channel (in the format // @channelusername) ChatID int64 `json:"chat_id,omitempty"` // Required if inline_message_id is not specified. Identifier of the sent // message MessageID int `json:"message_id,omitempty"` // Required if chat_id and message_id are not specified. Identifier of the // inline message InlineMessageID string `json:"inline_message_id,omitempty"` // New text of the message Text string `json:"text"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in your bot's message. ParseMode string `json:"parse_mode,omitempty"` // Disables link previews for links in this message DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` // A JSON-serialized object for an inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
EditMessageTextParameters represents data for EditMessageText method.
func NewMessageText ¶
func NewMessageText(text string) *EditMessageTextParameters
NewMessageText creates EditMessageTextParameters only with required parameters.
type ExportChatInviteLinkParameters ¶
type ExportChatInviteLinkParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` }
ExportChatInviteLinkParameters represents data for ExportChatInviteLink method.
type File ¶
type File struct { // Unique identifier for this file FileID string `json:"file_id"` // File path. Use https://api.telegram.org/file/bot<token>/<file_path> to // get the file. FilePath string `json:"file_path,omitempty"` // File size, if known FileSize int `json:"file_size,omitempty"` }
File represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.
Maximum file size to download is 20 MB
type ForceReply ¶
type ForceReply struct { // Shows reply interface to the user, as if they manually selected the // bot‘s message and tapped ’Reply' ForceReply bool `json:"force_reply"` // Use this parameter if you want to force reply from specific users // only. Targets: 1) users that are @mentioned in the text of the Message // object; 2) if the bot's message is a reply (has reply_to_message_id), // sender of the original message. Selective bool `json:"selective,omitempty"` }
ForceReply display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
func NewForceReply ¶
func NewForceReply() *ForceReply
NewForceReply calls the response interface to the message.
type ForwardMessageParameters ¶
type ForwardMessageParameters struct { // Unique identifier for the target chat or username of the target channel (in the format @channelusername) ChatID int64 `json:"chat_id"` // Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername) FromChatID int64 `json:"from_chat_id"` // Sends the message silently. Users will receive a notification with no sound. DisableNotification bool `json:"disable_notification,omitempty"` // Message identifier in the chat specified in from_chat_id MessageID int `json:"message_id"` }
ForwardMessageParameters represents data for ForwardMessage method.
func NewForwardMessage ¶
func NewForwardMessage(from, to int64, messageID int) *ForwardMessageParameters
NewForwardMessage creates ForwardMessageParameters only with reqired parameters.
type Game ¶
type Game struct { // Title of the game Title string `json:"title"` // Description of the game Description string `json:"description"` // Brief description of the game or high scores included in the game // message. Can be automatically edited to include current high scores // for the game when the bot calls setGameScore, or manually edited // using editMessageText. 0-4096 characters. Text string `json:"text,omitempty"` // Photo that will be displayed in the game message in chats. Photo []PhotoSize `json:"photo"` // Special entities that appear in text, such as usernames, URLs, bot // commands, etc. TextEntities []MessageEntity `json:"text_entities,omitempty"` // Animation that will be displayed in the game message in chats. Upload // via BotFather Animation *Animation `json:"animation,omitempty"` }
Game represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
type GameHighScore ¶
type GameHighScore struct { // Position in high score table for the game Position int `json:"position"` // Score Score int `json:"score"` // User User *User `json:"user"` }
GameHighScore represents one row of the high scores table for a game.
type GetChatAdministratorsParameters ¶
type GetChatAdministratorsParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` }
GetChatAdministratorsParameters represents data for GetChatAdministrators method.
type GetChatMemberParameters ¶
type GetChatMemberParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` UserID int `json:"user_id"` }
GetChatMemberParameters represents data for GetChatMember method.
type GetChatMembersCountParameters ¶
type GetChatMembersCountParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` }
GetChatMembersCountParameters represents data for GetChatMembersCount method.
type GetChatParameters ¶
type GetChatParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` }
GetChatParameters represents data for GetChat method.
type GetFileParameters ¶
type GetFileParameters struct {
FileID string `json:"file_id"`
}
GetFileParameters represents data for GetFile method.
type GetGameHighScoresParameters ¶
type GetGameHighScoresParameters struct { // Target user id UserID int `json:"user_id"` // Required if inline_message_id is not specified. Identifier of the sent // message MessageID int `json:"message_id,omitempty"` // Required if inline_message_id is not specified. Unique identifier for the // target chat ChatID int64 `json:"chat_id,omitempty"` // Required if chat_id and message_id are not specified. Identifier of the // inline message InlineMessageID string `json:"inline_message_id,omitempty"` }
GetGameHighScoresParameters represents data for GetGameHighScores method.
func NewGameHighScores ¶
func NewGameHighScores(userID int) *GetGameHighScoresParameters
NewGameHighScores creates GetGameHighScoresParameters only with required parameters.
type GetStickerSetParameters ¶
type GetStickerSetParameters struct {
Name string `json:"name"`
}
GetStickerSetParameters represents data for GetStickerSet method.
type GetUpdatesParameters ¶
type GetUpdatesParameters struct { // Identifier of the first update to be returned. Must be greater by one than // the highest among the identifiers of previously received updates. By // default, updates starting with the earliest unconfirmed update are // returned. An update is considered confirmed as soon as getUpdates is // called with an offset higher than its update_id. The negative offset can // be specified to retrieve updates starting from -offset update from the // end of the updates queue. All previous updates will forgotten. Offset int `json:"offset,omitempty"` // Limits the number of updates to be retrieved. Values between 1—100 are // accepted. Defaults to 100. Limit int `json:"limit,omitempty"` // Timeout in seconds for long polling. Defaults to 0, i.e. usual short // polling. Should be positive, short polling should be used for testing // purposes only. Timeout int `json:"timeout,omitempty"` // List the types of updates you want your bot to receive. For example, // specify [“message”, “edited_channel_post”, “callback_query”] to only // receive updates of these types. See Update for a complete list of // available update types. Specify an empty list to receive all updates // regardless of type (default). If not specified, the previous setting will // be used. // // Please note that this parameter doesn't affect updates created before the // call to the getUpdates, so unwanted updates may be received for a short // period of time. AllowedUpdates []string `json:"allowed_updates,omitempty"` }
GetUpdatesParameters represents data for GetUpdates method.
type GetUserProfilePhotosParameters ¶
type GetUserProfilePhotosParameters struct { UserID int `json:"user_id"` Offset int `json:"offset"` Limit int `json:"limit"` }
GetUserProfilePhotosParameters represents data for GetUserProfilePhotos method.
type InlineKeyboardButton ¶
type InlineKeyboardButton struct { // Label text on the button Text string `json:"text"` // HTTP url to be opened when button is pressed URL string `json:"url,omitempty"` // Data to be sent in a callback query to the bot when button is pressed, // 1-64 bytes CallbackData string `json:"callback_data,omitempty"` // If set, pressing the button will prompt the user to select one of // their chats, open that chat and insert the bot‘s username and the // specified inline query in the input field. Can be empty, in which // case just the bot’s username will be inserted. // // Note: This offers an easy way for users to start using your bot in // inline mode when they are currently in a private chat with it. // Especially useful when combined with switch_pm… actions – in this case // the user will be automatically returned to the chat they switched // from, skipping the chat selection screen. SwitchInlineQuery string `json:"switch_inline_query,omitempty"` // If set, pressing the button will insert the bot‘s username and the // specified inline query in the current chat's input field. Can be // empty, in which case only the bot’s username will be inserted. // // This offers a quick way for the user to open your bot in inline mode // in the same chat – good for selecting something from multiple options. SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"` // Description of the game that will be launched when the user presses // the button. // // NOTE: This type of button must always be the first button in the // first row. CallbackGame *CallbackGame `json:"callback_game,omitempty"` // Specify True, to send a Pay button. // // NOTE: This type of button must always be the first button in the // first row. Pay bool `json:"pay,omitempty"` }
InlineKeyboardButton represents one button of an inline keyboard. You must use exactly one of the optional fields.
func NewInlineKeyboardButton ¶
func NewInlineKeyboardButton(text, data string) InlineKeyboardButton
NewInlineKeyboardButton creates a new inline keyboard callback button.
func NewInlineKeyboardButtonGame ¶
func NewInlineKeyboardButtonGame(text string) InlineKeyboardButton
NewInlineKeyboardButtonGame creates a new inline keyboard button with game callback.
func NewInlineKeyboardButtonPay ¶
func NewInlineKeyboardButtonPay(text string) InlineKeyboardButton
NewInlineKeyboardButtonPay creates a new inline keyboard button with pay callback.
func NewInlineKeyboardButtonSwitch ¶
func NewInlineKeyboardButtonSwitch(text, query string) InlineKeyboardButton
NewInlineKeyboardButtonSwitch creates a new inline keyboard button to make specific inline query in other chat.
func NewInlineKeyboardButtonSwitchSelf ¶
func NewInlineKeyboardButtonSwitchSelf(text, query string) InlineKeyboardButton
NewInlineKeyboardButtonSwitchSelf creates a new inline keyboard button to make specific inline query in same chat.
func NewInlineKeyboardButtonURL ¶
func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton
NewInlineKeyboardButtonURL creates a new inline keyboard button with URL.
func NewInlineKeyboardRow ¶
func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton
NewInlineKeyboardRow creates a new inline keyboard row for buttons.
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct { // Array of button rows, each represented by an Array of // InlineKeyboardButton objects InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"` }
InlineKeyboardMarkup represents an inline keyboard that appears right next to the message it belongs to.
func NewInlineKeyboardMarkup ¶
func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) *InlineKeyboardMarkup
NewInlineKeyboardMarkup creates a new inline keyboard markup for message.
type InlineQuery ¶
type InlineQuery struct { // Unique identifier for this query ID string `json:"id"` // Text of the query (up to 512 characters) Query string `json:"query"` // Offset of the results to be returned, can be controlled by the bot Offset string `json:"offset"` // Sender From *User `json:"from"` // Sender location, only for bots that request user location Location *Location `json:"location,omitempty"` }
InlineQuery represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
type InlineQueryResult ¶
type InlineQueryResult interface { NewInlineQueryResultCachedAudio(resultID, fileID string) *InlineQueryResultCachedAudio NewInlineQueryResultCachedDocument(resultID, fileID, title string) *InlineQueryResultCachedDocument NewInlineQueryResultCachedGif(resultID, fileID string) *InlineQueryResultCachedGif NewInlineQueryResultCachedMpeg4Gif(resultID, fileID string) *InlineQueryResultCachedMpeg4Gif NewInlineQueryResultCachedPhoto(resultID, fileID string) *InlineQueryResultCachedPhoto NewInlineQueryResultCachedSticker(resultID, fileID string) *InlineQueryResultCachedSticker NewInlineQueryResultCachedVideo(resultID, fileID, title string) *InlineQueryResultCachedVideo NewInlineQueryResultCachedVoice(resultID, fileID, title string) *InlineQueryResultCachedVoice NewInlineQueryResultArticle(resultID, title, content *InputMessageContent) *InlineQueryResultArticle NewInlineQueryResultAudio(resultID, audioURL, title string) *InlineQueryResultAudio NewInlineQueryResultContact(resultID, phoneNumber, firstName string) *InlineQueryResultContact NewInlineQueryResultGame(resultID, gameShortName string) *InlineQueryResultGame NewInlineQueryResultDocument(resultID, title, documentURL, mimeType string) *InlineQueryResultDocument NewInlineQueryResultGif(resultID, gifURL, thumbURL string) *InlineQueryResultGif NewInlineQueryResultLocation(resultID, title string, latitude, longitude float32) *InlineQueryResultLocation NewInlineQueryResultMpeg4Gif(resultID, mpeg4URL, thumbURL string) *InlineQueryResultMpeg4Gif NewInlineQueryResultPhoto(resultID, photoURL, thumbURL string) *InlineQueryResultPhoto NewInlineQueryResultVenue(resultID, title, address string, latitude, longitude float32) *InlineQueryResultVenue NewInlineQueryResultVideo(resultID, videoURL, mimeType, thumbURL, title string) *InlineQueryResultVideo NewInlineQueryResultVoice(resultID, voiceURL, title string) *InlineQueryResultVoice }
InlineQueryResult represents one result of an inline query.
type InlineQueryResultArticle ¶
type InlineQueryResultArticle struct { // Type of the result, must be article Type string `json:"type"` // Unique identifier for this result, 1-64 Bytes ID string `json:"id"` //Title of the result Title string `json:"title"` // URL of the result URL string `json:"url,omitempty"` // Short description of the result Description string `json:"description,omitempty"` // Url of the thumbnail for the result ThumbURL string `json:"thumb_url,omitempty"` // Content of the message to be sent InputMessageContent interface{} `json:"input_message_content"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Pass True, if you don't want the URL to be shown in the message HideURL bool `json:"hide_url,omitempty"` // Thumbnail width ThumbWidth int `json:"thumb_width,omitempty"` // Thumbnail height ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultArticle represents a link to an article or web page.
func NewInlineQueryResultArticle ¶
func NewInlineQueryResultArticle(resultID, title string, content *InputMessageContent) *InlineQueryResultArticle
NewInlineQueryResultArticle creates a new inline query result with article.
type InlineQueryResultAudio ¶
type InlineQueryResultAudio struct { // Type of the result, must be audio Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid URL for the audio file AudioURL string `json:"audio_url"` // Title Title string `json:"title"` // Caption, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Performer Performer string `json:"performer,omitempty"` // Audio duration in seconds AudioDuration int `json:"audio_duration,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the audio InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultAudio represents a link to an mp3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
func NewInlineQueryResultAudio ¶
func NewInlineQueryResultAudio(resultID, audioURL, title string) *InlineQueryResultAudio
NewInlineQueryResultAudio creates a new inline query result with audio.
type InlineQueryResultCachedAudio ¶
type InlineQueryResultCachedAudio struct { // Type of the result, must be audio Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid file identifier for the audio file AudioFileID string `json:"audio_file_id"` // Caption, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the audio InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultCachedAudio represents a link to an mp3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
func NewInlineQueryResultCachedAudio ¶
func NewInlineQueryResultCachedAudio(resultID, fileID string) *InlineQueryResultCachedAudio
NewInlineQueryResultCachedAudio creates a new inline query result with cached audio.
type InlineQueryResultCachedDocument ¶
type InlineQueryResultCachedDocument struct { // Type of the result, must be document Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // Title for the result Title string `json:"title"` // A valid file identifier for the file DocumentFileID string `json:"document_file_id"` // Short description of the result Description string `json:"description,omitempty"` // Caption of the document to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the file InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultCachedDocument represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
func NewInlineQueryResultCachedDocument ¶
func NewInlineQueryResultCachedDocument(resultID, fileID, title string) *InlineQueryResultCachedDocument
NewInlineQueryResultCachedDocument creates a new inline query result with cached document.
type InlineQueryResultCachedGif ¶
type InlineQueryResultCachedGif struct { // Type of the result, must be gif Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid file identifier for the GIF file GifFileID string `json:"gif_file_id"` // Title for the result Title string `json:"title,omitempty"` // Caption of the GIF file to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the GIF animation InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultCachedGif represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
func NewInlineQueryResultCachedGif ¶
func NewInlineQueryResultCachedGif(resultID, fileID string) *InlineQueryResultCachedGif
NewInlineQueryResultCachedGif creates a new inline query result with cached GIF.
type InlineQueryResultCachedMpeg4Gif ¶
type InlineQueryResultCachedMpeg4Gif struct { // Type of the result, must be mpeg4_gif Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid file identifier for the MP4 file Mpeg4FileID string `json:"mpeg4_file_id"` // Title for the result Title string `json:"title,omitempty"` // Caption of the MPEG-4 file to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the video animation InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultCachedMpeg4Gif represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
func NewInlineQueryResultCachedMpeg4Gif ¶
func NewInlineQueryResultCachedMpeg4Gif(resultID, fileID string) *InlineQueryResultCachedMpeg4Gif
NewInlineQueryResultCachedMpeg4Gif creates a new inline query result with cached MPEG GIF.
type InlineQueryResultCachedPhoto ¶
type InlineQueryResultCachedPhoto struct { // Type of the result, must be photo Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid file identifier of the photo PhotoFileID string `json:"photo_file_id"` // Title for the result Title string `json:"title,omitempty"` // Short description of the result Description string `json:"description,omitempty"` // Caption of the photo to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the photo InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultCachedPhoto represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
func NewInlineQueryResultCachedPhoto ¶
func NewInlineQueryResultCachedPhoto(resultID, fileID string) *InlineQueryResultCachedPhoto
NewInlineQueryResultCachedPhoto creates a new inline query result with cached photo.
type InlineQueryResultCachedSticker ¶
type InlineQueryResultCachedSticker struct { // Type of the result, must be sticker Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid file identifier of the sticker StickerFileID string `json:"sticker_file_id"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the sticker InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultCachedSticker represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
func NewInlineQueryResultCachedSticker ¶
func NewInlineQueryResultCachedSticker(resultID, fileID string) *InlineQueryResultCachedSticker
NewInlineQueryResultCachedSticker creates a new inline query result with cached sticker.
type InlineQueryResultCachedVideo ¶
type InlineQueryResultCachedVideo struct { // Type of the result, must be video Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid file identifier for the video file VideoFileID string `json:"video_file_id"` // Title for the result Title string `json:"title"` // Short description of the result Description string `json:"description,omitempty"` // Caption of the video to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the video InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultCachedVideo represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
func NewInlineQueryResultCachedVideo ¶
func NewInlineQueryResultCachedVideo(resultID, fileID, title string) *InlineQueryResultCachedVideo
NewInlineQueryResultCachedVideo creates a new inline query result with cached video.
type InlineQueryResultCachedVoice ¶
type InlineQueryResultCachedVoice struct { // Type of the result, must be voice Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid file identifier for the voice message VoiceFileID string `json:"voice_file_id"` // Voice message title Title string `json:"title"` // Caption, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the voice message InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultCachedVoice represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
func NewInlineQueryResultCachedVoice ¶
func NewInlineQueryResultCachedVoice(resultID, fileID, title string) *InlineQueryResultCachedVoice
NewInlineQueryResultCachedVoice creates a new inline query result with cached voice.
type InlineQueryResultContact ¶
type InlineQueryResultContact struct { // Type of the result, must be contact Type string `json:"type"` // Unique identifier for this result, 1-64 Bytes ID string `json:"id"` // Contact's phone number PhoneNumber string `json:"phone_number"` // Contact's first name FirstName string `json:"first_name"` // Contact's last name LastName string `json:"last_name,omitempty"` // Url of the thumbnail for the result ThumbURL string `json:"thumb_url,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the contact InputMessageContent interface{} `json:"input_message_content,omitempty"` // Thumbnail width ThumbWidth int `json:"thumb_width,omitempty"` // Thumbnail height ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultContact represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
func NewInlineQueryResultContact ¶
func NewInlineQueryResultContact(resultID, phoneNumber, firstName string) *InlineQueryResultContact
NewInlineQueryResultContact creates a new inline query result with contact.
type InlineQueryResultDocument ¶
type InlineQueryResultDocument struct { // Type of the result, must be document Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // Title for the result Title string `json:"title"` // Caption of the document to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // A valid URL for the file DocumentURL string `json:"document_url"` // Mime type of the content of the file, either "application/pdf" or // "application/zip" MimeType string `json:"mime_type"` // Short description of the result Description string `json:"description,omitempty"` // URL of the thumbnail (jpeg only) for the file ThumbURL string `json:"thumb_url,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the file InputMessageContent interface{} `json:"input_message_content,omitempty"` // Thumbnail width ThumbWidth int `json:"thumb_width,omitempty"` // Thumbnail height ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultDocument represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
func NewInlineQueryResultDocument ¶
func NewInlineQueryResultDocument(resultID, title, documentURL, mimeType string) *InlineQueryResultDocument
NewInlineQueryResultDocument creates a new inline query result with document.
type InlineQueryResultGame ¶
type InlineQueryResultGame struct { // Type of the result, must be game Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // Short name of the game GameShortName string `json:"game_short_name"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
InlineQueryResultGame represents a Game.
func NewInlineQueryResultGame ¶
func NewInlineQueryResultGame(resultID, gameShortName string) *InlineQueryResultGame
NewInlineQueryResultGame creates a new inline query result with game.
type InlineQueryResultGif ¶
type InlineQueryResultGif struct { // Type of the result, must be gif Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid URL for the GIF file. File size must not exceed 1MB GifURL string `json:"gif_url"` // URL of the static thumbnail for the result (jpeg or gif) ThumbURL string `json:"thumb_url"` // Title for the result Title string `json:"title,omitempty"` // Caption of the GIF file to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Width of the GIF GifWidth int `json:"gif_width,omitempty"` // Height of the GIF GifHeight int `json:"gif_height,omitempty"` // Duration of the GIF GifDuration int `json:"gif_duration,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the GIF animation InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultGif represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
func NewInlineQueryResultGif ¶
func NewInlineQueryResultGif(resultID, gifURL, thumbURL string) *InlineQueryResultGif
NewInlineQueryResultGif creates a new inline query result with GIF.
type InlineQueryResultLocation ¶
type InlineQueryResultLocation struct { // Type of the result, must be location Type string `json:"type"` // Unique identifier for this result, 1-64 Bytes ID string `json:"id"` // Location title Title string `json:"title"` //Url of the thumbnail for the result ThumbURL string `json:"thumb_url,omitempty"` // Location latitude in degrees Latitude float32 `json:"latitude"` // Location longitude in degrees Longitude float32 `json:"longitude"` //Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` //Content of the message to be sent instead of the location InputMessageContent interface{} `json:"input_message_content,omitempty"` //Thumbnail width ThumbWidth int `json:"thumb_width,omitempty"` //Thumbnail height ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultLocation represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
func NewInlineQueryResultLocation ¶
func NewInlineQueryResultLocation(resultID, title string, latitude, longitude float32) *InlineQueryResultLocation
NewInlineQueryResultLocation creates a new inline query result with location.
type InlineQueryResultMpeg4Gif ¶
type InlineQueryResultMpeg4Gif struct { // Type of the result, must be mpeg4_gif Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid URL for the MP4 file. File size must not exceed 1MB Mpeg4URL string `json:"mpeg4_url"` // URL of the static thumbnail (jpeg or gif) for the result ThumbURL string `json:"thumb_url"` // Title for the result Title string `json:"title,omitempty"` // Caption of the MPEG-4 file to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Video width Mpeg4Width int `json:"mpeg4_width,omitempty"` // Video height Mpeg4Height int `json:"mpeg4_height,omitempty"` // Video duration Mpeg4Duration int `json:"mpeg4_duration,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the video animation InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultMpeg4Gif represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
func NewInlineQueryResultMpeg4Gif ¶
func NewInlineQueryResultMpeg4Gif(resultID, mpeg4URL, thumbURL string) *InlineQueryResultMpeg4Gif
NewInlineQueryResultMpeg4Gif creates a new inline query result with MPEG GIF.
type InlineQueryResultPhoto ¶
type InlineQueryResultPhoto struct { // Type of the result, must be photo Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid URL of the photo. Photo must be in jpeg format. Photo size // must not exceed 5MB PhotoURL string `json:"photo_url"` // URL of the thumbnail for the photo ThumbURL string `json:"thumb_url"` // Title for the result Title string `json:"title,omitempty"` // Short description of the result Description string `json:"description,omitempty"` // Caption of the photo to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Width of the photo PhotoWidth int `json:"photo_width,omitempty"` // Height of the photo PhotoHeight int `json:"photo_height,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the photo InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultPhoto represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
func NewInlineQueryResultPhoto ¶
func NewInlineQueryResultPhoto(resultID, photoURL, thumbURL string) *InlineQueryResultPhoto
NewInlineQueryResultPhoto creates a new inline query result with photo.
type InlineQueryResultVenue ¶
type InlineQueryResultVenue struct { // Type of the result, must be venue Type string `json:"type"` // Unique identifier for this result, 1-64 Bytes ID string `json:"id"` // Title of the venue Title string `json:"title"` // Address of the venue Address string `json:"address"` // Foursquare identifier of the venue if known FoursquareID string `json:"foursquare_id,omitempty"` // Url of the thumbnail for the result ThumbURL string `json:"thumb_url,omitempty"` // Latitude of the venue location in degrees Latitude float32 `json:"latitude"` // Longitude of the venue location in degrees Longitude float32 `json:"longitude"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the venue InputMessageContent interface{} `json:"input_message_content,omitempty"` // Thumbnail width ThumbWidth int `json:"thumb_width,omitempty"` // Thumbnail height ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultVenue represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
func NewInlineQueryResultVenue ¶
func NewInlineQueryResultVenue(resultID, title, address string, latitude, longitude float32) *InlineQueryResultVenue
NewInlineQueryResultVenue creates a new inline query result with venue.
type InlineQueryResultVideo ¶
type InlineQueryResultVideo struct { // Type of the result, must be video Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid URL for the embedded video player or video file VideoURL string `json:"video_url"` // Mime type of the content of video url, "text/html" or "video/mp4" MimeType string `json:"mime_type"` // URL of the thumbnail (jpeg only) for the video ThumbURL string `json:"thumb_url"` // Title for the result Title string `json:"title"` // Caption of the video to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Short description of the result Description string `json:"description,omitempty"` // Video width VideoWidth int `json:"video_width,omitempty"` // Video height VideoHeight int `json:"video_height,omitempty"` // Video duration in seconds VideoDuration int `json:"video_duration,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the video. This field is // required if InlineQueryResultVideo is used to send an HTML-page as a // result (e.g., a YouTube video). InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultVideo represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content.
func NewInlineQueryResultVideo ¶
func NewInlineQueryResultVideo(resultID, videoURL, mimeType, thumbURL, title string) *InlineQueryResultVideo
NewInlineQueryResultVideo creates a new inline query result with video.
type InlineQueryResultVoice ¶
type InlineQueryResultVoice struct { // Type of the result, must be voice Type string `json:"type"` // Unique identifier for this result, 1-64 bytes ID string `json:"id"` // A valid URL for the voice recording VoiceURL string `json:"voice_url"` // Recording title Title string `json:"title"` // Caption, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Recording duration in seconds VoiceDuration int `json:"voice_duration,omitempty"` // Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Content of the message to be sent instead of the voice recording InputMessageContent interface{} `json:"input_message_content,omitempty"` }
InlineQueryResultVoice represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
func NewInlineQueryResultVoice ¶
func NewInlineQueryResultVoice(resultID, voiceURL, title string) *InlineQueryResultVoice
NewInlineQueryResultVoice creates a new inline query result with voice.
type InputContactMessageContent ¶
type InputContactMessageContent struct { // Contact's phone number PhoneNumber string `json:"phone_number"` // Contact's first name FirstName string `json:"first_name"` // Contact's last name LastName string `json:"last_name,omitempty"` }
InputContactMessageContent represents the content of a contact message to be sent as the result of an inline query.
func NewInputContactMessageContent ¶
func NewInputContactMessageContent(phoneNumber, firstName string) *InputContactMessageContent
NewInputContactMessageContent creates a new contact.
type InputFile ¶
type InputFile interface{}
InputFile represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.
type InputLocationMessageContent ¶
type InputLocationMessageContent struct { // Latitude of the location in degrees Latitude float32 `json:"latitude"` // Longitude of the location in degrees Longitude float32 `json:"longitude"` }
InputLocationMessageContent represents the content of a location message to be sent as the result of an inline query.
func NewInputLocationMessageContent ¶
func NewInputLocationMessageContent(latitude, longitude float32) *InputLocationMessageContent
NewInputLocationMessageContent creates a new location.
type InputMedia ¶
type InputMedia interface { NewInputMediaPhoto(media InputFile) *InputMediaPhoto NewInputMediaVideo(media InputFile) *InputMediaVideo }
InputMedia represents the content of a media message to be sent. It should be one of
type InputMediaPhoto ¶
type InputMediaPhoto struct { // Type of the result, must be photo Type string `json:"type"` // File to send. Pass a file_id to send a file that exists on the // Telegram servers (recommended), pass an HTTP URL for Telegram to get // a file from the Internet, or pass "attach://<file_attach_name>" to // upload a new one using multipart/form-data under <file_attach_name> // name. Media string `json:"media"` // Caption of the photo to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` }
InputMediaPhoto represents a photo to be sent.
func NewInputMediaPhoto ¶
func NewInputMediaPhoto(media string) *InputMediaPhoto
NewInputMediaPhoto creates a new photo in media album.
type InputMediaVideo ¶
type InputMediaVideo struct { // Type of the result, must be video Type string `json:"type"` // File to send. Pass a file_id to send a file that exists on the // Telegram servers (recommended), pass an HTTP URL for Telegram to get // a file from the Internet, or pass "attach://<file_attach_name>" to // upload a new one using multipart/form-data under <file_attach_name> // name. Media string `json:"media"` // Caption of the video to be sent, 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Video width Width int `json:"width,omitempty"` // Video height Height int `json:"height,omitempty"` // Video duration Duration int `json:"duration,omitempty"` // Pass true, if the uploaded video is suitable for streaming SupportsStreaming bool `json:"supports_streaming,omitempty"` }
InputMediaVideo represents a video to be sent.
func NewInputMediaVideo ¶
func NewInputMediaVideo(media string) *InputMediaVideo
NewInputMediaVideo creates a new video in media album.
type InputMessageContent ¶
type InputMessageContent interface { NewInputTextMessageContent(messageText string) *InputTextMessageContent NewInputLocationMessageContent(latitude, longitude float32) *InputLocationMessageContent NewInputVenueMessageContent(latitude, longitude float32, title, address string) *InputVenueMessageContent NewInputContactMessageContent(phoneNumber, firstName string) *InputContactMessageContent }
InputMessageContent represents the content of a message to be sent as a result of an inline query.
type InputTextMessageContent ¶
type InputTextMessageContent struct { // Text of the message to be sent, 1-4096 characters MessageText string `json:"message_text"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in your bot's message. ParseMode string `json:"parse_mode,omitempty"` // Disables link previews for links in the sent message DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` }
InputTextMessageContent represents the content of a text message to be sent as the result of an inline query.
func NewInputTextMessageContent ¶
func NewInputTextMessageContent(messageText string) *InputTextMessageContent
NewInputTextMessageContent creates a new text of message.
type InputVenueMessageContent ¶
type InputVenueMessageContent struct { // Latitude of the venue in degrees Latitude float32 `json:"latitude"` // Longitude of the venue in degrees Longitude float32 `json:"longitude"` // Name of the venue Title string `json:"title"` // Address of the venue Address string `json:"address"` // Foursquare identifier of the venue, if known FoursquareID string `json:"foursquare_id,omitempty"` }
InputVenueMessageContent represents the content of a venue message to be sent as the result of an inline query.
func NewInputVenueMessageContent ¶
func NewInputVenueMessageContent(latitude, longitude float32, title, address string) *InputVenueMessageContent
NewInputVenueMessageContent creates a new venue.
type Invoice ¶
type Invoice struct { // Product name Title string `json:"title"` // Product description Description string `json:"description"` // Unique bot deep-linking parameter that can be used to generate this // invoice StartParameter string `json:"start_parameter"` // Three-letter ISO 4217 currency code Currency string `json:"currency"` // Total price in the smallest units of the currency (integer, not // float/double). For example, for a price of US$ 1.45 pass amount = 145. // See the exp parameter in currencies.json, it shows the number of // digits past the decimal point for each currency (2 for the majority // of currencies). TotalAmount int `json:"total_amount"` }
Invoice contains basic information about an invoice.
type KeyboardButton ¶
type KeyboardButton struct { // Text of the button. If none of the optional fields are used, it will // be sent to the bot as a message when the button is pressed Text string `json:"text"` // If True, the user's phone number will be sent as a contact when the // button is pressed. Available in private chats only RequestContact bool `json:"request_contact,omitempty"` // If True, the user's current location will be sent when the button is // pressed. Available in private chats only RequestLocation bool `json:"request_location,omitempty"` }
KeyboardButton represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.
func NewReplyKeyboardButton ¶
func NewReplyKeyboardButton(text string) KeyboardButton
NewReplyKeyboardButton creates new button with custom text for sending it.
func NewReplyKeyboardButtonContact ¶
func NewReplyKeyboardButtonContact(text string) KeyboardButton
NewReplyKeyboardButtonContact creates new button with custom text for sending user contact.
func NewReplyKeyboardButtonLocation ¶
func NewReplyKeyboardButtonLocation(text string) KeyboardButton
NewReplyKeyboardButtonLocation creates new button with custom text for sending user location.
func NewReplyKeyboardRow ¶
func NewReplyKeyboardRow(buttons ...KeyboardButton) []KeyboardButton
NewReplyKeyboardRow creates new keyboard row for buttons.
type KickChatMemberParameters ¶
type KickChatMemberParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` UntilDate int64 `json:"until_date"` UserID int `json:"user_id"` }
KickChatMemberParameters represents data for KickChatMember method.
type LabeledPrice ¶
type LabeledPrice struct { // Portion label Label string `json:"label"` // Price of the product in the smallest units of the currency (integer, // not float/double). For example, for a price of US$ 1.45 pass amount = // 145. See the exp parameter in currencies.json, it shows the number of // digits past the decimal point for each currency (2 for the majority // of currencies). Amount int `json:"amount"` }
LabeledPrice represents a portion of the price for goods or services.
type LeaveChatParameters ¶
type LeaveChatParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` }
LeaveChatParameters represents data for LeaveChat method.
type Location ¶
type Location struct { // Longitude as defined by sender Longitude float32 `json:"longitude"` // Latitude as defined by sender Latitude float32 `json:"latitude"` }
Location represents a point on the map.
type MaskPosition ¶
type MaskPosition struct { // The part of the face relative to which the mask should be placed. One // of "forehead", "eyes", "mouth", or "chin". Point string `json:"point"` // Shift by X-axis measured in widths of the mask scaled to the face // size, from left to right. For example, choosing -1.0 will place mask // just to the left of the default mask position. XShift float32 `json:"x_shift"` // Shift by Y-axis measured in heights of the mask scaled to the face // size, from top to bottom. For example, 1.0 will place the mask just // below the default mask position. YShift float32 `json:"y_shift"` // Mask scaling coefficient. For example, 2.0 means double size. Scale float32 `json:"scale"` }
MaskPosition describes the position on faces where a mask should be placed by default.
type Message ¶
type Message struct { // Unique message identifier inside this chat ID int `json:"message_id"` // For messages forwarded from channels, identifier of the original // message in the channel ForwardFromMessageID int `json:"forward_from_message_id,omitempty"` // Sender, empty for messages sent to channels From *User `json:"from,omitempty"` // For forwarded messages, sender of the original message ForwardFrom *User `json:"forward_from,omitempty"` // A member was removed from the group, information about them (this // member may be the bot itself) LeftChatMember *User `json:"left_chat_member,omitempty"` // Date the message was sent in Unix time Date int64 `json:"date"` // For forwarded messages, date the original message was sent in Unix // time ForwardDate int64 `json:"forward_date,omitempty"` // Date the message was last edited in Unix time EditDate int64 `json:"edit_date,omitempty"` // The group has been migrated to a supergroup with the specified // identifier. MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"` // The supergroup has been migrated from a group with the specified // identifier. MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"` // Conversation the message belongs to Chat *Chat `json:"chat"` // For messages forwarded from channels, information about the original // channel ForwardFromChat *Chat `json:"forward_from_chat,omitempty"` // For messages forwarded from channels, signature of the post author if // present ForwardSignature string `json:"forward_signature,omitempty"` // The unique identifier of a media message group this message belongs to MediaGroupID string `json:"media_group_id,omitempty"` // Signature of the post author for messages in channels AuthorSignature string `json:"author_signature,omitempty"` // For text messages, the actual UTF-8 text of the message, 0-4096 // characters. Text string `json:"text,omitempty"` // Caption for the document, photo or video, 0-200 characters Caption string `json:"caption,omitempty"` // A chat title was changed to this value NewChatTitle string `json:"new_chat_title,omitempty"` // The domain name of the website on which the user has logged in. ConnectedWebsite string `json:"connected_website,omitempty"` // For replies, the original message. Note that the Message object in // this field will not contain further reply_to_message fields even if it // itself is a reply. ReplyToMessage *Message `json:"reply_to_message,omitempty"` // Specified message was pinned. Note that the Message object in this // field will not contain further reply_to_message fields even if it is // itself a reply. PinnedMessage *Message `json:"pinned_message,omitempty"` // For text messages, special entities like usernames, URLs, bot // commands, etc. that appear in the text Entities []MessageEntity `json:"entities,omitempty"` // For messages with a caption, special entities like usernames, URLs, // bot commands, etc. that appear in the caption CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` // Message is an audio file, information about the file Audio *Audio `json:"audio,omitempty"` // Message is a general file, information about the file Document *Document `json:"document,omitempty"` // Message is a game, information about the game. Game *Game `json:"game,omitempty"` // Message is a photo, available sizes of the photo Photo []PhotoSize `json:"photo,omitempty"` // A chat photo was change to this value NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"` // Message is a sticker, information about the sticker Sticker *Sticker `json:"sticker,omitempty"` // Message is a video, information about the video Video *Video `json:"video,omitempty"` // Message is a voice message, information about the file Voice *Voice `json:"voice,omitempty"` // Message is a video note, information about the video message VideoNote *VideoNote `json:"video_note,omitempty"` // Message is a shared contact, information about the contact Contact *Contact `json:"contact,omitempty"` // Message is a shared location, information about the location Location *Location `json:"location,omitempty"` // Message is a venue, information about the venue Venue *Venue `json:"venue,omitempty"` // New members that were added to the group or supergroup and information // about them (the bot itself may be one of these members) NewChatMembers []User `json:"new_chat_members,omitempty"` // Service message: the chat photo was deleted DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"` // Service message: the group has been created GroupChatCreated bool `json:"group_chat_created,omitempty"` // Service message: the supergroup has been created. This field can‘t be // received in a message coming through updates, because bot can’t be a // member of a supergroup when it is created. It can only be found in // reply_to_message if someone replies to a very first message in a // directly created supergroup. SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"` // Service message: the channel has been created. This field can‘t be // received in a message coming through updates, because bot can’t be a // member of a channel when it is created. It can only be found in // reply_to_message if someone replies to a very first message in a // channel. ChannelChatCreated bool `json:"channel_chat_created,omitempty"` // Message is an invoice for a payment, information about the invoice. Invoice *Invoice `json:"invoice,omitempty"` // Message is a service message about a successful payment, information // about the payment. SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"` }
Message represents a message.
func (*Message) Command ¶
Command returns identifier of the bot command without bot username, if it was available
func (*Message) CommandArgument ¶
CommandArgument returns raw command argument.
func (*Message) ForwardTime ¶
ForwardTime parse current message ForwardDate and returns time.Time.
func (*Message) HasAuthorSignature ¶
HasAuthorSignature checks that the current channel post has author signature.
func (*Message) HasBeenEdited ¶
HasBeenEdited checks that the current message has been edited.
func (*Message) HasCaption ¶
HasCaption checks that the current media has caption.
func (*Message) HasCaptionEntities ¶
HasCaptionEntities checks that the current media contains entities in caption.
func (*Message) HasCaptionMentions ¶
HasCaptionMentions checks that the current media contains mentions in caption.
func (*Message) HasCommandArgument ¶
HasCommandArgument checks that the current command message contains argument.
func (*Message) HasEntities ¶
HasEntities checks that the current message contains entities.
func (*Message) HasMentions ¶
HasMentions checks that the current message contains mentions.
func (*Message) IsChannelChatCreatedEvent ¶
IsChannelChatCreatedEvent checks that the current message is a event of creating a new channel.
func (*Message) IsCommandEqual ¶
IsCommandEqual checks that the current message is a specific bot command.
func (*Message) IsDeleteChatPhotoEvent ¶
IsDeleteChatPhotoEvent checks that the current message is a event of deleting a chat avatar.
func (*Message) IsDocument ¶
IsDocument checks that the current message is a document.
func (*Message) IsForward ¶
IsForward checks that the current message is a forward of other message.
func (*Message) IsGroupChatCreatedEvent ¶
IsGroupChatCreatedEvent checks that the current message is a event of creating a new group.
func (*Message) IsLeftChatMemberEvent ¶
IsLeftChatMemberEvent checks that the current message is a event of members exit.
func (*Message) IsLocation ¶
IsLocation checks that the current message is a location.
func (*Message) IsNewChatMembersEvent ¶
IsNewChatMembersEvent checks that the current message is a event of entry of new members.
func (*Message) IsNewChatPhotoEvent ¶
IsNewChatPhotoEvent checks that the current message is a event of setting a new chat avatar.
func (*Message) IsNewChatTitleEvent ¶
IsNewChatTitleEvent checks that the current message is a event of setting a new chat title.
func (*Message) IsPinnedMessage ¶
IsPinnedMessage checks that the current message is a event of pinning another message.
func (*Message) IsSuccessfulPayment ¶
IsSuccessfulPayment checks that the current message is a event of successful payment.
func (*Message) IsSupergroupChatCreatedEvent ¶
IsSupergroupChatCreatedEvent checks that the current message is a event of creating a new supergroup.
func (*Message) IsVideoNote ¶
IsVideoNote checks that the current message is a video note.
func (*Message) RawCommand ¶
RawCommand returns identifier of the bot command with bot username, if it was available
type MessageEntity ¶
type MessageEntity struct { // Type of the entity. Can be mention (@username), hashtag, bot_command, // url, email, bold (bold text), italic (italic text), code (monowidth // string), pre (monowidth block), text_link (for clickable text URLs), // text_mention (for users without usernames) Type string `json:"type"` // For "text_link" only, url that will be opened after user taps on the // text URL string `json:"url,omitempty"` // Offset in UTF-16 code units to the start of the entity Offset int `json:"offset"` // Length of the entity in UTF-16 code units Length int `json:"length"` // For "text_mention" only, the mentioned user User *User `json:"user,omitempty"` }
MessageEntity represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
func (*MessageEntity) IsBold ¶
func (entity *MessageEntity) IsBold() bool
IsBold checks that the current entity is a bold tag.
func (*MessageEntity) IsBotCommand ¶
func (entity *MessageEntity) IsBotCommand() bool
IsBotCommand checks that the current entity is a bot command.
func (*MessageEntity) IsCode ¶
func (entity *MessageEntity) IsCode() bool
IsCode checks that the current entity is a code tag.
func (*MessageEntity) IsEmail ¶
func (entity *MessageEntity) IsEmail() bool
IsEmail checks that the current entity is a email.
func (*MessageEntity) IsHashtag ¶
func (entity *MessageEntity) IsHashtag() bool
IsHashtag checks that the current entity is a hashtag.
func (*MessageEntity) IsItalic ¶
func (entity *MessageEntity) IsItalic() bool
IsItalic checks that the current entity is a italic tag.
func (*MessageEntity) IsMention ¶
func (entity *MessageEntity) IsMention() bool
IsMention checks that the current entity is a username mention.
func (*MessageEntity) IsPre ¶
func (entity *MessageEntity) IsPre() bool
IsPre checks that the current entity is a pre tag.
func (*MessageEntity) IsTextLink ¶
func (entity *MessageEntity) IsTextLink() bool
IsTextLink checks that the current entity is a text link.
func (*MessageEntity) IsTextMention ¶
func (entity *MessageEntity) IsTextMention() bool
IsTextMention checks that the current entity is a mention without username.
func (*MessageEntity) IsURL ¶
func (entity *MessageEntity) IsURL() bool
IsURL checks that the current entity is a URL
func (*MessageEntity) ParseURL ¶
func (entity *MessageEntity) ParseURL(messageText string) *url.URL
ParseURL selects URL from entered text of message and parse it as url.URL.
func (*MessageEntity) TextLink ¶
func (entity *MessageEntity) TextLink() *url.URL
TextLink parse current text link entity as url.URL.
type OrderInfo ¶
type OrderInfo struct { // User name Name string `json:"name,omitempty"` // User's phone number PhoneNumber string `json:"phone_number,omitempty"` // User email Email string `json:"email,omitempty"` // User shipping address ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"` }
OrderInfo represents information about an order.
type PhotoSize ¶
type PhotoSize struct { // Unique identifier for this file FileID string `json:"file_id"` // Photo width Width int `json:"width"` // Photo height Height int `json:"height"` // File size FileSize int `json:"file_size,omitempty"` }
PhotoSize represents one size of a photo or a file / sticker thumbnail.
type PinChatMessageParameters ¶
type PinChatMessageParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` MessageID int `json:"message_id"` DisableNotification bool `json:"disable_notification"` }
PinChatMessageParameters represents data for PinChatMessage method.
type PreCheckoutQuery ¶
type PreCheckoutQuery struct { // Unique query identifier ID string `json:"id"` // Three-letter ISO 4217 currency code Currency string `json:"currency"` // Bot specified invoice payload InvoicePayload string `json:"invoice_payload"` // Identifier of the shipping option chosen by the user ShippingOptionID string `json:"shipping_option_id,omitempty"` // User who sent the query From *User `json:"from"` // Total price in the smallest units of the currency (integer, not // float/double). For example, for a price of US$ 1.45 pass amount = 145. // See the exp parameter in currencies.json, it shows the number of // digits past the decimal point for each currency (2 for the majority of // currencies). TotalAmount int `json:"total_amount"` // Order info provided by the user OrderInfo *OrderInfo `json:"order_info,omitempty"` }
PreCheckoutQuery contains information about an incoming pre-checkout query.
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct { // Array of button rows, each represented by an Array of KeyboardButton // objects Keyboard [][]KeyboardButton `json:"keyboard"` // Requests clients to resize the keyboard vertically for optimal fit // (e.g., make the keyboard smaller if there are just two rows of // buttons). Defaults to false, in which case the custom keyboard is // always of the same height as the app's standard keyboard. ResizeKeyboard bool `json:"resize_keyboard,omitempty"` // Requests clients to hide the keyboard as soon as it's been used. The // keyboard will still be available, but clients will automatically // display the usual letter-keyboard in the chat – the user can press a // special button in the input field to see the custom keyboard again. // Defaults to false. OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` // Use this parameter if you want to show the keyboard to specific users // only. Targets: 1) users that are @mentioned in the text of the Message // object; 2) if the bot's message is a reply (has reply_to_message_id), // sender of the original message. // // Example: A user requests to change the bot‘s language, bot replies to // the request with a keyboard to select the new language. Other users in // the group don’t see the keyboard. Selective bool `json:"selective,omitempty"` }
ReplyKeyboardMarkup represents a custom keyboard with reply options (see Introduction to bots for details and examples).
func NewReplyKeyboardMarkup ¶
func NewReplyKeyboardMarkup(rows ...[]KeyboardButton) *ReplyKeyboardMarkup
NewReplyKeyboardMarkup creates new keyboard markup of simple buttons.
type ReplyKeyboardRemove ¶
type ReplyKeyboardRemove struct { // Requests clients to remove the custom keyboard (user will not be able // to summon this keyboard; if you want to hide the keyboard from sight // but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) RemoveKeyboard bool `json:"remove_keyboard"` // Use this parameter if you want to remove the keyboard for specific // users only. Targets: 1) users that are @mentioned in the text of the // Message object; 2) if the bot's message is a reply (has // reply_to_message_id), sender of the original message. // // Example: A user votes in a poll, bot returns confirmation message in // reply to the vote and removes the keyboard for that user, while still // showing the keyboard with poll options to users who haven't voted yet. Selective bool `json:"selective,omitempty"` }
ReplyKeyboardRemove will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
func NewReplyKeyboardRemove ¶
func NewReplyKeyboardRemove(selective bool) *ReplyKeyboardRemove
NewReplyKeyboardRemove just hides keyboard.
type ReplyMarkup ¶
type ReplyMarkup interface { NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) *InlineKeyboardMarkup NewReplyKeyboardMarkup(rows ...[]KeyboardButton) *ReplyKeyboardMarkup NewReplyKeyboardRemove(selective bool) *ReplyKeyboardRemove NewForceReply(selective bool) *ForceReply }
ReplyMarkup is a JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
type Response ¶
type Response struct { Ok bool `json:"ok"` ErrorCode int `json:"error_code,omitempty"` Description string `json:"description,omitempty"` Result *json.RawMessage `json:"result,omitempty"` Parameters *ResponseParameters `json:"parameters,omitempty"` }
Response represents a response from the Telegram API with the result stored raw. If ok equals true, the request was successful, and the result of the query can be found in the result field. In case of an unsuccessful request, ok equals false, and the error is explained in the error field.
type ResponseParameters ¶
type ResponseParameters struct { // The group has been migrated to a supergroup with the specified // identifier. MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"` // In case of exceeding flood control, the number of seconds left to wait // before the request can be repeated RetryAfter int `json:"retry_after,omitempty"` }
ResponseParameters contains information about why a request was unsuccessful.
type SendChatActionParameters ¶
type SendChatActionParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` Action string `json:"action"` }
SendChatActionParameters represents data for SendChatAction method.
type SendContactParameters ¶
type SendContactParameters struct { // Unique identifier for the target private chat ChatID int64 `json:"chat_id"` // Contact's phone number PhoneNumber string `json:"phone_number"` // Contact's first name FirstName string `json:"first_name"` // Contact's last name LastName string `json:"last_name"` // Sends the message silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` // A JSON-serialized object for an inline keyboard. If empty, one 'Pay total // price' button will be shown. If not empty, the first button must be a Pay // button. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
SendContactParameters represents data for SendContact method.
func NewContact ¶
func NewContact(chatID int64, phoneNumber, firstName string) *SendContactParameters
NewContact creates SendContactParameters only with required parameters.
type SendDocumentParameters ¶
type SendDocumentParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` // File to send. Pass a file_id as String to send a file that exists on the Telegram servers // (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or // upload a new one using multipart/form-data. Document InputFile `json:"document"` // Document caption (may also be used when resending documents by file_id), 0-200 characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Sends the message silently. Users will receive a notification with no sound. DisableNotification bool `json:"disable_notification,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` // Additional interface options. A JSON-serialized object for an inline keyboard, custom reply // keyboard, instructions to remove reply keyboard or to force a reply from the user. ReplyMarkup interface{} `json:"reply_markup,omitempty"` }
SendDocumentParameters represents data for SendDocument method.
func NewDocument ¶
func NewDocument(chatID int64, document interface{}) *SendDocumentParameters
NewDocument creates SendDocumentParameters only with required parameters.
type SendGameParameters ¶
type SendGameParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` // Short name of the game, serves as the unique identifier for the game. Set // up your games via Botfather. GameShortName string `json:"game_short_name"` // Sends the message silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` // A JSON-serialized object for an inline keyboard. If empty, one ‘Play // game_title’ button will be shown. If not empty, the first button must // launch the game. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
SendGameParameters represents data for SendGame method.
func NewGame ¶
func NewGame(chatID int64, gameShortName string) *SendGameParameters
NewGame creates SendGameParameters only with required parameters.
type SendInvoiceParameters ¶
type SendInvoiceParameters struct { // Unique identifier for the target private chat ChatID int64 `json:"chat_id"` // Product name, 1-32 characters Title string `json:"title"` // Product description, 1-255 characters Description string `json:"description"` // Bot-defined invoice payload, 1-128 bytes. This will not be displayed to // the user, use for your internal processes. Payload string `json:"payload"` // Payments provider token, obtained via Botfather ProviderToken string `json:"provider_token"` // Unique deep-linking parameter that can be used to generate this invoice // when used as a start parameter StartParameter string `json:"start_parameter"` // Three-letter ISO 4217 currency code, see more on currencies Currency string `json:"currency"` // JSON-encoded data about the invoice, which will be shared with the payment // provider. A detailed description of required fields should be provided by // the payment provider. ProviderData string `json:"provider_data,omitempty"` // URL of the product photo for the invoice. Can be a photo of the goods or a // marketing image for a service. People like it better when they see what // they are paying for. PhotoURL string `json:"photo_url,omitempty"` // Price breakdown, a list of components (e.g. product price, tax, discount, // delivery cost, delivery tax, bonus, etc.) Prices []LabeledPrice `json:"prices"` // Photo size PhotoSize int `json:"photo_size,omitempty"` // Photo width PhotoWidth int `json:"photo_width,omitempty"` // Photo height PhotoHeight int `json:"photo_height,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` // Pass True, if you require the user's full name to complete the order NeedName bool `json:"need_name,omitempty"` // Pass True, if you require the user's phone number to complete the order NeedPhoneNumber bool `json:"need_phone_number,omitempty"` // Pass True, if you require the user's email to complete the order NeedEmail bool `json:"need_email,omitempty"` // Pass True, if you require the user's shipping address to complete the // order NeedShippingAddress bool `json:"need_shipping_address,omitempty"` // Pass True, if the final price depends on the shipping method IsFlexible bool `json:"is_flexible,omitempty"` // Sends the message silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // A JSON-serialized object for an inline keyboard. If empty, one 'Pay total // price' button will be shown. If not empty, the first button must be a Pay // button. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
SendInvoiceParameters represents data for SendInvoice method.
func NewInvoice ¶
func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string, prices ...LabeledPrice) *SendInvoiceParameters
NewInvoice creates SendInvoiceParameters only with required parameters.
type SendLocationParameters ¶
type SendLocationParameters struct { // Unique identifier for the target private chat ChatID int64 `json:"chat_id"` // Latitude of the location Latitude float32 `json:"latitude"` // Longitude of the location Longitude float32 `json:"longitude"` // Period in seconds for which the location will be updated (see Live // Locations), should be between 60 and 86400. LivePeriod int `json:"live_period,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` // Sends the message silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // A JSON-serialized object for an inline keyboard. If empty, one 'Pay total // price' button will be shown. If not empty, the first button must be a Pay // button. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
SendLocationParameters represents data for SendLocation method.
func NewLocation ¶
func NewLocation(chatID int64, latitude, longitude float32) *SendLocationParameters
NewLocation creates SendLocationParameters only with required parameters.
type SendMediaGroupParameters ¶
type SendMediaGroupParameters struct { // Unique identifier for the target chat. ChatID int64 `json:"chat_id"` // A JSON-serialized array describing photos and videos to be sent, must // include 2–10 items Media []interface{} `json:"media"` // Sends the messages silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // If the messages are a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` }
SendMediaGroupParameters represents data for SendMediaGroup method.
func NewMediaGroup ¶
func NewMediaGroup(chatID int64, media ...interface{}) *SendMediaGroupParameters
NewMediaGroup creates SendMediaGroupParameters only with required parameters.
type SendMessageParameters ¶
type SendMessageParameters struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID int64 `json:"chat_id"` // Text of the message to be sent Text string `json:"text"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in your bot's message. ParseMode string `json:"parse_mode,omitempty"` // Disables link previews for links in this message DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` // Sends the message silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` // Additional interface options. A JSON-serialized object for an inline // keyboard, custom reply keyboard, instructions to remove reply keyboard or // to force a reply from the user. ReplyMarkup interface{} `json:"reply_markup,omitempty"` }
SendMessageParameters represents data for SendMessage method.
func NewMessage ¶
func NewMessage(chatID int64, text string) *SendMessageParameters
NewMessage creates SendMessageParameters only with required parameters.
type SendPhotoParameters ¶
type SendPhotoParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` // Photo to send. Pass a file_id as String to send a photo that exists on the // Telegram servers (recommended), pass an HTTP URL as a String for Telegram // to get a photo from the Internet, or upload a new photo using // multipart/form-data. Photo InputFile `json:"photo"` // Photo caption (may also be used when resending photos by file_id), 0-200 // characters Caption string `json:"caption,omitempty"` // Send Markdown or HTML, if you want Telegram apps to show bold, italic, // fixed-width text or inline URLs in the media caption. ParseMode string `json:"parse_mode,omitempty"` // Disables link previews for links in this message DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` // Sends the message silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` // Additional interface options. A JSON-serialized object for an inline // keyboard, custom reply keyboard, instructions to remove reply keyboard or // to force a reply from the user. ReplyMarkup interface{} `json:"reply_markup,omitempty"` }
SendPhotoParameters represents data for SendPhoto method.
func NewPhoto ¶
func NewPhoto(chatID int64, photo interface{}) *SendPhotoParameters
NewPhoto creates SendPhotoParameters only with required parameters.
type SendVenueParameters ¶
type SendVenueParameters struct { // Unique identifier for the target private chat ChatID int64 `json:"chat_id"` // Latitude of the venue Latitude float32 `json:"latitude"` // Longitude of the venue Longitude float32 `json:"longitude"` // Name of the venue Title string `json:"title"` // Address of the venue Address string `json:"address"` // Foursquare identifier of the venue FoursquareID string `json:"foursquare_id,omitempty"` // Sends the message silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID int `json:"reply_to_message_id,omitempty"` // A JSON-serialized object for an inline keyboard. If empty, one 'Pay total // price' button will be shown. If not empty, the first button must be a Pay // button. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
SendVenueParameters represents data for SendVenue method.
type SetChatDescriptionParameters ¶
type SetChatDescriptionParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` Description string `json:"description"` }
SetChatDescriptionParameters represents data for SetChatDescription method.
type SetChatPhotoParameters ¶
type SetChatPhotoParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` ChatPhoto interface{} `json:"chat_photo"` }
SetChatPhotoParameters represents data for SetChatPhoto method.
type SetChatStickerSetParameters ¶
type SetChatStickerSetParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` StickerSetName string `json:"sticker_set_name"` }
SetChatStickerSetParameters represents data for SetChatStickerSet method.
type SetChatTitleParameters ¶
type SetChatTitleParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` Title string `json:"title"` }
SetChatTitleParameters represents data for SetChatTitle method.
type SetGameScoreParameters ¶
type SetGameScoreParameters struct { // User identifier UserID int `json:"user_id"` // New score, must be non-negative Score int `json:"score"` // Required if inline_message_id is not specified. Identifier of the sent // message MessageID int `json:"message_id,omitempty"` // Pass True, if the high score is allowed to decrease. This can be useful // when fixing mistakes or banning cheaters Force bool `json:"force,omitempty"` // Pass True, if the game message should not be automatically edited to // include the current scoreboard DisableEditMessage bool `json:"disable_edit_message,omitempty"` // Required if inline_message_id is not specified. Unique identifier for the // target chat ChatID int64 `json:"chat_id,omitempty"` // Required if chat_id and message_id are not specified. Identifier of the // inline message InlineMessageID string `json:"inline_message_id,omitempty"` }
SetGameScoreParameters represents data for SetGameScore method.
func NewGameScore ¶
func NewGameScore(userID, score int) *SetGameScoreParameters
NewGameScore creates SetGameScoreParameters only with required parameters.
type SetStickerPositionInSetParameters ¶
type SetStickerPositionInSetParameters struct { Sticker string `json:"sticker"` Position int `json:"position"` }
SetStickerPositionInSetParameters represents data for SetStickerPositionInSet method.
type SetWebhookParameters ¶
type SetWebhookParameters struct { // HTTPS url to send updates to. Use an empty string to remove webhook // integration URL string `json:"url"` // Upload your public key certificate so that the root certificate in use can // be checked. See our self-signed guide for details. Certificate InputFile `json:"certificate,omitempty"` // Maximum allowed number of simultaneous HTTPS connections to the webhook // for update delivery, 1-100. Defaults to 40. Use lower values to limit the // load on your bot‘s server, and higher values to increase your bot’s // throughput. MaxConnections int `json:"max_connections,omitempty"` // List the types of updates you want your bot to receive. For example, // specify [“message”, “edited_channel_post”, “callback_query”] to only // receive updates of these types. See Update for a complete list of // available update types. Specify an empty list to receive all updates // regardless of type (default). If not specified, the previous setting will // be used. // // Please note that this parameter doesn't affect updates created before the // call to the setWebhook, so unwanted updates may be received for a short // period of time. AllowedUpdates []string `json:"allowed_updates,omitempty"` }
SetWebhookParameters represents data for SetWebhook method.
func NewWebhook ¶
func NewWebhook(url string, file interface{}) *SetWebhookParameters
NewWebhook creates new SetWebhookParameters only with required parameters.
type ShippingAddress ¶
type ShippingAddress struct { // ISO 3166-1 alpha-2 country code CountryCode string `json:"country_code"` // State, if applicable State string `json:"state"` // City City string `json:"city"` // First line for the address StreetLine1 string `json:"street_line1"` // Second line for the address StreetLine2 string `json:"street_line2"` // Address post code PostCode string `json:"post_code"` }
ShippingAddress represents a shipping address.
type ShippingOption ¶
type ShippingOption struct { // Shipping option identifier ID string `json:"id"` // Option title Title string `json:"title"` // List of price portions Prices []LabeledPrice `json:"prices"` }
ShippingOption represents one shipping option.
type ShippingQuery ¶
type ShippingQuery struct { // Unique query identifier ID string `json:"id"` // Bot specified invoice payload InvoicePayload string `json:"invoice_payload"` // User who sent the query From *User `json:"from"` // User specified shipping address ShippingAddress *ShippingAddress `json:"shipping_address"` }
ShippingQuery contains information about an incoming shipping query.
type Sticker ¶
type Sticker struct { // Unique identifier for this file FileID string `json:"file_id"` // Emoji associated with the sticker Emoji string `json:"emoji,omitempty"` // Name of the sticker set to which the sticker belongs SetName string `json:"set_name,omitempty"` // Sticker width Width int `json:"width"` // Sticker height Height int `json:"height"` // File size FileSize int `json:"file_size,omitempty"` // Sticker thumbnail in the .webp or .jpg format Thumb *PhotoSize `json:"thumb,omitempty"` // For mask stickers, the position where the mask should be placed MaskPosition *MaskPosition `json:"mask_position,omitempty"` }
Sticker represents a sticker.
func (*Sticker) InSet ¶
InSet checks that the current sticker in the stickers set.
For uploaded WebP files this return false.
func (*Sticker) Set ¶
func (sticker *Sticker) Set(bot *Bot) *StickerSet
Set use bot for getting parent StickerSet if SetName is present.
Return nil if current sticker has been uploaded by user as WebP file.
type StickerSet ¶
type StickerSet struct { // Sticker set name Name string `json:"name"` // Sticker set title Title string `json:"title"` // True, if the sticker set contains masks ContainsMasks bool `json:"contains_masks"` // List of all set stickers Stickers []Sticker `json:"stickers"` }
StickerSet represents a sticker set.
type SuccessfulPayment ¶
type SuccessfulPayment struct { // Three-letter ISO 4217 currency code Currency string `json:"currency"` // Bot specified invoice payload InvoicePayload string `json:"invoice_payload"` // Identifier of the shipping option chosen by the user ShippingOptionID string `json:"shipping_option_id,omitempty"` // Telegram payment identifier TelegramPaymentChargeID string `json:"telegram_payment_charge_id"` // Provider payment identifier ProviderPaymentChargeID string `json:"provider_payment_charge_id"` // Total price in the smallest units of the currency (integer, not // float/double). For example, for a price of US$ 1.45 pass amount = 145. // See the exp parameter in currencies.json, it shows the number of // digits past the decimal point for each currency (2 for the majority // of currencies). TotalAmount int `json:"total_amount"` // Order info provided by the user OrderInfo *OrderInfo `json:"order_info,omitempty"` }
SuccessfulPayment contains basic information about a successful payment.
type UnbanChatMemberParameters ¶
type UnbanChatMemberParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` UserID int `json:"user_id"` }
UnbanChatMemberParameters represents data for UnbanChatMember method.
type UnpinChatMessageParameters ¶
type UnpinChatMessageParameters struct { // Unique identifier for the target chat ChatID int64 `json:"chat_id"` }
UnpinChatMessageParameters represents data for UnpinChatMessage method.
type Update ¶
type Update struct { // The update‘s unique identifier. Update identifiers start from a // certain positive number and increase sequentially. This ID becomes // especially handy if you’re using Webhooks, since it allows you to // ignore repeated updates or to restore the correct update sequence, // should they get out of order. ID int `json:"update_id"` // New incoming message of any kind — text, photo, sticker, etc. Message *Message `json:"message,omitempty"` // New version of a message that is known to the bot and was edited EditedMessage *Message `json:"edited_message,omitempty"` // New incoming channel post of any kind — text, photo, sticker, etc. ChannelPost *Message `json:"channel_post,omitempty"` // New version of a channel post that is known to the bot and was edited EditedChannelPost *Message `json:"adited_channel_post,omitempty"` // New incoming inline query InlineQuery *InlineQuery `json:"inline_query,omitempty"` // The result of an inline query that was chosen by a user and sent to // their chat partner. ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"` // New incoming callback query CallbackQuery *CallbackQuery `json:"callback_query,omitempty"` // New incoming shipping query. Only for invoices with flexible price ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"` // New incoming pre-checkout query. Contains full information about // checkout PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"` }
Update represents an incoming update.
At most one of the optional parameters can be present in any given update.
func (*Update) IsCallbackQuery ¶
IsCallbackQuery checks that the current update is a callback query update.
func (*Update) IsChannelPost ¶
IsChannelPost checks that the current update is a post channel creation event.
func (*Update) IsChosenInlineResult ¶
IsChosenInlineResult checks that the current update is a chosen inline result update.
func (*Update) IsEditedChannelPost ¶
IsEditedChannelPost checks that the current update is a editing post channel event.
func (*Update) IsEditedMessage ¶
IsEditedMessage checks that the current update is a editing message event.
func (*Update) IsInlineQuery ¶
IsInlineQuery checks that the current update is a inline query update.
func (*Update) IsPreCheckoutQuery ¶
IsPreCheckoutQuery checks that the current update is a pre checkout query update.
func (*Update) IsShippingQuery ¶
IsShippingQuery checks that the current update is a shipping query update.
type UpdatesChannel ¶
type UpdatesChannel <-chan Update
UpdatesChannel is a channel for reading updates of bot.
type User ¶
type User struct { // Unique identifier for this user or bot ID int `json:"id"` // True, if this user is a bot IsBot bool `json:"is_bot"` // User‘s or bot’s first name FirstName string `json:"first_name"` // User‘s or bot’s last name LastName string `json:"last_name,omitempty"` // User‘s or bot’s username Username string `json:"username,omitempty"` // IETF language tag of the user's language LanguageCode string `json:"language_code,omitempty"` }
User represents a Telegram user or bot.
type UserProfilePhotos ¶
type UserProfilePhotos struct { // Total number of profile pictures the target user has TotalCount int `json:"total_count"` // Requested profile pictures (in up to 4 sizes each) Photos [][]PhotoSize `json:"photos"` }
UserProfilePhotos represent a user's profile pictures.
type Venue ¶
type Venue struct { // Venue location Location *Location `json:"location"` // Name of the venue Title string `json:"title"` // Address of the venue Address string `json:"address"` // Foursquare identifier of the venue FoursquareID string `json:"foursquare_id,omitempty"` }
Venue represents a venue.
type Video ¶
type Video struct { // Unique identifier for this file FileID string `json:"file_id"` // Mime type of a file as defined by sender MimeType string `json:"mime_type,omitempty"` // Video width as defined by sender Width int `json:"width"` // Video height as defined by sender Height int `json:"height"` // Duration of the video in seconds as defined by sender Duration int `json:"duration"` // File size FileSize int `json:"file_size,omitempty"` // Video thumbnail Thumb *PhotoSize `json:"thumb,omitempty"` }
Video represents a video file.
type VideoNote ¶
type VideoNote struct { // Unique identifier for this file FileID string `json:"file_id"` // Video width and height as defined by sender Length int `json:"length"` // Duration of the video in seconds as defined by sender Duration int `json:"duration"` // File size FileSize int `json:"file_size,omitempty"` // Video thumbnail Thumb *PhotoSize `json:"thumb,omitempty"` }
VideoNote represents a video message (available in Telegram apps as of v.4.0).
type Voice ¶
type Voice struct { // Unique identifier for this file FileID string `json:"file_id"` // MIME type of the file as defined by sender MimeType string `json:"mime_type,omitempty"` // Duration of the audio in seconds as defined by sender Duration int `json:"duration"` // File size FileSize int `json:"file_size,omitempty"` }
Voice represents a voice note.
type WebhookInfo ¶
type WebhookInfo struct { // Webhook URL, may be empty if webhook is not set up URL string `json:"url"` // Error message in human-readable format for the most recent error that // happened when trying to deliver an update via webhook LastErrorMessage string `json:"last_error_message,omitempty"` // True, if a custom certificate was provided for webhook certificate // checks HasCustomCertificate bool `json:"has_custom_certificate"` // Number of updates awaiting delivery PendingUpdateCount int `json:"pending_update_count"` // Maximum allowed number of simultaneous HTTPS connections to the // webhook for update delivery MaxConnections int `json:"max_connections,omitempty"` // Unix time for the most recent error that happened when trying to // deliver an update via webhook LastErrorDate int64 `json:"last_error_date,omitempty"` // A list of update types the bot is subscribed to. Defaults to all // update types AllowedUpdates []string `json:"allowed_updates,omitempty"` }
WebhookInfo contains information about the current status of a webhook.
Source Files ¶
- answer_callback_query.go
- answer_inline_query.go
- answer_pre_checkout_query.go
- answer_shipping_query.go
- constants.go
- delete_chat_photo.go
- delete_chat_sticker_set.go
- delete_message.go
- delete_sticker_from_set.go
- delete_webhook.go
- doc.go
- edit_message_caption.go
- edit_message_live_location.go
- edit_message_reply_markup.go
- edit_message_text.go
- export_chat_invite_link.go
- forward_message.go
- get_chat.go
- get_chat_administrators.go
- get_chat_member.go
- get_chat_members_count.go
- get_file.go
- get_game_high_scores.go
- get_me.go
- get_sticker_set.go
- get_updates.go
- get_user_profile_photos.go
- get_webhook_info.go
- kick_chat_member.go
- leave_chat.go
- models.go
- pin_chat_message.go
- request.go
- send_chat_action.go
- send_contact.go
- send_document.go
- send_game.go
- send_invoice.go
- send_location.go
- send_media_group.go
- send_message.go
- send_photo.go
- send_venue.go
- set_chat_description.go
- set_chat_photo.go
- set_chat_sticker_set.go
- set_chat_title.go
- set_game_score.go
- set_sticker_position_in_set.go
- set_webhook.go
- unban_chat_member.go
- unpin_chat_message.go
- upload.go
- utils.go
- utils_bot.go
- utils_chat.go
- utils_entity.go
- utils_inline_keyboard.go
- utils_inline_query_result.go
- utils_input.go
- utils_keyboard.go
- utils_member.go
- utils_message.go
- utils_sticker.go
- utils_update.go
- utils_user.go
- variables.go