Documentation ¶
Index ¶
- Constants
- Variables
- type Animation
- type Audio
- type BasicLogger
- func (BasicLogger) Debug(args ...interface{})
- func (BasicLogger) Debugf(format string, args ...interface{})
- func (BasicLogger) Error(args ...interface{})
- func (BasicLogger) Errorf(format string, args ...interface{})
- func (BasicLogger) Info(args ...interface{})
- func (BasicLogger) Infof(format string, args ...interface{})
- func (BasicLogger) Print(args ...interface{})
- func (BasicLogger) Printf(format string, args ...interface{})
- func (BasicLogger) Warn(args ...interface{})
- func (BasicLogger) Warnf(format string, args ...interface{})
- type CallbackQuery
- type Chat
- type ChatMember
- type ChatPhoto
- type ChosenInlineResult
- type Client
- func (c *Client) AddStickerToSet(userID int, name, fileID, emojis string, opts ...sendOption) error
- func (c *Client) AddStickerToSetFile(userID int, name, filename, emojis string, opts ...sendOption) error
- func (c *Client) AnswerCallbackQuery(callbackQueryID string, opts ...sendOption) error
- func (c *Client) AnswerInlineQuery(inlineQueryID string, results []InlineQueryResult, opts ...sendOption) error
- func (c *Client) AnswerPreCheckoutQuery(preCheckoutQueryID string, ok bool, opts ...sendOption) error
- func (c *Client) AnswerShippingQuery(shippingQueryID string, ok bool, opts ...sendOption) error
- func (c *Client) CreateNewStickerSet(userID int, name, title, fileID, emojis string, opts ...sendOption) error
- func (c *Client) CreateNewStickerSetFile(userID int, name, title, stickerFilename, emojis string, opts ...sendOption) error
- func (c *Client) DeleteChatPhoto(chatID string) error
- func (c *Client) DeleteChatStickerSet(chatID string) error
- func (c *Client) DeleteMessage(chatID string, messageID int) error
- func (c *Client) DeleteStickerFromSet(fileID string) error
- func (c *Client) EditInlineMessageCaption(inlineMessageID, caption string, opts ...sendOption) error
- func (c *Client) EditInlineMessageLiveLocation(inlineMessageID string, latitude, longitude float64, opts ...sendOption) error
- func (c *Client) EditInlineMessageReplyMarkup(inlineMessageID string, opts ...sendOption) error
- func (c *Client) EditInlineMessageText(inlineMessageID, text string, opts ...sendOption) error
- func (c *Client) EditMessageCaption(chatID string, messageID int, caption string, opts ...sendOption) (*Message, error)
- func (c *Client) EditMessageLiveLocation(chatID string, messageID int, latitude, longitude float64, opts ...sendOption) (*Message, error)
- func (c *Client) EditMessageReplyMarkup(chatID string, messageID int, opts ...sendOption) (*Message, error)
- func (c *Client) EditMessageText(chatID string, messageID int, text string, opts ...sendOption) (*Message, error)
- func (c *Client) ExportChatInviteLink(chatID string) (string, error)
- func (c *Client) ForwardMessage(chatID, fromChatID string, messageID int, opts ...sendOption) (*Message, error)
- func (c *Client) GetChat(chatID string) (*Chat, error)
- func (c *Client) GetChatAdministrators(chatID string) ([]*ChatMember, error)
- func (c *Client) GetChatMember(chatID string, userID int) (*ChatMember, error)
- func (c *Client) GetChatMembersCount(chatID string) (int, error)
- func (c *Client) GetFile(fileID string) (*File, error)
- func (c *Client) GetGameHighScores(chatID string, messageID, userID int) ([]*GameHighScore, error)
- func (c *Client) GetInlineGameHighScores(inlineMessageID string, userID int) ([]*GameHighScore, error)
- func (c *Client) GetMe() (*User, error)
- func (c *Client) GetStickerSet(name string) (*StickerSet, error)
- func (c *Client) GetUserProfilePhotos(userID int, opts ...sendOption) (*UserProfilePhotos, error)
- func (c *Client) KickChatMember(chatID string, userID int, opts ...sendOption) error
- func (c *Client) LeaveChat(chatID string) error
- func (c *Client) PinChatMessage(chatID string, messageID int, opts ...sendOption) error
- func (c *Client) PromoteChatMember(chatID string, userID int, p *Promotions) error
- func (c *Client) RestrictChatMember(chatID string, userID int, r *Restrictions, opts ...sendOption) error
- func (c *Client) SendAnimation(chatID string, fileID string, opts ...sendOption) (*Message, error)
- func (c *Client) SendAnimationFile(chatID string, filename string, opts ...sendOption) (*Message, error)
- func (c *Client) SendAudio(chatID string, fileID string, opts ...sendOption) (*Message, error)
- func (c *Client) SendAudioFile(chatID string, filename string, opts ...sendOption) (*Message, error)
- func (c *Client) SendChatAction(chatID string, action chatAction) error
- func (c *Client) SendContact(chatID, phoneNumber, firstName string, opts ...sendOption) (*Message, error)
- func (c *Client) SendDocument(chatID string, fileID string, opts ...sendOption) (*Message, error)
- func (c *Client) SendDocumentFile(chatID string, filename string, opts ...sendOption) (*Message, error)
- func (c *Client) SendGame(chatID, gameShortName string, opts ...sendOption) (*Message, error)
- func (c *Client) SendInvoice(chatID, payload, providerToken string, invoice *Invoice, prices []LabeledPrice, ...) (*Message, error)
- func (c *Client) SendLocation(chatID string, latitude, longitude float64, opts ...sendOption) (*Message, error)
- func (c *Client) SendMediaGroup(chatID string, media []InputMedia, opts ...sendOption) ([]*Message, error)
- func (c *Client) SendMessage(chatID string, text string, opts ...sendOption) (*Message, error)
- func (c *Client) SendPhoto(chatID string, fileID string, opts ...sendOption) (*Message, error)
- func (c *Client) SendPhotoFile(chatID string, filename string, opts ...sendOption) (*Message, error)
- func (c *Client) SendSticker(chatID, fileID string, opts ...sendOption) (*Message, error)
- func (c *Client) SendStickerFile(chatID string, filename string, opts ...sendOption) (*Message, error)
- func (c *Client) SendVenue(chatID string, latitude, longitude float64, title, address string, ...) (*Message, error)
- func (c *Client) SendVideo(chatID string, fileID string, opts ...sendOption) (*Message, error)
- func (c *Client) SendVideoFile(chatID string, filename string, opts ...sendOption) (*Message, error)
- func (c *Client) SendVideoNote(chatID string, fileID string, opts ...sendOption) (*Message, error)
- func (c *Client) SendVideoNoteFile(chatID string, filename string, opts ...sendOption) (*Message, error)
- func (c *Client) SendVoice(chatID string, fileID string, opts ...sendOption) (*Message, error)
- func (c *Client) SendVoiceFile(chatID string, filename string, opts ...sendOption) (*Message, error)
- func (c *Client) SetChatDescription(chatID, description string) error
- func (c *Client) SetChatPhoto(chatID string, filename string) error
- func (c *Client) SetChatStickerSet(chatID, stickerSetName string) error
- func (c *Client) SetChatTitle(chatID, title string) error
- func (c *Client) SetGameScore(chatID string, messageID, userID, score int, opts ...sendOption) (*Message, error)
- func (c *Client) SetInlineGameScore(inlineMessageID string, userID, score int, opts ...sendOption) error
- func (c *Client) SetPassportDataErrors(userID int, errors []PassportElementError) error
- func (c *Client) SetStickerPositionInSet(fileID string, pos int) error
- func (c *Client) StopInlineMessageLiveLocation(inlineMessageID string, opts ...sendOption) error
- func (c *Client) StopMessageLiveLocation(chatID string, messageID int, opts ...sendOption) (*Message, error)
- func (c *Client) UnbanChatMember(chatID string, userID int) error
- func (c *Client) UnpinChatMessage(chatID string) error
- func (c *Client) UploadStickerFile(userID int, filename string) (*File, error)
- type Contact
- type Document
- type EncryptedCredentials
- type EncryptedPassportElement
- type File
- type Game
- type GameHighScore
- type 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 InputLocationMessageContent
- type InputMedia
- type InputMediaPhoto
- type InputMediaVideo
- type InputMessageContent
- type InputTextMessageContent
- type InputVenueMessageContent
- type Invoice
- type KeyboardButton
- type LabeledPrice
- type Location
- type Logger
- type MaskPosition
- type Message
- type MessageEntity
- type OrderInfo
- type PassportData
- type PassportElementError
- type PassportElementErrorDataField
- type PassportElementErrorFile
- type PassportElementErrorFiles
- type PassportElementErrorFrontSide
- type PassportElementErrorReverseSide
- type PassportElementErrorSelfie
- type PassportFile
- type PhotoSize
- type PreCheckoutQuery
- type Promotions
- type ReplyKeyboardMarkup
- type Restrictions
- type Server
- func (s *Server) Client() *Client
- func (s *Server) HandleCallback(handler func(*CallbackQuery))
- func (s *Server) HandleChannelPost(handler func(*Message))
- func (s *Server) HandleEditChannelPost(handler func(*Message))
- func (s *Server) HandleEditedMessage(handler func(*Message))
- func (s *Server) HandleInlineQuery(handler func(*InlineQuery))
- func (s *Server) HandleInlineResult(handler func(*ChosenInlineResult))
- func (s *Server) HandleMessage(pattern string, handler func(*Message))
- func (s *Server) HandlePreCheckout(handler func(*PreCheckoutQuery))
- func (s *Server) HandleShipping(handler func(*ShippingQuery))
- func (s *Server) Start() error
- func (s *Server) Stop()
- type ServerOption
- type ShippingAddress
- type ShippingOption
- type ShippingQuery
- type Sticker
- type StickerSet
- type SuccessfulPayment
- type Update
- type User
- type UserProfilePhotos
- type Venue
- type Video
- type VideoNote
- type Voice
Constants ¶
const ( ActionTyping chatAction = "typing" ActionUploadPhoto chatAction = "upload_photo" ActionRecordVideo chatAction = "record_video" ActionUploadVideo chatAction = "upload_video" ActionRecordAudio chatAction = "record_audio" ActionUploadAudio chatAction = "upload_audio" ActionUploadDocument chatAction = "upload_document" ActionFindLocation chatAction = "find_location" ActionRecordVideoNote chatAction = "record_video_note" ActionUploadVideoNote chatAction = "upload_video_note" )
Actions for SendChatAction
Variables ¶
var ( OptParseModeHTML = func(r url.Values) { r.Set("parse_mode", "HTML") } OptParseModeMarkdown = func(r url.Values) { r.Set("parse_mode", "Markdown") } OptDisableNotification = func(r url.Values) { r.Set("disable_notification", "true") } OptReplyToMessageID = func(id int) sendOption { return func(r url.Values) { r.Set("reply_to_message_id", strconv.Itoa(id)) } } )
Generic message options
var ( OptDisableWebPagePreview = func(r url.Values) { r.Set("disable_web_page_preview", "true") } OptInlineKeyboardMarkup = func(markup *InlineKeyboardMarkup) sendOption { return func(r url.Values) { r.Set("reply_markup", structString(markup)) } } OptReplyKeyboardMarkup = func(markup *ReplyKeyboardMarkup) sendOption { return func(r url.Values) { r.Set("reply_markup", structString(markup)) } } OptReplyKeyboardRemove = func(r url.Values) { r.Set("reply_markup", structString(&replyKeyboardRemove{RemoveKeyboard: true})) } OptReplyKeyboardRemoveSelective = func(r url.Values) { r.Set("reply_markup", structString(&replyKeyboardRemove{RemoveKeyboard: true, Selective: true})) } OptForceReply = func(r url.Values) { r.Set("reply_markup", structString(&forceReply{ForceReply: true})) } OptForceReplySelective = func(r url.Values) { r.Set("reply_markup", structString(&forceReply{ForceReply: true, Selective: true})) } )
SendMessage options
var ( OptDuration = func(duration int) sendOption { return func(r url.Values) { r.Set("duration", strconv.Itoa(duration)) } } OptPerformer = func(performer string) sendOption { return func(r url.Values) { r.Set("performer", performer) } } OptTitle = func(title string) sendOption { return func(r url.Values) { r.Set("title", title) } } )
SendAudio options
var ( OptWidth = func(width int) sendOption { return func(r url.Values) { r.Set("width", strconv.Itoa(width)) } } OptHeight = func(height int) sendOption { return func(r url.Values) { r.Set("height", strconv.Itoa(height)) } } OptSupportsStreaming = func(r url.Values) { r.Set("supports_streaming", "true") } )
SendVideo options
var ( OptFoursquareID = func(foursquareID string) sendOption { return func(v url.Values) { v.Set("foursquare_id", foursquareID) } } OptFoursquareType = func(foursquareType string) sendOption { return func(v url.Values) { v.Set("foursquare_type", foursquareType) } } )
SendVenue options
var ( OptLastName = func(lastName string) sendOption { return func(v url.Values) { v.Set("last_name", lastName) } } OptVCard = func(vCard string) sendOption { return func(v url.Values) { v.Set("vcard", vCard) } } )
SendContact options
var ( OptOffset = func(offset int) sendOption { return func(v url.Values) { v.Set("offset", fmt.Sprint(offset)) } } OptLimit = func(limit int) sendOption { return func(v url.Values) { v.Set("limit", fmt.Sprint(limit)) } } )
GetUserProfilePhotos options
var ( OptText = func(text string) sendOption { return func(v url.Values) { v.Set("text", text) } } OptShowAlert = func(v url.Values) { v.Set("show_alert", "true") } OptURL = func(u string) sendOption { return func(v url.Values) { v.Set("url", u) } } OptCacheTime = func(d time.Duration) sendOption { return func(v url.Values) { v.Set("cache_time", fmt.Sprint(int(d.Seconds()))) } } )
Options for AnswerCallbackQuery
var ( OptContainsMasks = func(v url.Values) { v.Set("contains_masks", "true") } OptMaskPosition = func(pos *MaskPosition) sendOption { return func(v url.Values) { p, _ := json.Marshal(pos) v.Set("mask_position", string(p)) } } )
CreateNewStickerSet options
var ( OptIsPersonal = func(v url.Values) { v.Set("is_personal", "true") } OptNextOffset = func(offset string) sendOption { return func(v url.Values) { v.Set("next_offset", offset) } } OptSwitchPmText = func(text string) sendOption { return func(v url.Values) { v.Set("switch_pm_text", text) } } OptSwitchPmParameter = func(param string) sendOption { return func(v url.Values) { v.Set("switch_pm_parameter", param) } } )
AnswerInlineQuery options
var ( OptProviderData = func(data string) sendOption { return func(v url.Values) { v.Set("provider_data", data) } } OptPhotoURL = func(u string) sendOption { return func(v url.Values) { v.Set("photo_url", u) } } OptPhotoSize = func(size int) sendOption { return func(v url.Values) { v.Set("photo_size", fmt.Sprint(size)) } } OptPhotoWidth = func(width int) sendOption { return func(v url.Values) { v.Set("photo_width", fmt.Sprint(width)) } } OptPhotoHeight = func(height int) sendOption { return func(v url.Values) { v.Set("photo_height", fmt.Sprint(height)) } } OptNeedName = func(v url.Values) { v.Set("need_name", "true") } OptNeedPhoneNumber = func(v url.Values) { v.Set("need_phone_number", "true") } OptNeedEmail = func(v url.Values) { v.Set("need_email", "true") } OptNeedShippingAddress = func(v url.Values) { v.Set("need_shipping_address", "true") } OptSendPhoneNumberToProvider = func(v url.Values) { v.Set("send_phone_number_to_provider", "true") } OptSendEmailToProvider = func(v url.Values) { v.Set("send_email_to_provider", "true") } OptIsFlexible = func(v url.Values) { v.Set("is_flexible", "true") } )
SendInvoice options
var ( OptShippingOptions = func(options []ShippingOption) sendOption { return func(v url.Values) { op, _ := json.Marshal(options) v.Set("shipping_options", string(op)) } } OptErrorMessage = func(msg string) sendOption { return func(v url.Values) { v.Set("error_message", msg) } } )
AnswerShippingQuery options
var ( OptForce = func(v url.Values) { v.Set("force", "true") } OptDisableEditMessage = func(v url.Values) { v.Set("disable_edit_message", "true") } )
SetGameScore options
var ( OptCaption = func(caption string) sendOption { return func(r url.Values) { r.Set("caption", caption) } } )
SendPhoto options
var ( OptLength = func(length int) sendOption { return func(v url.Values) { v.Set("length", fmt.Sprint(length)) } } )
SendVideoNote options
var ( OptLivePeriod = func(period int) sendOption { return func(v url.Values) { v.Set("live_period", fmt.Sprint(period)) } } )
SendLocation options
var ( OptThumb = func(filename string) sendOption { return func(v url.Values) { v.Set("thumb", filename) } } )
SendAnimation options
var ( OptUntilDate = func(date time.Time) sendOption { return func(v url.Values) { v.Set("until_date", fmt.Sprint(date.Unix())) } } )
KickChatMember options
Functions ¶
This section is empty.
Types ¶
type Animation ¶ added in v1.0.1
type Animation struct { FileID string `json:"file_id"` Thumb *PhotoSize `json:"thumb"` FileName string `json:"file_name"` MimeType string `json:"mime_type"` FileSize int `json:"file_size"` }
Animation represents an animation file to be displayed in the message containing a game
type Audio ¶ added in v1.0.1
type Audio struct { FileID string `json:"file_id"` Duration int `json:"duration"` Performer string `json:"performer"` Title string `json:"title"` MIMEType string `json:"mime_type"` FileSize int `json:"file_size"` }
Audio represents an audio file to be treated as music by the Telegram clients
type BasicLogger ¶ added in v1.0.1
type BasicLogger struct{}
func (BasicLogger) Debug ¶ added in v1.0.1
func (BasicLogger) Debug(args ...interface{})
func (BasicLogger) Debugf ¶ added in v1.0.1
func (BasicLogger) Debugf(format string, args ...interface{})
func (BasicLogger) Error ¶ added in v1.0.1
func (BasicLogger) Error(args ...interface{})
func (BasicLogger) Errorf ¶ added in v1.0.1
func (BasicLogger) Errorf(format string, args ...interface{})
func (BasicLogger) Info ¶ added in v1.0.1
func (BasicLogger) Info(args ...interface{})
func (BasicLogger) Infof ¶ added in v1.0.1
func (BasicLogger) Infof(format string, args ...interface{})
func (BasicLogger) Print ¶ added in v1.0.1
func (BasicLogger) Print(args ...interface{})
func (BasicLogger) Printf ¶ added in v1.0.1
func (BasicLogger) Printf(format string, args ...interface{})
func (BasicLogger) Warn ¶ added in v1.0.1
func (BasicLogger) Warn(args ...interface{})
func (BasicLogger) Warnf ¶ added in v1.0.1
func (BasicLogger) Warnf(format string, args ...interface{})
type CallbackQuery ¶ added in v1.0.1
type CallbackQuery struct { ID string `json:"id"` From *User `json:"from"` Message *Message `json:"message"` InlineMessageID string `json:"inline_message_id"` ChatInstance string `json:"chat_instance"` Data string `json:"data"` GameShortName string `json:"game_short_name"` }
CallbackQuery represents an incoming callback query from a callback button in an inline keyboard
type Chat ¶ added in v1.0.1
type Chat struct { ID string Type string Title string Username string FirstName string LastName string Photo *ChatPhoto Description string InviteLink string PinnedMessage *Message StickerSetName string AllMembersAreAdministrators bool CanSetStickerSet bool }
Chat represents a chat
func (*Chat) UnmarshalJSON ¶ added in v1.0.1
UnmarshalJSON implements json.Unmarshaler
type ChatMember ¶ added in v1.0.1
type ChatMember struct { User User `json:"user"` Status string `json:"status"` UntilDate int `json:"until_date"` CanBeEdited bool `json:"can_be_edited"` CanChangeInfo bool `json:"can_change_info"` CanPostMessages bool `json:"can_post_messages"` CanEditMessages bool `json:"can_edit_messages"` CanDeleteMessages bool `json:"can_delete_messages"` CanInviteUsers bool `json:"can_invite_users"` CanRestrictMembers bool `json:"can_restrict_members"` CanPinMessages bool `json:"can_pin_messages"` CanPromoteMembers bool `json:"can_promote_members"` CanSendMessages bool `json:"can_send_messages"` CanSendMediaMessages bool `json:"can_send_media_messages"` CanSendOtherMessages bool `json:"can_send_other_messages"` CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` }
ChatMember contains information about one member of a chat
type ChatPhoto ¶ added in v1.0.1
type ChatPhoto struct { SmallFileID string `json:"small_file_id"` BigFileID string `json:"big_file_id"` }
ChatPhoto represents a chat photo
type ChosenInlineResult ¶ added in v1.0.1
type ChosenInlineResult struct { ResultID string `json:"result_id"` From *User `json:"from"` Location *Location `json:"location"` InlineMessageID string `json:"inline_message_id"` Query string `json:"query"` }
ChosenInlineResult represents a result of an inline query that was chosen by the user and sent to their chat partner
type Client ¶ added in v1.0.1
type Client struct {
// contains filtered or unexported fields
}
Client is a low-level Telegram client
func (*Client) AddStickerToSet ¶ added in v1.0.1
AddStickerToSet add a new sticker to a set created by the bot. Available options:
- OptMaskPosition(pos *MaskPosition)
func (*Client) AddStickerToSetFile ¶ added in v1.0.1
func (c *Client) AddStickerToSetFile(userID int, name, filename, emojis string, opts ...sendOption) error
AddStickerToSetFile add a new sticker file to a set created by the bot. Available options:
- OptMaskPosition(pos *MaskPosition)
func (*Client) AnswerCallbackQuery ¶ added in v1.0.1
AnswerCallbackQuery send answer to callback query sent from inline keyboard. Available options:
- OptText(text string)
- OptShowAlert
- OptURL(url string)
- OptCacheTime(d time.Duration)
func (*Client) AnswerInlineQuery ¶ added in v1.0.1
func (c *Client) AnswerInlineQuery(inlineQueryID string, results []InlineQueryResult, opts ...sendOption) error
AnswerInlineQuery send answer to an inline query. No more than 50 results per query are allowed. Available Options:
- OptCacheTime(d *time.Duration)
- OptIsPersonal
- OptNextOffset(offset string)
- OptSwitchPmText(text string)
- OptSwitchPmParameter(param string)
func (*Client) AnswerPreCheckoutQuery ¶ added in v1.0.1
func (c *Client) AnswerPreCheckoutQuery(preCheckoutQueryID string, ok bool, opts ...sendOption) error
AnswerPreCheckoutQuery respond to pre-checkout queries. Available options:
- OptErrorMessage(msg string)
func (*Client) AnswerShippingQuery ¶ added in v1.0.1
AnswerShippingQuery reply to shipping queries. Available options:
- OptShippingOptions(options []ShippingOption)
- OptErrorMessage(msg string)
func (*Client) CreateNewStickerSet ¶ added in v1.0.1
func (c *Client) CreateNewStickerSet(userID int, name, title, fileID, emojis string, opts ...sendOption) error
CreateNewStickerSet creates new sticker set with previously uploaded file. Available options:
- OptContainsMasks
- OptMaskPosition(pos *MaskPosition)
func (*Client) CreateNewStickerSetFile ¶ added in v1.0.1
func (c *Client) CreateNewStickerSetFile(userID int, name, title, stickerFilename, emojis string, opts ...sendOption) error
CreateNewStickerSetFile creates new sticker set with sticker file. Available options:
- OptContainsMasks
- OptMaskPosition(pos *MaskPosition)
func (*Client) DeleteChatPhoto ¶ added in v1.0.1
DeleteChatPhoto deleta a chat photo
func (*Client) DeleteChatStickerSet ¶ added in v1.0.1
DeleteChatStickerSet delete a group sticker set from a supergroup
func (*Client) DeleteMessage ¶ added in v1.0.1
DeleteMessage delete a message, including service messages
func (*Client) DeleteStickerFromSet ¶ added in v1.0.1
DeleteStickerFromSet delete a sticker from a set created by the bot
func (*Client) EditInlineMessageCaption ¶ added in v1.0.1
func (c *Client) EditInlineMessageCaption(inlineMessageID, caption string, opts ...sendOption) error
EditInlineMessageCaption edit message caption sent via the bot (for inline bots). Available options:
- OptParseModeHTML
- OptParseModeMarkdown
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditInlineMessageLiveLocation ¶ added in v1.0.1
func (c *Client) EditInlineMessageLiveLocation(inlineMessageID string, latitude, longitude float64, opts ...sendOption) error
EditInlineMessageLiveLocation edits location in message sent via the bot (using inline mode). Available options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditInlineMessageReplyMarkup ¶ added in v1.0.1
EditInlineMessageReplyMarkup edit only the reply markup of messages sent by the bot. Available options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditInlineMessageText ¶ added in v1.0.1
EditInlineMessageText edit text and game messages sent via the bot (for inline bots). Available options:
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableWebPagePreview
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditMessageCaption ¶ added in v1.0.1
func (c *Client) EditMessageCaption(chatID string, messageID int, caption string, opts ...sendOption) (*Message, error)
EditMessageCaption edit message caption sent by the bot. Available options:
- OptParseModeHTML
- OptParseModeMarkdown
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditMessageLiveLocation ¶ added in v1.0.1
func (c *Client) EditMessageLiveLocation(chatID string, messageID int, latitude, longitude float64, opts ...sendOption) (*Message, error)
EditMessageLiveLocation edits location in message sent by the bot. Available options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditMessageReplyMarkup ¶ added in v1.0.1
func (c *Client) EditMessageReplyMarkup(chatID string, messageID int, opts ...sendOption) (*Message, error)
EditMessageReplyMarkup edit only the reply markup of messages sent by the bot. Available options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditMessageText ¶ added in v1.0.1
func (c *Client) EditMessageText(chatID string, messageID int, text string, opts ...sendOption) (*Message, error)
EditMessageText edit text and game messages sent by the bot. Available options:
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableWebPagePreview
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) ExportChatInviteLink ¶ added in v1.0.1
ExportChatInviteLink generate a new invite link for a chat; any previously generated link is revoked
func (*Client) ForwardMessage ¶ added in v1.0.1
func (c *Client) ForwardMessage(chatID, fromChatID string, messageID int, opts ...sendOption) (*Message, error)
ForwardMessage forwards message from one chat to another. Available options:
- OptDisableNotification
func (*Client) GetChatAdministrators ¶ added in v1.0.1
func (c *Client) GetChatAdministrators(chatID string) ([]*ChatMember, error)
GetChatAdministrators get a list of administrators in a chat
func (*Client) GetChatMember ¶ added in v1.0.1
func (c *Client) GetChatMember(chatID string, userID int) (*ChatMember, error)
GetChatMember get information about a member of a chat
func (*Client) GetChatMembersCount ¶ added in v1.0.1
GetChatMembersCount returns the number of members in chat
func (*Client) GetGameHighScores ¶ added in v1.0.1
func (c *Client) GetGameHighScores(chatID string, messageID, userID int) ([]*GameHighScore, error)
GetGameHighScores get data for high score tables
func (*Client) GetInlineGameHighScores ¶ added in v1.0.1
func (c *Client) GetInlineGameHighScores(inlineMessageID string, userID int) ([]*GameHighScore, error)
GetInlineGameHighScores get data for high score tables
func (*Client) GetStickerSet ¶ added in v1.0.1
func (c *Client) GetStickerSet(name string) (*StickerSet, error)
GetStickerSet get a sticker set
func (*Client) GetUserProfilePhotos ¶ added in v1.0.1
func (c *Client) GetUserProfilePhotos(userID int, opts ...sendOption) (*UserProfilePhotos, error)
GetUserProfilePhotos returs user's profile pictures. Available options:
- OptOffset(offset int)
- OptLimit(limit int)
func (*Client) KickChatMember ¶ added in v1.0.1
KickChatMember kicks user from group, supergroup or channel. Available options:
- OptUntilDate(date time.Time)
func (*Client) PinChatMessage ¶ added in v1.0.1
PinChatMessage pin a message in a supergroup or a channel. Available options:
- OptDisableNotification
func (*Client) PromoteChatMember ¶ added in v1.0.1
func (c *Client) PromoteChatMember(chatID string, userID int, p *Promotions) error
PromoteChatMember promote or demote a user in a supergroup or a channel
func (*Client) RestrictChatMember ¶ added in v1.0.1
func (c *Client) RestrictChatMember(chatID string, userID int, r *Restrictions, opts ...sendOption) error
RestrictChatMember restrict a user in a supergroup. Available options:
- OptUntilDate(date time.Time)
func (*Client) SendAnimation ¶ added in v1.0.1
SendAnimation sends animation to chat. Pass fileID to send. Available options:
- OptDuration(duration int)
- OptWidth(width int)
- OptHeight(height int)
- OptThumb(filename string)
- OptCaption(caption string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendAnimationFile ¶ added in v1.0.1
func (c *Client) SendAnimationFile(chatID string, filename string, opts ...sendOption) (*Message, error)
SendAnimationFile sends animation file contents to the chat. Pass filename to send. Available options:
- OptDuration(duration int)
- OptWidth(width int)
- OptHeight(height int)
- OptThumb(filename string)
- OptCaption(caption string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendAudio ¶ added in v1.0.1
SendAudio sends pre-uploaded audio to the chat. Pass fileID of the uploaded file. Available options:
- OptCaption(caption string)
- OptDuration(duration int)
- OptPerformer(performer string)
- OptTitle(title string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendAudioFile ¶ added in v1.0.1
func (c *Client) SendAudioFile(chatID string, filename string, opts ...sendOption) (*Message, error)
SendAudioFile sends file contents as an audio to the chat. Pass filename to send. Available options:
- OptCaption(caption string)
- OptDuration(duration int)
- OptPerformer(performer string)
- OptTitle(title string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendChatAction ¶ added in v1.0.1
SendChatAction sends bot chat action. Available actions:
- ActionTyping
- ActionUploadPhoto
- ActionRecordVideo
- ActionUploadVideo
- ActionRecordAudio
- ActionUploadAudio
- ActionUploadDocument
- ActionFindLocation
- ActionRecordVideoNote
- ActionUploadVideoNote
func (*Client) SendContact ¶ added in v1.0.1
func (c *Client) SendContact(chatID, phoneNumber, firstName string, opts ...sendOption) (*Message, error)
SendContact sends phone contact. Available options:
- OptLastName(lastName string)
- OptVCard(vCard string) TODO: implement vCard support (https://tools.ietf.org/html/rfc6350)
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendDocument ¶ added in v1.0.1
SendDocument sends document to the chat. Pass fileID of the document. Available options:
- OptCaption(caption string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendDocumentFile ¶ added in v1.0.1
func (c *Client) SendDocumentFile(chatID string, filename string, opts ...sendOption) (*Message, error)
SendDocumentFile sends document file contents to the chat. Pass filename to send. Available options:
- OptCaption(caption string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendGame ¶ added in v1.0.1
SendGame send a game. Available options:
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) SendInvoice ¶ added in v1.0.1
func (c *Client) SendInvoice(chatID, payload, providerToken string, invoice *Invoice, prices []LabeledPrice, opts ...sendOption) (*Message, error)
SendInvoice send invoices. Available Options:
- OptProviderData(data string)
- OptPhotoURL(u string)
- OptPhotoSize(size int)
- OptPhotoWidth(width int)
- OptPhotoHeight(height int)
- OptNeedName
- OptNeedPhoneNumber
- OptNeedEmail
- OptNeedShippingAddress
- OptSendPhoneNumberToProvider
- OptSendEmailToProvider
- OptIsFlexible
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) SendLocation ¶ added in v1.0.1
func (c *Client) SendLocation(chatID string, latitude, longitude float64, opts ...sendOption) (*Message, error)
SendLocation sends point on the map to chat. Available options:
- OptLivePeriod(period int)
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendMediaGroup ¶ added in v1.0.1
func (c *Client) SendMediaGroup(chatID string, media []InputMedia, opts ...sendOption) ([]*Message, error)
SendMediaGroup send a group of photos or videos as an album
func (*Client) SendMessage ¶ added in v1.0.1
SendMessage sends message to telegram chat. Available options:
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableWebPagePreview
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendPhoto ¶ added in v1.0.1
SendPhoto sends pre-uploaded photo to the chat. Pass fileID of the photo. Available options:
- OptCaption(caption string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendPhotoFile ¶ added in v1.0.1
func (c *Client) SendPhotoFile(chatID string, filename string, opts ...sendOption) (*Message, error)
SendPhotoFile sends photo file contents to the chat. Pass filename to send. Available options:
- OptCaption(caption string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendSticker ¶ added in v1.0.1
SendSticker send previously uploaded sticker. Available options:
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendStickerFile ¶ added in v1.0.1
func (c *Client) SendStickerFile(chatID string, filename string, opts ...sendOption) (*Message, error)
SendStickerFile send .webp file sticker. Available options:
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendVenue ¶ added in v1.0.1
func (c *Client) SendVenue(chatID string, latitude, longitude float64, title, address string, opts ...sendOption) (*Message, error)
SendVenue sends information about a venue. Available options:
- OptFoursquareID(foursquareID string)
- OptFoursquareType(foursquareType string)
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendVideo ¶ added in v1.0.1
SendVideo sends pre-uploaded video to chat. Pass fileID of the uploaded video. Available options:
- OptDuration(duration int)
- OptWidth(width int)
- OptHeight(height int)
- OptSupportsStreaming
- OptCaption(caption string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendVideoFile ¶ added in v1.0.1
func (c *Client) SendVideoFile(chatID string, filename string, opts ...sendOption) (*Message, error)
SendVideoFile sends video file contents to the chat. Pass filename to send. Available options:
- OptDuration(duration int)
- OptWidth(width int)
- OptHeight(height int)
- OptSupportsStreaming
- OptCaption(caption string)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendVideoNote ¶ added in v1.0.1
SendVideoNote sends video note. Pass fileID of previously uploaded video note. Available options:
- OptDuration(duration int)
- OptLength(length int)
- OptThumb(filename string)
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendVideoNoteFile ¶ added in v1.0.1
func (c *Client) SendVideoNoteFile(chatID string, filename string, opts ...sendOption) (*Message, error)
SendVideoNoteFile sends video note to chat. Pass filename to upload. Available options:
- OptDuration(duration int)
- OptLength(length int)
- OptThumb(filename string)
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendVoice ¶ added in v1.0.1
SendVoice sends audio file as a voice message. Pass file_id of previously uploaded file. Available options:
- OptCaption(caption string)
- OptDuration(duration int)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendVoiceFile ¶ added in v1.0.1
func (c *Client) SendVoiceFile(chatID string, filename string, opts ...sendOption) (*Message, error)
SendVoiceFile sends the audio file as a voice message. Pass filename to send. Available options:
- OptCaption(caption string)
- OptDuration(duration int)
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SetChatDescription ¶ added in v1.0.1
SetChatDescription change the description of a supergroup or a channel
func (*Client) SetChatPhoto ¶ added in v1.0.1
SetChatPhoto set a new profile photo for the chat
func (*Client) SetChatStickerSet ¶ added in v1.0.1
SetChatStickerSet set a new group sticker set for a supergroup
func (*Client) SetChatTitle ¶ added in v1.0.1
SetChatTitle change the title of the chat
func (*Client) SetGameScore ¶ added in v1.0.1
func (c *Client) SetGameScore(chatID string, messageID, userID, score int, opts ...sendOption) (*Message, error)
SetGameScore set the score of the specified user in a game. Available options:
- OptForce
- OptDisableEditMessage
func (*Client) SetInlineGameScore ¶ added in v1.0.1
func (c *Client) SetInlineGameScore(inlineMessageID string, userID, score int, opts ...sendOption) error
SetInlineGameScore set the score of the specified user in a game (for inline messages). Available options:
- OptForce
- OptDisableEditMessage
func (*Client) SetPassportDataErrors ¶ added in v1.0.1
func (c *Client) SetPassportDataErrors(userID int, errors []PassportElementError) error
SetPassportDataErrors informs a user that some of the Telegram Passport elements they provided contains errors
func (*Client) SetStickerPositionInSet ¶ added in v1.0.1
SetStickerPositionInSet move a sticker in a set created by the bot to a specific position
func (*Client) StopInlineMessageLiveLocation ¶ added in v1.0.1
StopInlineMessageLiveLocation stop updating a live location message sent via the bot (using inline mode). Available options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) StopMessageLiveLocation ¶ added in v1.0.1
func (c *Client) StopMessageLiveLocation(chatID string, messageID int, opts ...sendOption) (*Message, error)
StopMessageLiveLocation stop updating a live location message sent by the bot. Available options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) UnbanChatMember ¶ added in v1.0.1
UnbanChatMember unban a previously kicked user in a supergroup or channel
func (*Client) UnpinChatMessage ¶ added in v1.0.1
UnpinChatMessage unpin a message in a supergroup or a channel
type Contact ¶ added in v1.0.1
type Contact struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name"` UserID int `json:"user_id"` }
Contact represents a phone contact
type Document ¶ added in v1.0.1
type Document struct { FileID string `json:"file_id"` Thumb *PhotoSize `json:"thumb"` FileName string `json:"file_name"` MIMEType string `json:"mime_type"` FileSize int `json:"file_size"` }
Document represents a general file (as opposed to photos, voice messages and audio files)
type EncryptedCredentials ¶ added in v1.0.1
type EncryptedCredentials struct { Data string `json:"data"` Hash string `json:"hash"` Secret string `json:"secret"` }
EncryptedCredentials contains data required for decrypting and authenticating EncryptedPassportElement
type EncryptedPassportElement ¶ added in v1.0.1
type EncryptedPassportElement struct { Type string `json:"type"` Data string `json:"data"` PhoneNumber string `json:"phone_number"` Email string `json:"email"` Files []*PassportFile `json:"files"` FrontSide *PassportFile `json:"front_side"` ReverseSide *PassportFile `json:"reverse_side"` Selfie *PassportFile `json:"selfie"` }
EncryptedPassportElement contains information about documents or other Telegram Passport elements shared with the bot by the user
type File ¶ added in v1.0.1
type File struct { FileID string `json:"file_id"` FileSize string `json:"file_size"` FilePath string `json:"file_path"` // use https://api.telegram.org/file/bot<token>/<file_path> to download }
File object represents a file ready to be downloaded
type Game ¶ added in v1.0.1
type Game struct { Title string `json:"title"` Description string `json:"description"` Photo []*PhotoSize `json:"photo"` Text string `json:"text"` TextEntities []*MessageEntity `json:"text_entities"` Animation *Animation `json:"animation"` }
Game represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
type GameHighScore ¶ added in v1.0.1
type GameHighScore struct { Position int `json:"position"` User User `json:"user"` Score int `json:"score"` }
GameHighScore represents one row of the high scores table for a game
type InlineKeyboardButton ¶ added in v1.0.1
type InlineKeyboardButton struct { Text string `json:"text"` URL string `json:"url,omitempty"` CallbackData string `json:"callback_data,omitempty"` SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` }
InlineKeyboardButton represents one button of an inline keyboard
type InlineKeyboardMarkup ¶ added in v1.0.1
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
InlineKeyboardMarkup represents an inline keyboard that appears right next to the message it belongs to
type InlineQuery ¶ added in v1.0.1
type InlineQuery struct { ID string `json:"id"` From *User `json:"from"` Location *Location `json:"location"` Query string `json:"query"` Offset string `json:"offset"` }
InlineQuery represents an incoming inline query
type InlineQueryResult ¶ added in v1.0.1
type InlineQueryResult interface {
// contains filtered or unexported methods
}
InlineQueryResult represents one result of an inline query
type InlineQueryResultArticle ¶ added in v1.0.1
type InlineQueryResultArticle struct { Type string `json:"type"` ID string `json:"id"` Title string `json:"title"` InputMessageContent InputMessageContent `json:"input_message_content"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` URL string `json:"url,omitempty"` HideURL bool `json:"hide_url,omitempty"` Description string `json:"description,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultArticle link to an article or web page
type InlineQueryResultAudio ¶ added in v1.0.1
type InlineQueryResultAudio struct { Type string `json:"type"` ID string `json:"id"` AudioURL string `json:"audio_url"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` Performer string `json:"performer,omitempty"` AudioDuration int `json:"audio_duration,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultAudio represents a link to an mp3 audio file
type InlineQueryResultCachedAudio ¶ added in v1.0.1
type InlineQueryResultCachedAudio struct { Type string `json:"type"` ID string `json:"id"` AudioFileID string `json:"audio_file_id"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedAudio represents a link to an mp3 audio file
type InlineQueryResultCachedDocument ¶ added in v1.0.1
type InlineQueryResultCachedDocument struct { Type string `json:"type"` ID string `json:"id"` Title string `json:"title"` DocumentFileID string `json:"document_file_id"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedDocument represents a link to a file
type InlineQueryResultCachedGif ¶ added in v1.0.1
type InlineQueryResultCachedGif struct { Type string `json:"type"` ID string `json:"id"` GifFileID string `json:"gif_file_id"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedGif represents a link to an animated GIF file stored on the Telegram servers
type InlineQueryResultCachedMpeg4Gif ¶ added in v1.0.1
type InlineQueryResultCachedMpeg4Gif struct { Type string `json:"type"` ID string `json:"id"` Mpeg4FileID string `json:"mpeg4_file_id"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedMpeg4Gif represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers
type InlineQueryResultCachedPhoto ¶ added in v1.0.1
type InlineQueryResultCachedPhoto struct { Type string `json:"type"` ID string `json:"id"` PhotoFileID string `json:"photo_file_id"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedPhoto represents a link to a photo stored on the Telegram servers
type InlineQueryResultCachedSticker ¶ added in v1.0.1
type InlineQueryResultCachedSticker struct { Type string `json:"type"` ID string `json:"id"` StickerFileID string `json:"sticker_file_id"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedSticker represents a link to a sticker stored on the Telegram servers
type InlineQueryResultCachedVideo ¶ added in v1.0.1
type InlineQueryResultCachedVideo struct { Type string `json:"type"` ID string `json:"id"` VideoFileID string `json:"video_file_id"` Title string `json:"title"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedVideo represents a link to a video file stored on the Telegram servers
type InlineQueryResultCachedVoice ¶ added in v1.0.1
type InlineQueryResultCachedVoice struct { Type string `json:"type"` ID string `json:"id"` VoiceFileID string `json:"voice_file_id"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultCachedVoice represents a link to a voice recording in an .ogg container encoded with OPUS
type InlineQueryResultContact ¶ added in v1.0.1
type InlineQueryResultContact struct { Type string `json:"type"` ID string `json:"id"` PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name,omitempty"` VCard string `json:"vcard,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultContact represents a contact with a phone number
type InlineQueryResultDocument ¶ added in v1.0.1
type InlineQueryResultDocument struct { Type string `json:"type"` ID string `json:"id"` Title string `json:"title"` Caption string `json:"caption"` ParseMode string `json:"parse_mode"` DocumentURL string `json:"document_url"` MimeType string `json:"mime_type"` Description string `json:"description,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultDocument represents a link to a file
type InlineQueryResultGame ¶ added in v1.0.1
type InlineQueryResultGame struct { Type string `json:"type"` ID string `json:"id"` GameShortName string `json:"game_short_name"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
InlineQueryResultGame represents a Game
type InlineQueryResultGif ¶ added in v1.0.1
type InlineQueryResultGif struct { Type string `json:"type"` ID string `json:"id"` GifURL string `json:"gif_url"` GifWidth int `json:"gif_width,omitempty"` GifHeight int `json:"gif_height,omitempty"` GifDuration int `json:"gif_duration,omitempty"` ThumbURL string `json:"thumb_url"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultGif represents a link to an animated GIF file
type InlineQueryResultLocation ¶ added in v1.0.1
type InlineQueryResultLocation struct { Type string `json:"type"` ID string `json:"id"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Title string `json:"title"` LivePeriod int `json:"live_period,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultLocation represents a location on a map
type InlineQueryResultMpeg4Gif ¶ added in v1.0.1
type InlineQueryResultMpeg4Gif struct { Type string `json:"type"` ID string `json:"id"` Mpeg4URL string `json:"mpeg4_url"` Mpeg4Width int `json:"mpeg4_width,omitempty"` Mpeg4Height int `json:"mpeg4_height,omitempty"` Mpeg4Duration int `json:"mpeg4_duration,omitempty"` ThumbURL string `json:"thumb_url"` Title string `json:"title,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultMpeg4Gif represents a link to a video animation (H.264/MPEG-4 AVC video without sound)
type InlineQueryResultPhoto ¶ added in v1.0.1
type InlineQueryResultPhoto struct { Type string `json:"type"` ID string `json:"id"` PhotoURL string `json:"photo_url"` ThumbURL string `json:"thumb_url"` PhotoWidth int `json:"photo_width,omitempty"` PhotoHeight int `json:"photo_height,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultPhoto represents a link to a photo
type InlineQueryResultVenue ¶ added in v1.0.1
type InlineQueryResultVenue struct { Type string `json:"type"` ID string `json:"id"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id,omitempty"` FoursquareType string `json:"foursquare_type,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` ThumbWidth int `json:"thumb_width,omitempty"` ThumbHeight int `json:"thumb_height,omitempty"` }
InlineQueryResultVenue represents a venue
type InlineQueryResultVideo ¶ added in v1.0.1
type InlineQueryResultVideo struct { Type string `json:"type"` ID string `json:"id"` VideoURL string `json:"video_url"` MimeType string `json:"mime_type"` ThumbURL string `json:"thumb_url"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` VideoWidth int `json:"video_width,omitempty"` Videoheight int `json:"video_height,omitempty"` VideoDuration int `json:"video_duration,omitempty"` Description string `json:"description,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultVideo represents a link to a page containing an embedded video player or a video file
type InlineQueryResultVoice ¶ added in v1.0.1
type InlineQueryResultVoice struct { Type string `json:"type"` ID string `json:"id"` VoiceURL string `json:"voice_url"` Title string `json:"title"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` Performer string `json:"performer,omitempty"` VoiceDuration int `json:"voice_duration,omitempty"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` }
InlineQueryResultVoice represents a link to a voice recording in an .ogg container encoded with OPUS
type InputContactMessageContent ¶ added in v1.0.1
type InputContactMessageContent struct { PhoneNumber string `json:"phone_number"` FirstName string `json:"first_name"` LastName string `json:"last_name"` VCard string `json:"vcard"` }
InputContactMessageContent represents the content of a contact message to be sent as the result of an inline query
type InputLocationMessageContent ¶ added in v1.0.1
type InputLocationMessageContent struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` LivePeriod int `json:"live_period"` }
InputLocationMessageContent represents the content of a location message to be sent as the result of an inline query
type InputMedia ¶ added in v1.0.1
type InputMedia interface {
// contains filtered or unexported methods
}
InputMedia file
type InputMediaPhoto ¶ added in v1.0.1
type InputMediaPhoto struct { Type string `json:"type"` Media string `json:"media"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` }
InputMediaPhoto represents a photo to be sent
type InputMediaVideo ¶ added in v1.0.1
type InputMediaVideo struct { Type string `json:"type"` Media string `json:"media"` Thumb string `json:"thumb,omitempty"` Caption string `json:"caption,omitempty"` ParseMode string `json:"parse_mode,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` Duration int `json:"duration,omitempty"` SupportsStreaming bool `json:"supports_streaming,omitempty"` }
InputMediaVideo represents a video to be sent
type InputMessageContent ¶ added in v1.0.1
type InputMessageContent interface {
// contains filtered or unexported methods
}
InputMessageContent content of a message to be sent as a result of an inline query
type InputTextMessageContent ¶ added in v1.0.1
type InputTextMessageContent struct { MessageText string `json:"message_text"` ParseMode string `json:"parse_mode"` DisableWebPagePreview bool `json:"disable_web_page_preview"` }
InputTextMessageContent represents the content of a text message to be sent as the result of an inline query
type InputVenueMessageContent ¶ added in v1.0.1
type InputVenueMessageContent struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id"` FoursquareType string `json:"foursquare_type"` }
InputVenueMessageContent represents the content of a venue message to be sent as the result of an inline query
type Invoice ¶ added in v1.0.1
type Invoice struct { Title string `json:"title"` Description string `json:"description"` StartParameter string `json:"start_parameter"` Currency string `json:"currency"` TotalAmount int `json:"total_amount"` }
Invoice contains basic information about an invoice
type KeyboardButton ¶ added in v1.0.1
type KeyboardButton struct { Text string `json:"text"` RequestContact bool `json:"request_contact"` RequestLocation bool `json:"request_location"` }
KeyboardButton represents one button of the reply keyboard
type LabeledPrice ¶ added in v1.0.1
LabeledPrice represents a portion of the price for goods or services
type Logger ¶ added in v1.0.1
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Printf(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Print(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) }
Logger defines interface for any compatible logger
type MaskPosition ¶ added in v1.0.1
type MaskPosition struct { Point string `json:"point"` XShift float32 `json:"x_shift"` YShift float32 `json:"y_shift"` Scale float32 `json:"scale"` }
MaskPosition describes the position on faces where a mask should be placed by default
type Message ¶
type Message struct { MessageID int `json:"message_id"` From *User `json:"from"` Date int64 `json:"date"` Chat Chat `json:"chat"` ForwardFrom *User `json:"forward_from"` ForwardFromChat *Chat `json:"forward_from_chat"` ForwardFromMessageID int `json:"forward_from_message_id"` ForwardSignature string `json:"forward_signature"` ForwardDate int64 `json:"forward_date"` ReplyToMessage *Message `json:"reply_to_message"` EditDate int64 `json:"edit_date"` MediaGroupID string `json:"media_group_id"` AuthorSignature string `json:"author_signature"` Text string `json:"text"` Entities []*MessageEntity `json:"entities"` CaptionEntities []*MessageEntity `json:"caption_entities"` Audio *Audio `json:"audio"` Document *Document `json:"document"` Game *Game `json:"game"` Photo []*PhotoSize `json:"photo"` Sticker *Sticker `json:"sticker"` Video *Video `json:"video"` Voice *Voice `json:"voice"` VideoNote *VideoNote `json:"video_note"` Caption string `json:"caption"` Contact *Contact `json:"contact"` Location *Location `json:"location"` Venue *Venue `json:"venue"` NewChatMembers []*User `json:"new_chat_members"` LeftChatMember *User `json:"left_chat_member"` NewChatTitle string `json:"new_chat_title"` NewChatPhoto []*PhotoSize `json:"new_chat_photo"` DeleteChatPhoto bool `json:"delete_chat_photo"` GroupChatCreated bool `json:"group_chat_created"` SupergroupChatCreated bool `json:"supergroup_chat_created"` ChannelChatCreated bool `json:"channel_chat_created"` MigrateToChatID int `json:"migrate_to_chat_id"` MigrateFromChatID int `json:"migrate_from_chat_id"` PinnedMessage *Message `json:"pinned_message"` Invoice *Invoice `json:"invoice"` SuccessfulPayment *SuccessfulPayment `json:"successful_payment"` ConnectedWebsite string `json:"connected_website"` PassportData *PassportData `json:"passport_data"` }
Message represents a message
type MessageEntity ¶ added in v1.0.1
type MessageEntity struct { Type string `json:"type"` Offset int `json:"offset"` Length int `json:"length"` URL string `json:"url"` User *User `json:"user"` }
MessageEntity represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
type OrderInfo ¶ added in v1.0.1
type OrderInfo struct { Name string `json:"name"` PhoneNumber string `json:"phone_number"` Email string `json:"email"` ShippingAddress *ShippingAddress `json:"shipping_address"` }
OrderInfo represents information about an order
type PassportData ¶ added in v1.0.1
type PassportData struct { Data []EncryptedPassportElement `json:"data"` Credentials EncryptedCredentials `json:"credentials"` }
PassportData contains information about Telegram Passport data shared with the bot by the user
type PassportElementError ¶ added in v1.0.1
type PassportElementError interface {
// contains filtered or unexported methods
}
PassportElementError represents an error in the Telegram Passport element
type PassportElementErrorDataField ¶ added in v1.0.1
type PassportElementErrorDataField struct { Source string `json:"source"` Type string `json:"type"` FieldName string `json:"field_name"` DataHash string `json:"data_hash"` Message string `json:"message"` }
PassportElementErrorDataField represents an issue in one of the data fields that was provided by the user
type PassportElementErrorFile ¶ added in v1.0.1
type PassportElementErrorFile struct { Source string `json:"source"` Type string `json:"type"` FileHash string `json:"file_hash"` Message string `json:"message"` }
PassportElementErrorFile represents an issue with a document scan
type PassportElementErrorFiles ¶ added in v1.0.1
type PassportElementErrorFiles struct { Source string `json:"source"` Type string `json:"type"` FileHashes []string `json:"file_hashes"` Message string `json:"message"` }
PassportElementErrorFiles represents an issue with a list of scans
type PassportElementErrorFrontSide ¶ added in v1.0.1
type PassportElementErrorFrontSide struct { Source string `json:"source"` Type string `json:"type"` FileHash string `json:"file_hash"` Message string `json:"message"` }
PassportElementErrorFrontSide represents an issue with the front side of a document
type PassportElementErrorReverseSide ¶ added in v1.0.1
type PassportElementErrorReverseSide struct { Source string `json:"source"` Type string `json:"type"` FileHash string `json:"file_hash"` Message string `json:"message"` }
PassportElementErrorReverseSide represents an issue with the reverse side of a document
type PassportElementErrorSelfie ¶ added in v1.0.1
type PassportElementErrorSelfie struct { Source string `json:"source"` Type string `json:"type"` FileHash string `json:"file_hash"` Message string `json:"message"` }
PassportElementErrorSelfie represents an issue with the selfie with a document
type PassportFile ¶ added in v1.0.1
type PassportFile struct { FileID string `json:"file_id"` FileSize int `json:"file_size"` FileDate int `json:"file_date"` }
PassportFile represents a file uploaded to Telegram Passport
type PhotoSize ¶ added in v1.0.1
type PhotoSize struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` FileSize int `json:"file_size"` }
PhotoSize represents one size of a photo or a file/sticker thumbnail.
type PreCheckoutQuery ¶ added in v1.0.1
type PreCheckoutQuery struct { ID string `json:"id"` From *User `json:"from"` Currency string `json:"currency"` TotalAmount int `json:"total_amount"` InvoicePayload string `json:"invoice_payload"` ShippingOptionID string `json:"shipping_option_id"` OrderInfo *OrderInfo `json:"order_info"` }
PreCheckoutQuery contains information about an incoming pre-checkout query
type Promotions ¶ added in v1.0.1
type Promotions struct { CanChangeInfo bool CanPostMessages bool CanEditMessages bool CanDeleteMessages bool CanInviteUsers bool CanRestrictMembers bool CanPinMessages bool CanPromoteMembers bool }
Promotions give user permitions in a supergroup or channel.
type ReplyKeyboardMarkup ¶ added in v1.0.1
type ReplyKeyboardMarkup struct { Keyboard [][]KeyboardButton `json:"keyboard"` ResizeKeyboard bool `json:"resize_keyboard"` OneTimeKeyboard bool `json:"one_time_keyboard"` Selective bool `json:"selective"` }
ReplyKeyboardMarkup represents a custom keyboard with reply options
type Restrictions ¶ added in v1.0.1
type Restrictions struct { CanSendMessages bool CanSendMediaMessages bool CanSendOtherMessages bool CanAddWebPagePreviews bool }
Restrictions for user in supergroup
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server will connect and serve all updates from Telegram
func New ¶ added in v1.0.1
func New(token string, options ...ServerOption) *Server
New creates new Server. Available options:
WithWebook(url, addr string) WithHTTPClient(client *http.Client)
func (*Server) HandleCallback ¶ added in v1.0.1
func (s *Server) HandleCallback(handler func(*CallbackQuery))
HandleCallback set handler for inline buttons
func (*Server) HandleChannelPost ¶ added in v1.0.1
HandleChannelPost set handler for incoming channel post
func (*Server) HandleEditChannelPost ¶ added in v1.0.1
HandleEditChannelPost set handler for incoming edited channel post
func (*Server) HandleEditedMessage ¶ added in v1.0.1
HandleEditedMessage set handler for incoming edited messages
func (*Server) HandleInlineQuery ¶ added in v1.0.1
func (s *Server) HandleInlineQuery(handler func(*InlineQuery))
HandleInlineQuery set handler for inline queries
func (*Server) HandleInlineResult ¶ added in v1.0.1
func (s *Server) HandleInlineResult(handler func(*ChosenInlineResult))
HandleInlineResult set inline result handler
func (*Server) HandleMessage ¶ added in v1.0.1
HandleMessage sets handler for incoming messages
func (*Server) HandlePreCheckout ¶ added in v1.0.1
func (s *Server) HandlePreCheckout(handler func(*PreCheckoutQuery))
HandlePreCheckout set handler for pre-checkout queries
func (*Server) HandleShipping ¶ added in v1.0.1
func (s *Server) HandleShipping(handler func(*ShippingQuery))
HandleShipping set handler for shipping queries
type ServerOption ¶
type ServerOption func(*Server)
ServerOption type for additional Server options
func WithHTTPClient ¶ added in v1.0.1
func WithHTTPClient(client *http.Client) ServerOption
WithHTTPClient sets custom http client for server.
func WithLogger ¶ added in v1.0.1
func WithLogger(logger Logger) ServerOption
WithLogger sets logger for tbot
func WithWebhook ¶
func WithWebhook(url, addr string) ServerOption
WithWebhook returns ServerOption for given Webhook URL and Server address to listen. e.g. WithWebook("https://bot.example.com/super/url", "0.0.0.0:8080")
type ShippingAddress ¶ added in v1.0.1
type ShippingAddress struct { CountryCode string `json:"country_code"` State string `json:"state"` City string `json:"city"` StreetLine1 string `json:"street_line1"` StreetLine2 string `json:"street_line2"` PostCode string `json:"post_code"` }
ShippingAddress represents a shipping address
type ShippingOption ¶ added in v1.0.1
type ShippingOption struct { ID string `json:"id"` Title string `json:"title"` Prices []LabeledPrice `json:"prices"` }
ShippingOption represents one shipping option
type ShippingQuery ¶ added in v1.0.1
type ShippingQuery struct { ID string `json:"id"` From *User `json:"from"` InvoicePayload string `json:"invoice_payload"` ShippingAddress *ShippingAddress `json:"shipping_address"` }
ShippingQuery contains information about an incoming shipping query
type Sticker ¶ added in v1.0.1
type Sticker struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Thumb *PhotoSize `json:"thumb"` Emoji string `json:"emoji"` MaskPosition *MaskPosition `json:"mask_position"` SetName string `json:"set_name"` FileSize int `json:"file_size"` }
Sticker represents a sticker
type StickerSet ¶ added in v1.0.1
type StickerSet struct { Name string `json:"name"` Title string `json:"title"` ContainsMasks bool `json:"contains_masks"` Stickers []Sticker `json:"stickers"` }
StickerSet represents sticker set
type SuccessfulPayment ¶ added in v1.0.1
type SuccessfulPayment struct { Currency string `json:"currency"` TotalAmount int `json:"total_amount"` InvoicePayload string `json:"invoice_payload"` ShippingOptionID string `json:"shipping_option_id"` OrderInfo *OrderInfo `json:"order_info"` TelegramPaymentChargeID string `json:"telegram_payment_charge_id"` ProviderPaymentChargeID string `json:"provider_payment_charge_id"` }
SuccessfulPayment contains basic information about a successful payment
type Update ¶ added in v1.0.1
type Update struct { UpdateID int `json:"update_id"` Message *Message `json:"message"` EditedMessage *Message `json:"edited_message"` ChannelPost *Message `json:"channel_post"` EditedChannelPost *Message `json:"edited_channel_post"` InlineQuery *InlineQuery `json:"inline_query"` ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"` CallbackQuery *CallbackQuery `json:"callback_query"` ShippingQuery *ShippingQuery `json:"shipping_query"` PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"` }
Update represents an incoming update UpdateID is unique identifier At most one of the other fields can be not nil
type User ¶ added in v1.0.1
type User struct { ID int `json:"id"` IsBot bool `json:"is_bot"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Username string `json:"username"` LanguageCode string `json:"language_code"` }
User is telegram user
type UserProfilePhotos ¶ added in v1.0.1
type UserProfilePhotos struct { TotalCount int `json:"total_count"` Photos [][]PhotoSize `json:"photos"` }
UserProfilePhotos represent a user's profile pictures
type Venue ¶ added in v1.0.1
type Venue struct { Location Location `json:"location"` Title string `json:"title"` Address string `json:"address"` FoursquareID string `json:"foursquare_id"` }
Venue represents a venue
type Video ¶ added in v1.0.1
type Video struct { FileID string `json:"file_id"` Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration"` Thumbnail *PhotoSize `json:"thumb"` MimeType string `json:"mime_type"` FileSize int `json:"file_size"` }
Video represents a video file