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 BotCommand
- type CallbackQuery
- type Chat
- type ChatMember
- type ChatPermissions
- 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) FileURL(file *File) string
- 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) GetMyCommands() (*[]BotCommand, 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, perm *ChatPermissions, 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) SendDice(chatID string, emoji string, opts ...sendOption) (*Dice, 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) SendPoll(chatID string, question string, options []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) SetChatAdministratorCustomTitle(chatID string, userID string, customTitle string) error
- func (c *Client) SetChatDescription(chatID, description string) error
- func (c *Client) SetChatPermissions(chatID string, permissions *ChatPermissions) 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) SetMyCommands(commands []BotCommand) error
- func (c *Client) SetPassportDataErrors(userID int, errors []PassportElementError) error
- func (c *Client) SetStickerPositionInSet(fileID string, pos int) error
- func (c *Client) SetStickerSetThumb(userID int, name, thumb string) error
- func (c *Client) SetStickerSetThumbFile(userID int, name, thumbnailFilename string) 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) StopPoll(chatID string, messageID string, opts ...sendOption) (*Poll, 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 Dice
- 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 KeyboardButtonPollType
- type LabeledPrice
- type Location
- type Logger
- type LoginURL
- type MaskPosition
- type Message
- type MessageEntity
- type Middleware
- type OrderInfo
- type PassportData
- type PassportElementError
- type PassportElementErrorDataField
- type PassportElementErrorFile
- type PassportElementErrorFiles
- type PassportElementErrorFrontSide
- type PassportElementErrorReverseSide
- type PassportElementErrorSelfie
- type PassportFile
- type PhotoSize
- type Poll
- type PollAnswer
- type PollOption
- type PollType
- type PreCheckoutQuery
- type Promotions
- type ReplyKeyboardMarkup
- 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) HandleMessageAuto(handler func(*Message))
- func (s *Server) HandlePollAnswer(handler func(*PollAnswer))
- func (s *Server) HandlePollUpdate(handler func(*Poll))
- func (s *Server) HandlePreCheckout(handler func(*PreCheckoutQuery))
- func (s *Server) HandleShipping(handler func(*ShippingQuery))
- func (s *Server) Start() error
- func (s *Server) Stop()
- func (s *Server) Use(m Middleware, handler func(*Message))
- type ServerOption
- type ShippingAddress
- type ShippingOption
- type ShippingQuery
- type Sticker
- type StickerSet
- type SuccessfulPayment
- type Update
- type UpdateHandler
- 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", "MarkdownV2") } 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)) } } OptAnimatedSticker = func(v url.Values) { v.Set("tgs_sticker", "true") } )
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 ( OptNotAnonymous = func(u url.Values) { u.Set("is_anonymous", "false") } OptPollType = func(pollType PollType) sendOption { return func(u url.Values) { u.Set("type", string(pollType)) } } OptAllowMultipleAnswers = func(u url.Values) { u.Set("allows_multiple_answers", "true") } OptCorrectOptionID = func(id int) sendOption { return func(u url.Values) { u.Set("correct_option_id", fmt.Sprint(id)) } } OptClosedPoll = func(u url.Values) { u.Set("is_closed", "true") } )
SendPoll 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 ¶
type Animation struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_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 ¶
type Audio struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_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 ¶
type BasicLogger struct{}
func (BasicLogger) Debug ¶
func (BasicLogger) Debug(args ...interface{})
func (BasicLogger) Debugf ¶
func (BasicLogger) Debugf(format string, args ...interface{})
func (BasicLogger) Error ¶
func (BasicLogger) Error(args ...interface{})
func (BasicLogger) Errorf ¶
func (BasicLogger) Errorf(format string, args ...interface{})
func (BasicLogger) Info ¶
func (BasicLogger) Info(args ...interface{})
func (BasicLogger) Infof ¶
func (BasicLogger) Infof(format string, args ...interface{})
func (BasicLogger) Print ¶
func (BasicLogger) Print(args ...interface{})
func (BasicLogger) Printf ¶
func (BasicLogger) Printf(format string, args ...interface{})
func (BasicLogger) Warn ¶
func (BasicLogger) Warn(args ...interface{})
func (BasicLogger) Warnf ¶
func (BasicLogger) Warnf(format string, args ...interface{})
type BotCommand ¶
type BotCommand struct { Command string `json:"command"` // Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores. Description string `json:"description"` // Description of the command, 3-256 characters. }
BotCommand represents a bot command.
type CallbackQuery ¶
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 ¶
type Chat struct { ID string Type string Title string Username string FirstName string LastName string Photo *ChatPhoto Description string InviteLink string PinnedMessage *Message Permissions *ChatPermissions StickerSetName string AllMembersAreAdministrators bool // deprecated SlowModeDelay int CanSetStickerSet bool }
Chat represents a chat
func (*Chat) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type ChatMember ¶
type ChatMember struct { User User `json:"user"` Status string `json:"status"` CustomTitle string `json:"custom_title"` 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"` IsMember bool `json:"is_member"` 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"` CanSendPolls bool `json:"can_send_polls"` }
ChatMember contains information about one member of a chat
type ChatPermissions ¶
type ChatPermissions struct { CanSendMessages bool `json:"can_send_messages,omitempty"` // True, if the user is allowed to send text messages, contacts, locations and venues CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"` // True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages CanSendPolls bool `json:"can_send_polls,omitempty"` // True, if the user is allowed to send polls, implies can_send_messages CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"` // True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` // True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages CanChangeInfo bool `json:"can_change_info,omitempty"` // True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups CanInviteUsers bool `json:"can_invite_users,omitempty"` // True, if the user is allowed to invite new users to the chat CanPinMessages bool `json:"can_pin_messages,omitempty"` // True, if the user is allowed to pin messages. Ignored in public supergroups }
ChatPermissions describes actions that a non-administrator user is allowed to take in a chat.
type ChatPhoto ¶
type ChatPhoto struct { SmallFileID string `json:"small_file_id"` SmallFileUniqueID string `json:"small_file_unique_id"` BigFileID string `json:"big_file_id"` BigFileUniqueID string `json:"big_file_unique_id"` }
ChatPhoto represents a chat photo
type ChosenInlineResult ¶
type ChosenInlineResult struct { ResultID string `json:"result_id"` From *User `json:"from"` Location *Location `json:"location"` InlineMessageID string `json:"inline_message_id"` Query string `json:"query"` }
ChosenInlineResult represents a result of an inline query that was chosen by the user and sent to their chat partner
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a low-level Telegram client
func (*Client) AddStickerToSet ¶
AddStickerToSet add a new sticker to a set created by the bot. Available options:
- OptMaskPosition(pos *MaskPosition)
func (*Client) AddStickerToSetFile ¶
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)
- OptAnimatedSticker
func (*Client) AnswerCallbackQuery ¶
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 ¶
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 ¶
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 ¶
AnswerShippingQuery reply to shipping queries. Available options:
- OptShippingOptions(options []ShippingOption)
- OptErrorMessage(msg string)
func (*Client) CreateNewStickerSet ¶
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 ¶
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)
- OptAnimatedSticker
func (*Client) DeleteChatPhoto ¶
DeleteChatPhoto deleta a chat photo
func (*Client) DeleteChatStickerSet ¶
DeleteChatStickerSet delete a group sticker set from a supergroup
func (*Client) DeleteMessage ¶
DeleteMessage delete a message, including service messages
func (*Client) DeleteStickerFromSet ¶
DeleteStickerFromSet delete a sticker from a set created by the bot
func (*Client) EditInlineMessageCaption ¶
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 ¶
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 ¶
EditInlineMessageReplyMarkup edit only the reply markup of messages sent by the bot. Available options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditInlineMessageText ¶
EditInlineMessageText edit text and game messages sent via the bot (for inline bots). Available options:
- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableWebPagePreview
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) EditMessageCaption ¶
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 ¶
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 ¶
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 ¶
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 ¶
ExportChatInviteLink generate a new invite link for a chat; any previously generated link is revoked
func (*Client) ForwardMessage ¶
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 ¶
func (c *Client) GetChatAdministrators(chatID string) ([]*ChatMember, error)
GetChatAdministrators get a list of administrators in a chat
func (*Client) GetChatMember ¶
func (c *Client) GetChatMember(chatID string, userID int) (*ChatMember, error)
GetChatMember get information about a member of a chat
func (*Client) GetChatMembersCount ¶
GetChatMembersCount returns the number of members in chat
func (*Client) GetGameHighScores ¶
func (c *Client) GetGameHighScores(chatID string, messageID, userID int) ([]*GameHighScore, error)
GetGameHighScores get data for high score tables
func (*Client) GetInlineGameHighScores ¶
func (c *Client) GetInlineGameHighScores(inlineMessageID string, userID int) ([]*GameHighScore, error)
GetInlineGameHighScores get data for high score tables
func (*Client) GetMyCommands ¶
func (c *Client) GetMyCommands() (*[]BotCommand, error)
GetMyCommands get the current list of bot commands.
func (*Client) GetStickerSet ¶
func (c *Client) GetStickerSet(name string) (*StickerSet, error)
GetStickerSet get a sticker set
func (*Client) GetUserProfilePhotos ¶
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 ¶
KickChatMember kicks user from group, supergroup or channel. Available options:
- OptUntilDate(date time.Time)
func (*Client) PinChatMessage ¶
PinChatMessage pin a message in a supergroup or a channel. Available options:
- OptDisableNotification
func (*Client) PromoteChatMember ¶
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 ¶
func (c *Client) RestrictChatMember(chatID string, userID int, perm *ChatPermissions, opts ...sendOption) error
RestrictChatMember restrict a user in a supergroup. Available options:
- OptUntilDate(date time.Time)
func (*Client) SendAnimation ¶
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 ¶
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 ¶
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 ¶
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 ¶
SendChatAction sends bot chat action. Available actions:
- ActionTyping
- ActionUploadPhoto
- ActionRecordVideo
- ActionUploadVideo
- ActionRecordAudio
- ActionUploadAudio
- ActionUploadDocument
- ActionFindLocation
- ActionRecordVideoNote
- ActionUploadVideoNote
func (*Client) SendContact ¶
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) SendDice ¶
SendDice sends native telegram dice. Available Options:
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendDocument ¶
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 ¶
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 ¶
SendGame send a game. Available options:
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) SendInvoice ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) SendPoll ¶
func (c *Client) SendPoll(chatID string, question string, options []string, opts ...sendOption) (*Message, error)
SendPoll sends native telegram poll. Available Options:
- OptNotAnonymous
- OptPollType(pollType PollType)
- OptAllowMultipleAnswers
- OptCorrectOptionID(id int)
- OptClosedPoll
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendSticker ¶
SendSticker send previously uploaded sticker. Available options:
- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective
func (*Client) SendStickerFile ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) SetChatAdministratorCustomTitle ¶
func (c *Client) SetChatAdministratorCustomTitle(chatID string, userID string, customTitle string) error
SetChatAdministratorCustomTitle set a custom title for an administrator in a supergroup promoted by the bot.
func (*Client) SetChatDescription ¶
SetChatDescription change the description of a supergroup or a channel
func (*Client) SetChatPermissions ¶
func (c *Client) SetChatPermissions(chatID string, permissions *ChatPermissions) error
SetChatPermissions set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights.
func (*Client) SetChatPhoto ¶
SetChatPhoto set a new profile photo for the chat
func (*Client) SetChatStickerSet ¶
SetChatStickerSet set a new group sticker set for a supergroup
func (*Client) SetChatTitle ¶
SetChatTitle change the title of the chat
func (*Client) SetGameScore ¶
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 ¶
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) SetMyCommands ¶
func (c *Client) SetMyCommands(commands []BotCommand) error
SetMyCommands set the list of bot commands.
func (*Client) SetPassportDataErrors ¶
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 ¶
SetStickerPositionInSet move a sticker in a set created by the bot to a specific position
func (*Client) SetStickerSetThumb ¶
SetStickerSetThumb sets the thumbnail of a sticker set with a previously uploaded file.
func (*Client) SetStickerSetThumbFile ¶
SetStickerSetThumbFile sets the thumbnail of a sticker set with thumbnail file.
func (*Client) StopInlineMessageLiveLocation ¶
StopInlineMessageLiveLocation stop updating a live location message sent via the bot (using inline mode). Available options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) StopMessageLiveLocation ¶
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) StopPoll ¶
StopPoll stops poll. Available Options:
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
func (*Client) UnbanChatMember ¶
UnbanChatMember unban a previously kicked user in a supergroup or channel
func (*Client) UnpinChatMessage ¶
UnpinChatMessage unpin a message in a supergroup or a channel
type Contact ¶
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 ¶
type Document struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_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 ¶
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 ¶
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 ¶
type File struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_id"` FileSize int `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 ¶
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 ¶
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 ¶
type InlineKeyboardButton struct { Text string `json:"text"` URL string `json:"url,omitempty"` LoginURL *LoginURL `json:"login_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 ¶
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 ¶
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 ¶
type InlineQueryResult interface {
// contains filtered or unexported methods
}
InlineQueryResult represents one result of an inline query
type InlineQueryResultArticle ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
type InputMedia interface {
// contains filtered or unexported methods
}
InputMedia file
type InputMediaPhoto ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
type KeyboardButton struct { Text string `json:"text"` RequestContact bool `json:"request_contact"` RequestLocation bool `json:"request_location"` RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"` }
KeyboardButton represents one button of the reply keyboard
type KeyboardButtonPollType ¶
type KeyboardButtonPollType struct {
Type string `json:"type"`
}
KeyboardButtonPollType represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed
type LabeledPrice ¶
LabeledPrice represents a portion of the price for goods or services
type Logger ¶
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 LoginURL ¶
type LoginURL struct { URL string `json:"url"` ForwardText *string `json:"forward_text,omitempty"` BotUsername *string `json:"bot_username,omitempty"` RequestWriteAccess *string `json:"request_write_access,omitempty"` }
LoginURL is a property of InlineKeyboardButton for Seamless Login feature
type MaskPosition ¶
type MaskPosition struct { Point string `json:"point"` XShift float32 `json:"x_shift"` YShift float32 `json:"y_shift"` Scale float32 `json:"scale"` }
MaskPosition describes the position on faces where a mask should be placed by default
type Message ¶
type Message struct { 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"` ForwardSenderName string `json:"forward_sender_name"` 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"` Poll *Poll `json:"poll"` Dice *Dice `json:"dice"` 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"` ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup"` }
Message represents a message
type MessageEntity ¶
type MessageEntity struct { Type string `json:"type"` Offset int `json:"offset"` Length int `json:"length"` URL string `json:"url"` User *User `json:"user"` Language string `json:"language"` }
MessageEntity represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
type Middleware ¶
type Middleware func(UpdateHandler) UpdateHandler
Middleware is a middleware for updates
type OrderInfo ¶
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 ¶
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 ¶
type PassportElementError interface {
// contains filtered or unexported methods
}
PassportElementError represents an error in the Telegram Passport element
type PassportElementErrorDataField ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
type PassportFile struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_id"` FileSize int `json:"file_size"` FileDate int `json:"file_date"` }
PassportFile represents a file uploaded to Telegram Passport
type PhotoSize ¶
type PhotoSize struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_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 Poll ¶
type Poll struct { ID string `json:"id"` Question string `json:"question"` Options []PollOption `json:"options"` TotalVoterCount int `json:"total_voter_count"` IsClosed bool `json:"is_closed"` IsAnonymous bool `json:"is_anonymous"` Type string `json:"type"` AllowsMultipleAnswers bool `json:"allows_multiple_answers"` CorrectOptionID int `json:"correct_option_id"` }
Poll represents native telegram poll
type PollAnswer ¶
type PollAnswer struct { PollID int `json:"poll_id"` User User `json:"user"` OptionIDs []int `json:"option_ids"` }
PollAnswer represents an answer of a user in a non-anonymous poll
type PollOption ¶
PollOption is an option for Poll
type PreCheckoutQuery ¶
type PreCheckoutQuery struct { ID string `json:"id"` From *User `json:"from"` Currency string `json:"currency"` TotalAmount int `json:"total_amount"` InvoicePayload string `json:"invoice_payload"` ShippingOptionID string `json:"shipping_option_id"` OrderInfo *OrderInfo `json:"order_info"` }
PreCheckoutQuery contains information about an incoming pre-checkout query
type Promotions ¶
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 ¶
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
func Buttons ¶
func Buttons(buttons [][]string) *ReplyKeyboardMarkup
Buttons construct ReplyKeyboardMarkup from strings
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server will connect and serve all updates from Telegram
func New ¶
func New(token string, options ...ServerOption) *Server
New creates new Server. Available options:
WithWebhook(url, addr string) WithHTTPClient(client *http.Client) WithBaseURL(baseURL string)
func (*Server) HandleCallback ¶
func (s *Server) HandleCallback(handler func(*CallbackQuery))
HandleCallback set handler for inline buttons
func (*Server) HandleChannelPost ¶
HandleChannelPost set handler for incoming channel post
func (*Server) HandleEditChannelPost ¶
HandleEditChannelPost set handler for incoming edited channel post
func (*Server) HandleEditedMessage ¶
HandleEditedMessage set handler for incoming edited messages
func (*Server) HandleInlineQuery ¶
func (s *Server) HandleInlineQuery(handler func(*InlineQuery))
HandleInlineQuery set handler for inline queries
func (*Server) HandleInlineResult ¶
func (s *Server) HandleInlineResult(handler func(*ChosenInlineResult))
HandleInlineResult set inline result handler
func (*Server) HandleMessage ¶
HandleMessage sets handler for incoming messages
func (*Server) HandleMessageAuto ¶
func (*Server) HandlePollAnswer ¶
func (s *Server) HandlePollAnswer(handler func(*PollAnswer))
HandlePollAnswer set handler for non-anonymous poll updates
func (*Server) HandlePollUpdate ¶
HandlePollUpdate set handler for anonymous poll updates
func (*Server) HandlePreCheckout ¶
func (s *Server) HandlePreCheckout(handler func(*PreCheckoutQuery))
HandlePreCheckout set handler for pre-checkout queries
func (*Server) HandleShipping ¶
func (s *Server) HandleShipping(handler func(*ShippingQuery))
HandleShipping set handler for shipping queries
func (*Server) Use ¶
func (s *Server) Use(m Middleware, handler func(*Message))
Use adds middleware to server
type ServerOption ¶
type ServerOption func(*Server)
ServerOption type for additional Server options
func WithBaseURL ¶
func WithBaseURL(baseURL string) ServerOption
WithBaseURL sets custom apiBaseURL for server. It may be necessary to run the server in some countries
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ServerOption
WithHTTPClient sets custom http client for server.
func WithWebhook ¶
func WithWebhook(url, addr string) ServerOption
WithWebhook returns ServerOption for given Webhook URL and Server address to listen. e.g. WithWebhook("https://bot.example.com/super/url", "0.0.0.0:8080")
type ShippingAddress ¶
type ShippingAddress struct { CountryCode string `json:"country_code"` State string `json:"state"` City string `json:"city"` StreetLine1 string `json:"street_line1"` StreetLine2 string `json:"street_line2"` PostCode string `json:"post_code"` }
ShippingAddress represents a shipping address
type ShippingOption ¶
type ShippingOption struct { ID string `json:"id"` Title string `json:"title"` Prices []LabeledPrice `json:"prices"` }
ShippingOption represents one shipping option
type ShippingQuery ¶
type ShippingQuery struct { ID string `json:"id"` From *User `json:"from"` InvoicePayload string `json:"invoice_payload"` ShippingAddress *ShippingAddress `json:"shipping_address"` }
ShippingQuery contains information about an incoming shipping query
type Sticker ¶
type Sticker struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_id"` Width int `json:"width"` Height int `json:"height"` IsAnimated bool `json:"is_animated"` 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 ¶
type StickerSet struct { Name string `json:"name"` Title string `json:"title"` IsAnimated bool `json:"is_animated"` ContainsMasks bool `json:"contains_masks"` Stickers []Sticker `json:"stickers"` Thumb *PhotoSize `json:"thumb"` }
StickerSet represents sticker set
type SuccessfulPayment ¶
type SuccessfulPayment struct { Currency string `json:"currency"` TotalAmount int `json:"total_amount"` InvoicePayload string `json:"invoice_payload"` ShippingOptionID string `json:"shipping_option_id"` 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 ¶
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"` Poll *Poll `json:"poll"` PollAnswer *PollAnswer `json:"poll_answer"` }
Update represents an incoming update UpdateID is unique identifier At most one of the other fields can be not nil
type User ¶
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"` CanJoinGroups bool `json:"can_join_groups"` CanReadAllGroupMessages bool `json:"can_read_all_group_messages"` SupportsInlineQueries bool `json:"supports_inline_queries"` }
User is telegram user
type UserProfilePhotos ¶
type UserProfilePhotos struct { TotalCount int `json:"total_count"` Photos [][]PhotoSize `json:"photos"` }
UserProfilePhotos represent a user's profile pictures
type Venue ¶
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 ¶
type Video struct { FileID string `json:"file_id"` FileUniqueID string `json:"file_unique_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