tbot: github.com/yanzay/tbot Index | Files

package tbot

import "github.com/yanzay/tbot"

Index

Package Files

api.go client.go client_helpers.go helpers.go logger.go server.go updates.go

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

type Animation Uses

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 Uses

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 Uses

type BasicLogger struct{}

func (BasicLogger) Debug Uses

func (BasicLogger) Debug(args ...interface{})

func (BasicLogger) Debugf Uses

func (BasicLogger) Debugf(format string, args ...interface{})

func (BasicLogger) Error Uses

func (BasicLogger) Error(args ...interface{})

func (BasicLogger) Errorf Uses

func (BasicLogger) Errorf(format string, args ...interface{})

func (BasicLogger) Info Uses

func (BasicLogger) Info(args ...interface{})

func (BasicLogger) Infof Uses

func (BasicLogger) Infof(format string, args ...interface{})

func (BasicLogger) Print Uses

func (BasicLogger) Print(args ...interface{})

func (BasicLogger) Printf Uses

func (BasicLogger) Printf(format string, args ...interface{})

func (BasicLogger) Warn Uses

func (BasicLogger) Warn(args ...interface{})

func (BasicLogger) Warnf Uses

func (BasicLogger) Warnf(format string, args ...interface{})

type CallbackQuery Uses

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 Uses

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
    CanSetStickerSet            bool
}

Chat represents a chat

func (*Chat) UnmarshalJSON Uses

func (c *Chat) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type ChatMember Uses

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"`
    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 Uses

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 Uses

type ChatPhoto struct {
    SmallFileID string `json:"small_file_id"`
    BigFileID   string `json:"big_file_id"`
}

ChatPhoto represents a chat photo

type ChosenInlineResult Uses

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 Uses

type Client struct {
    // contains filtered or unexported fields
}

Client is a low-level Telegram client

func NewClient Uses

func NewClient(token string, httpClient *http.Client, baseURL string) *Client

NewClient creates new Telegram API client

func (*Client) AddStickerToSet Uses

func (c *Client) AddStickerToSet(userID int, name, fileID, emojis string, opts ...sendOption) error

AddStickerToSet add a new sticker to a set created by the bot. Available options:

- OptMaskPosition(pos *MaskPosition)

func (*Client) AddStickerToSetFile Uses

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 Uses

func (c *Client) AnswerCallbackQuery(callbackQueryID string, opts ...sendOption) error

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 Uses

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 Uses

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 Uses

func (c *Client) AnswerShippingQuery(shippingQueryID string, ok bool, opts ...sendOption) error

AnswerShippingQuery reply to shipping queries. Available options:

- OptShippingOptions(options []ShippingOption)
- OptErrorMessage(msg string)

func (*Client) CreateNewStickerSet Uses

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 Uses

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 Uses

func (c *Client) DeleteChatPhoto(chatID string) error

DeleteChatPhoto deleta a chat photo

func (*Client) DeleteChatStickerSet Uses

func (c *Client) DeleteChatStickerSet(chatID string) error

DeleteChatStickerSet delete a group sticker set from a supergroup

func (*Client) DeleteMessage Uses

func (c *Client) DeleteMessage(chatID string, messageID int) error

DeleteMessage delete a message, including service messages

func (*Client) DeleteStickerFromSet Uses

func (c *Client) DeleteStickerFromSet(fileID string) error

DeleteStickerFromSet delete a sticker from a set created by the bot

func (*Client) EditInlineMessageCaption Uses

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 Uses

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 Uses

func (c *Client) EditInlineMessageReplyMarkup(inlineMessageID string, opts ...sendOption) error

EditInlineMessageReplyMarkup edit only the reply markup of messages sent by the bot. Available options:

- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)

func (*Client) EditInlineMessageText Uses

func (c *Client) EditInlineMessageText(inlineMessageID, text string, opts ...sendOption) error

EditInlineMessageText edit text and game messages sent via the bot (for inline bots). Available options:

- OptParseModeHTML
- OptParseModeMarkdown
- OptDisableWebPagePreview
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)

func (*Client) EditMessageCaption Uses

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 Uses

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 Uses

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 Uses

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 (c *Client) ExportChatInviteLink(chatID string) (string, error)

ExportChatInviteLink generate a new invite link for a chat; any previously generated link is revoked

func (*Client) FileURL Uses

func (c *Client) FileURL(file *File) string

FileURL returns file URL ready for download

func (*Client) ForwardMessage Uses

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) GetChat Uses

func (c *Client) GetChat(chatID string) (*Chat, error)

GetChat get up to date information about the chat

func (*Client) GetChatAdministrators Uses

func (c *Client) GetChatAdministrators(chatID string) ([]*ChatMember, error)

GetChatAdministrators get a list of administrators in a chat

func (*Client) GetChatMember Uses

func (c *Client) GetChatMember(chatID string, userID int) (*ChatMember, error)

GetChatMember get information about a member of a chat

func (*Client) GetChatMembersCount Uses

func (c *Client) GetChatMembersCount(chatID string) (int, error)

GetChatMembersCount returns the number of members in chat

func (*Client) GetFile Uses

func (c *Client) GetFile(fileID string) (*File, error)

GetFile returns File object by fileID.

func (*Client) GetGameHighScores Uses

func (c *Client) GetGameHighScores(chatID string, messageID, userID int) ([]*GameHighScore, error)

GetGameHighScores get data for high score tables

func (*Client) GetInlineGameHighScores Uses

func (c *Client) GetInlineGameHighScores(inlineMessageID string, userID int) ([]*GameHighScore, error)

GetInlineGameHighScores get data for high score tables

func (*Client) GetMe Uses

func (c *Client) GetMe() (*User, error)

GetMe returns info about bot as a User object

func (*Client) GetStickerSet Uses

func (c *Client) GetStickerSet(name string) (*StickerSet, error)

GetStickerSet get a sticker set

func (*Client) GetUserProfilePhotos Uses

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 Uses

func (c *Client) KickChatMember(chatID string, userID int, opts ...sendOption) error

KickChatMember kicks user from group, supergroup or channel. Available options:

- OptUntilDate(date time.Time)

func (*Client) LeaveChat Uses

func (c *Client) LeaveChat(chatID string) error

LeaveChat leave a group, supergroup or channel

func (*Client) PinChatMessage Uses

func (c *Client) PinChatMessage(chatID string, messageID int, opts ...sendOption) error

PinChatMessage pin a message in a supergroup or a channel. Available options:

- OptDisableNotification

func (*Client) PromoteChatMember Uses

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 Uses

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 Uses

func (c *Client) SendAnimation(chatID string, fileID string, opts ...sendOption) (*Message, error)

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 Uses

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 Uses

func (c *Client) SendAudio(chatID string, fileID string, opts ...sendOption) (*Message, error)

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 Uses

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 Uses

func (c *Client) SendChatAction(chatID string, action chatAction) error

SendChatAction sends bot chat action. Available actions:

- ActionTyping
- ActionUploadPhoto
- ActionRecordVideo
- ActionUploadVideo
- ActionRecordAudio
- ActionUploadAudio
- ActionUploadDocument
- ActionFindLocation
- ActionRecordVideoNote
- ActionUploadVideoNote

func (*Client) SendContact Uses

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 Uses

func (c *Client) SendDocument(chatID string, fileID string, opts ...sendOption) (*Message, error)

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 Uses

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 Uses

func (c *Client) SendGame(chatID, gameShortName string, opts ...sendOption) (*Message, error)

SendGame send a game. Available options:

- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)

func (*Client) SendInvoice Uses

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 Uses

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 Uses

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 Uses

func (c *Client) SendMessage(chatID string, text string, opts ...sendOption) (*Message, error)

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 Uses

func (c *Client) SendPhoto(chatID string, fileID string, opts ...sendOption) (*Message, error)

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 Uses

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 Uses

func (c *Client) SendPoll(chatID string, question string, options []string, opts ...sendOption) (*Message, error)

SendPoll sends native telegram poll. Available Options:

- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective

func (*Client) SendSticker Uses

func (c *Client) SendSticker(chatID, fileID string, opts ...sendOption) (*Message, error)

SendSticker send previously uploaded sticker. Available options:

- OptDisableNotification
- OptReplyToMessageID(id int)
- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)
- OptReplyKeyboardMarkup(markup *ReplyKeyboardMarkup)
- OptReplyKeyboardRemove
- OptReplyKeyboardRemoveSelective
- OptForceReply
- OptForceReplySelective

func (*Client) SendStickerFile Uses

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 Uses

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 Uses

func (c *Client) SendVideo(chatID string, fileID string, opts ...sendOption) (*Message, error)

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 Uses

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 Uses

func (c *Client) SendVideoNote(chatID string, fileID string, opts ...sendOption) (*Message, error)

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 Uses

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 Uses

func (c *Client) SendVoice(chatID string, fileID string, opts ...sendOption) (*Message, error)

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 Uses

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 Uses

func (c *Client) SetChatDescription(chatID, description string) error

SetChatDescription change the description of a supergroup or a channel

func (*Client) SetChatPermissions Uses

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 Uses

func (c *Client) SetChatPhoto(chatID string, filename string) error

SetChatPhoto set a new profile photo for the chat

func (*Client) SetChatStickerSet Uses

func (c *Client) SetChatStickerSet(chatID, stickerSetName string) error

SetChatStickerSet set a new group sticker set for a supergroup

func (*Client) SetChatTitle Uses

func (c *Client) SetChatTitle(chatID, title string) error

SetChatTitle change the title of the chat

func (*Client) SetGameScore Uses

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 Uses

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 Uses

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 Uses

func (c *Client) SetStickerPositionInSet(fileID string, pos int) error

SetStickerPositionInSet move a sticker in a set created by the bot to a specific position

func (*Client) StopInlineMessageLiveLocation Uses

func (c *Client) StopInlineMessageLiveLocation(inlineMessageID string, opts ...sendOption) error

StopInlineMessageLiveLocation stop updating a live location message sent via the bot (using inline mode). Available options:

- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)

func (*Client) StopMessageLiveLocation Uses

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 Uses

func (c *Client) StopPoll(chatID string, messageID string, opts ...sendOption) (*Poll, error)

StopPoll stops poll. Available Options:

- OptInlineKeyboardMarkup(markup *InlineKeyboardMarkup)

func (*Client) UnbanChatMember Uses

func (c *Client) UnbanChatMember(chatID string, userID int) error

UnbanChatMember unban a previously kicked user in a supergroup or channel

func (*Client) UnpinChatMessage Uses

func (c *Client) UnpinChatMessage(chatID string) error

UnpinChatMessage unpin a message in a supergroup or a channel

func (*Client) UploadStickerFile Uses

func (c *Client) UploadStickerFile(userID int, filename string) (*File, error)

UploadStickerFile upload a .png file with a sticker for later use in CreateNewStickerSet and AddStickerToSet

type Contact Uses

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 Uses

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 Uses

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 Uses

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 Uses

type File struct {
    FileID   string `json:"file_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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

type InlineQueryResult interface {
    // contains filtered or unexported methods
}

InlineQueryResult represents one result of an inline query

type InlineQueryResultArticle Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

type InputMedia interface {
    // contains filtered or unexported methods
}

InputMedia file

type InputMediaPhoto Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

type LabeledPrice struct {
    Label  string `json:"label"`
    Amount int    `json:"amount"`
}

LabeledPrice represents a portion of the price for goods or services

type Location Uses

type Location struct {
    Longitude float64 `json:"longitude"`
    Latitude  float64 `json:"latitude"`
}

Location represents a point on the map

type Logger Uses

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 Uses

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 Uses

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 Uses

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"`
    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 Uses

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 Middleware Uses

type Middleware func(UpdateHandler) UpdateHandler

Middleware is a middleware for updates

type OrderInfo Uses

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 Uses

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 Uses

type PassportElementError interface {
    // contains filtered or unexported methods
}

PassportElementError represents an error in the Telegram Passport element

type PassportElementErrorDataField Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Poll Uses

type Poll struct {
    ID       string       `json:"id"`
    Question string       `json:"question"`
    Options  []PollOption `json:"options"`
    IsClosed bool         `json:"is_closed"`
}

Poll represents native telegram poll

type PollOption Uses

type PollOption struct {
    Text       string `json:"text"`
    VoterCount int    `json:"voter_count"`
}

PollOption is an option for Poll

type PreCheckoutQuery Uses

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 Uses

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 Uses

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 Uses

func Buttons(buttons [][]string) *ReplyKeyboardMarkup

Buttons construct ReplyKeyboardMarkup from strings

type Server Uses

type Server struct {
    // contains filtered or unexported fields
}

Server will connect and serve all updates from Telegram

func New Uses

func New(token string, options ...ServerOption) *Server

New creates new Server. Available options:

WithWebook(url, addr string)
WithHTTPClient(client *http.Client)

func (*Server) Client Uses

func (s *Server) Client() *Client

Client returns Telegram API Client

func (*Server) HandleCallback Uses

func (s *Server) HandleCallback(handler func(*CallbackQuery))

HandleCallback set handler for inline buttons

func (*Server) HandleChannelPost Uses

func (s *Server) HandleChannelPost(handler func(*Message))

HandleChannelPost set handler for incoming channel post

func (*Server) HandleEditChannelPost Uses

func (s *Server) HandleEditChannelPost(handler func(*Message))

HandleEditChannelPost set handler for incoming edited channel post

func (*Server) HandleEditedMessage Uses

func (s *Server) HandleEditedMessage(handler func(*Message))

HandleEditedMessage set handler for incoming edited messages

func (*Server) HandleInlineQuery Uses

func (s *Server) HandleInlineQuery(handler func(*InlineQuery))

HandleInlineQuery set handler for inline queries

func (*Server) HandleInlineResult Uses

func (s *Server) HandleInlineResult(handler func(*ChosenInlineResult))

HandleInlineResult set inline result handler

func (*Server) HandleMessage Uses

func (s *Server) HandleMessage(pattern string, handler func(*Message))

HandleMessage sets handler for incoming messages

func (*Server) HandlePollUpdate Uses

func (s *Server) HandlePollUpdate(handler func(*Poll))

HandlePollUpdate set handler for native poll updates

func (*Server) HandlePreCheckout Uses

func (s *Server) HandlePreCheckout(handler func(*PreCheckoutQuery))

HandlePreCheckout set handler for pre-checkout queries

func (*Server) HandleShipping Uses

func (s *Server) HandleShipping(handler func(*ShippingQuery))

HandleShipping set handler for shipping queries

func (*Server) Start Uses

func (s *Server) Start() error

Start listening for updates

func (*Server) Stop Uses

func (s *Server) Stop()

Stop listening for updates

func (*Server) Use Uses

func (s *Server) Use(m Middleware)

Use adds middleware to server

type ServerOption Uses

type ServerOption func(*Server)

ServerOption type for additional Server options

func WithHTTPClient Uses

func WithHTTPClient(client *http.Client) ServerOption

WithHTTPClient sets custom http client for server.

func WithLogger Uses

func WithLogger(logger Logger) ServerOption

WithLogger sets logger for tbot

func WithWebhook Uses

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 Uses

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 Uses

type ShippingOption struct {
    ID     string         `json:"id"`
    Title  string         `json:"title"`
    Prices []LabeledPrice `json:"prices"`
}

ShippingOption represents one shipping option

type ShippingQuery Uses

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 Uses

type Sticker struct {
    FileID       string        `json:"file_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 Uses

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"`
}

StickerSet represents sticker set

type SuccessfulPayment Uses

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 Uses

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"`
}

Update represents an incoming update UpdateID is unique identifier At most one of the other fields can be not nil

type UpdateHandler Uses

type UpdateHandler func(*Update)

UpdateHandler is a function for middlewares

type User Uses

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 Uses

type UserProfilePhotos struct {
    TotalCount int           `json:"total_count"`
    Photos     [][]PhotoSize `json:"photos"`
}

UserProfilePhotos represent a user's profile pictures

type Venue Uses

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 Uses

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

type VideoNote Uses

type VideoNote struct {
    FileID   string     `json:"file_id"`
    Length   int        `json:"length"`
    Duration int        `json:"duration"`
    Thumb    *PhotoSize `json:"thumb"`
    FileSize int        `json:"file_size"`
}

VideoNote represents a video message

type Voice Uses

type Voice struct {
    FileID   string `json:"file_id"`
    Duration int    `json:"duration"`
    MimeType string `json:"mime_type"`
    FileSize int    `json:"file_size"`
}

Voice represents a voice note

Package tbot imports 12 packages (graph) and is imported by 1 packages. Updated 2019-12-07. Refresh now. Tools for package owners.