ext

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2020 License: GPL-3.0 Imports: 17 Imported by: 87

Documentation

Index

Constants

View Source
const ApiUrl = "https://api.telegram.org/bot"

Variables

View Source
var DefaultTgBotRequester = BaseRequester{
	Client: http.Client{
		Timeout: time.Millisecond * 1500,
	},
	ApiUrl: ApiUrl,
}

Functions

This section is empty.

Types

type Animation

type Animation struct {
	FileId       string     `json:"file_id"`
	FileUniqueId string     `json:"file_unique_id"`
	Width        int        `json:"width"`
	Height       int        `json:"height"`
	Duration     int        `json:"duration"`
	Thumb        *PhotoSize `json:"thumb"`
	FileName     string     `json:"file_name"`
	MimeType     string     `json:"mime_type"`
	FileSize     int        `json:"file_size"`
}

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"`
	FileName     string     `json:"file_name"`
	MimeType     string     `json:"mime_type"`
	FileSize     int        `json:"file_size"`
	Thumb        *PhotoSize `json:"thumb"`
}

type BasePassportError

type BasePassportError struct {
	Source  string
	Type    string
	Message string
}

type BaseRequester

type BaseRequester struct {
	Client http.Client
	ApiUrl string
}

func (BaseRequester) Get

func (tbg BaseRequester) Get(l *zap.SugaredLogger, token string, method string, params url.Values) (json.RawMessage, error)

func (BaseRequester) Post

func (tbg BaseRequester) Post(l *zap.SugaredLogger, token string, method string, params url.Values, data map[string]PostFile) (json.RawMessage, error)

type Bot

type Bot struct {
	Token     string
	Id        int
	FirstName string
	UserName  string

	Logger                   *zap.SugaredLogger `json:"-"`
	DisableWebPreview        bool
	AllowSendingWithoutReply bool
	Requester
}

func NewBot

func NewBot(l *zap.Logger, token string) (*Bot, error)

func (Bot) AddPngStickerToSet

func (b Bot) AddPngStickerToSet(userId int, name string, pngSticker InputFile, emojis string) (bool, error)

func (Bot) AddTgsStickerToSet

func (b Bot) AddTgsStickerToSet(userId int, name string, tgsSticker InputFile, emojis string) (bool, error)

func (Bot) AnswerCallbackQuery

func (b Bot) AnswerCallbackQuery(callbackQueryId string) (bool, error)

AnswerCallbackQuery answer a callback query

func (Bot) AnswerCallbackQueryText

func (b Bot) AnswerCallbackQueryText(callbackQueryId string, text string, alert bool) (bool, error)

AnswerCallbackQueryText answer a callback query with text

func (Bot) AnswerCallbackQueryURL

func (b Bot) AnswerCallbackQueryURL(callbackQueryId string, url string) (bool, error)

AnswerCallbackQueryURL answer a callback query with a URL

func (Bot) AnswerInlineQuery

func (b Bot) AnswerInlineQuery(inlineQueryId string, results []InlineQueryResult) (bool, error)

func (Bot) AnswerPreCheckoutQuery

func (b Bot) AnswerPreCheckoutQuery(preCheckoutQueryId string, ok bool) (bool, error)

func (Bot) AnswerShippingQuery

func (b Bot) AnswerShippingQuery(shippingQueryId string, ok bool) (bool, error)

func (Bot) Close

func (b Bot) Close() (bool, error)

func (Bot) CreateNewPngStickerSet

func (b Bot) CreateNewPngStickerSet(userId int, name string, title string, pngSticker InputFile, emojis string) (bool, error)

func (Bot) CreateNewTgsStickerSet

func (b Bot) CreateNewTgsStickerSet(userId int, name string, title string, tgsSticker InputFile, emojis string) (bool, error)

func (Bot) DeleteChatPhoto

func (b Bot) DeleteChatPhoto(chatId int) (bool, error)

func (Bot) DeleteChatStickerSet

func (b Bot) DeleteChatStickerSet(chatId int) (bool, error)

func (Bot) DeleteMessage

func (b Bot) DeleteMessage(chatId int, messageId int) (bool, error)

func (Bot) DeleteStickerFromSet

func (b Bot) DeleteStickerFromSet(sticker string) (bool, error)

func (Bot) DeleteWebhook

func (b Bot) DeleteWebhook() (bool, error)

func (Bot) DeleteWebhookDrop

func (b Bot) DeleteWebhookDrop(dropUpdates bool) (bool, error)

func (Bot) DemoteChatMember

func (b Bot) DemoteChatMember(chatId int, userId int) (bool, error)

func (Bot) EditMessage

func (b Bot) EditMessage(chatId int, messageId int, text string, parseMode string) (*Message, error)

func (Bot) EditMessageCaption

func (b Bot) EditMessageCaption(chatId int, messageId int, caption string) (*Message, error)

func (Bot) EditMessageCaptionInline

func (b Bot) EditMessageCaptionInline(inlineMessageId string, caption string) (*Message, error)

func (Bot) EditMessageCaptionMarkup

func (b Bot) EditMessageCaptionMarkup(chatId int, messageId int, caption string, markup ReplyMarkup) (*Message, error)

func (Bot) EditMessageCaptionParseMode

func (b Bot) EditMessageCaptionParseMode(chatId int, messageId int, caption string, parseMode string) (*Message, error)

func (Bot) EditMessageHTML

func (b Bot) EditMessageHTML(chatId int, messageId int, text string) (*Message, error)

func (Bot) EditMessageHTMLInline

func (b Bot) EditMessageHTMLInline(inlineMessageId string, text string) (*Message, error)

func (Bot) EditMessageInline

func (b Bot) EditMessageInline(inlineMessageId string, text string, parseMode string) (*Message, error)

func (Bot) EditMessageMarkdown

func (b Bot) EditMessageMarkdown(chatId int, messageId int, text string) (*Message, error)

func (Bot) EditMessageMarkdownInline

func (b Bot) EditMessageMarkdownInline(inlineMessageId string, text string) (*Message, error)

func (Bot) EditMessageMarkdownV2

func (b Bot) EditMessageMarkdownV2(chatId int, messageId int, text string) (*Message, error)

func (Bot) EditMessageMarkdownV2Inline

func (b Bot) EditMessageMarkdownV2Inline(inlineMessageId string, text string) (*Message, error)

func (Bot) EditMessageReplyMarkup

func (b Bot) EditMessageReplyMarkup(chatId int, messageId int, replyMarkup InlineKeyboardMarkup) (*Message, error)

func (Bot) EditMessageReplyMarkupInline

func (b Bot) EditMessageReplyMarkupInline(inlineMessageId string, replyMarkup InlineKeyboardMarkup) (*Message, error)

func (Bot) EditMessageText

func (b Bot) EditMessageText(chatId int, messageId int, text string) (*Message, error)

func (Bot) EditMessageTextInline

func (b Bot) EditMessageTextInline(inlineMessageId string, text string) (*Message, error)

func (Bot) EditMessageTextMarkup

func (b Bot) EditMessageTextMarkup(chatId int, messageId int, text string, parseMode string, markup ReplyMarkup) (*Message, error)
func (b Bot) ExportChatInviteLink(chatId int) (string, error)

func (Bot) ForwardMessage

func (b Bot) ForwardMessage(chatId int, fromChatId int, messageId int) (*Message, error)

func (Bot) Get

func (b Bot) Get(method string, params url.Values) (json.RawMessage, error)

Get -> convenience function to execute commands against the TG API.

func (Bot) GetChat

func (b Bot) GetChat(chatId int) (*Chat, error)

func (Bot) GetChatAdministrators

func (b Bot) GetChatAdministrators(chatId int) ([]ChatMember, error)

func (Bot) GetChatMember

func (b Bot) GetChatMember(chatId int, userId int) (*ChatMember, error)

func (Bot) GetChatMembersCount

func (b Bot) GetChatMembersCount(chatId int) (int, error)

func (Bot) GetFile

func (b Bot) GetFile(fileId string) (*File, error)

GetFile Retrieve a file from the bot api

func (Bot) GetGameHighScores

func (b Bot) GetGameHighScores(userId int, chatId int, messageId int) ([]GameHighScore, error)

func (Bot) GetGameHighScoresInline

func (b Bot) GetGameHighScoresInline(userId int, inlineMessageId string) ([]GameHighScore, error)

func (Bot) GetMe

func (b Bot) GetMe() (*User, error)

GetMe gets the bot info

func (Bot) GetMyCommands

func (b Bot) GetMyCommands() ([]BotCommand, error)

GetMyCommands gets the list of bot commands assigned to the bot.

func (Bot) GetStickerSet

func (b Bot) GetStickerSet(name string) (*StickerSet, error)

func (Bot) GetUserProfilePhotos

func (b Bot) GetUserProfilePhotos(userId int, offset int, limit int) (*UserProfilePhotos, error)

GetUserProfilePhotos Retrieves a user's profile pictures

func (Bot) GetWebhookInfo

func (b Bot) GetWebhookInfo() (*WebhookInfo, error)

GetWebhookInfo Get webhook info from telegram servers

func (Bot) KickChatMember

func (b Bot) KickChatMember(chatId int, userId int) (bool, error)

func (Bot) KickChatMemberUntil

func (b Bot) KickChatMemberUntil(chatId int, userId int, untilDate int64) (bool, error)

func (Bot) LeaveChat

func (b Bot) LeaveChat(chatId int) (bool, error)

func (Bot) LogOut

func (b Bot) LogOut() (bool, error)

func (Bot) NewFileId

func (b Bot) NewFileId(fileId string) InputFile

func (Bot) NewFileReader

func (b Bot) NewFileReader(name string, r io.Reader) InputFile

func (Bot) NewFileURL

func (b Bot) NewFileURL(url string) InputFile

func (Bot) NewSendableAddStickerToSet

func (b Bot) NewSendableAddStickerToSet(userId int, name string, emojis string) *sendableAddStickerToSet

func (Bot) NewSendableAnimation

func (b Bot) NewSendableAnimation(chatId int, caption string) *sendableAnimation

NewSendableAnimation creates a new animation struct to send

func (Bot) NewSendableAnswerCallbackQuery

func (b Bot) NewSendableAnswerCallbackQuery(queryId string) *sendableCallbackQuery

NewSendableAnswerCallbackQuery creates a new callbackQuery struct to send.

func (Bot) NewSendableAnswerInlineQuery

func (b Bot) NewSendableAnswerInlineQuery(inlineQueryId string, results []InlineQueryResult) *sendableAnswerInlineQuery

func (Bot) NewSendableAnswerPreCheckoutQuery

func (b Bot) NewSendableAnswerPreCheckoutQuery(shippingQueryId string, ok bool) *sendableAnswerPreCheckoutQuery

func (Bot) NewSendableAnswerShippingQuery

func (b Bot) NewSendableAnswerShippingQuery(shippingQueryId string, ok bool) *sendableAnswerShippingQuery

func (Bot) NewSendableAudio

func (b Bot) NewSendableAudio(chatId int, caption string) *sendableAudio

NewSendableAudio creates a new audio struct to send

func (Bot) NewSendableChatAction

func (b Bot) NewSendableChatAction(chatId int) *sendableChatAction

NewSendableChatAction creates a new chat action struct to send

func (Bot) NewSendableContact

func (b Bot) NewSendableContact(chatId int) *sendableContact

NewSendableContact creates a new contact struct to send

func (Bot) NewSendableCopyMessage

func (b Bot) NewSendableCopyMessage(chatId int, fromChatId int, messageId int) *sendableCopyMessage

NewSendableMessage create a new message struct to send

func (Bot) NewSendableCreateNewStickerSet

func (b Bot) NewSendableCreateNewStickerSet(userId int, name string, title string, emojis string) *sendableCreateNewStickerSet

func (Bot) NewSendableDice

func (b Bot) NewSendableDice(chatId int) *sendableDice

NewSendableDice creates a new poll struct to send.

func (Bot) NewSendableDocument

func (b Bot) NewSendableDocument(chatId int, caption string) *sendableDocument

NewSendableDocument creates a new document struct to send

func (Bot) NewSendableEditMessageCaption

func (b Bot) NewSendableEditMessageCaption(chatId int, messageId int, caption string) *sendableEditMessageCaption

NewSendableEditMessageCaption create a new caption editing struct to send

func (Bot) NewSendableEditMessageLiveLocation

func (b Bot) NewSendableEditMessageLiveLocation(chatId int, latitude float64, longitude float64) *sendableEditMessageLiveLocation

func (Bot) NewSendableEditMessageMedia

func (b Bot) NewSendableEditMessageMedia(chatId int, messageId int) *sendableEditMessageMedia

NewSendableEditMessageMedia creates a new editmessage media struct to send

func (Bot) NewSendableEditMessageReplyMarkup

func (b Bot) NewSendableEditMessageReplyMarkup(chatId int, messageId int, markup ReplyMarkup) *sendableEditMessageReplyMarkup

NewSendableEditMessageReplyMarkup creates a new markup editing struct to send

func (Bot) NewSendableEditMessageText

func (b Bot) NewSendableEditMessageText(chatId int, messageId int, text string) *sendableEditMessageText

NewSendableEditMessageText create a new message editing struct to send

func (Bot) NewSendableGame

func (b Bot) NewSendableGame(chatId int, gameShortName string) *sendableGame

func (Bot) NewSendableGetGameHighScore

func (b Bot) NewSendableGetGameHighScore(userId int, chatId int, messageId int) *sendableGetGameHighScores

func (Bot) NewSendableGetGameHighScoreInline

func (b Bot) NewSendableGetGameHighScoreInline(userId int, inlineMessageId string) *sendableGetGameHighScores

func (Bot) NewSendableInvoice

func (b Bot) NewSendableInvoice(chatId int, title string, description string, payload string, providerToken string, startParameter string, currency string, prices []LabeledPrice) *sendableInvoice

func (Bot) NewSendableKickChatMember

func (b Bot) NewSendableKickChatMember(chatId int, userId int) *sendableKickChatMember

func (Bot) NewSendableLocation

func (b Bot) NewSendableLocation(chatId int) *sendableLocation

func (Bot) NewSendableMediaGroup

func (b Bot) NewSendableMediaGroup(chatId int) *sendableMediaGroup

NewSendableMediaGroup creates a new mediagroup struct to send

func (Bot) NewSendableMessage

func (b Bot) NewSendableMessage(chatId int, text string) *sendableTextMessage

NewSendableMessage create a new message struct to send

func (Bot) NewSendablePhoto

func (b Bot) NewSendablePhoto(chatId int, caption string) *sendablePhoto

NewSendablePhoto creates a new photo struct to send

func (Bot) NewSendablePinChatMessage

func (b Bot) NewSendablePinChatMessage(chatId int, messageId int) *sendablePinChatMessage

func (Bot) NewSendablePoll

func (b Bot) NewSendablePoll(chatId int, question string, options []string) *sendablePoll

NewSendablePoll creates a new poll struct to send.

func (Bot) NewSendablePromoteChatMember

func (b Bot) NewSendablePromoteChatMember(chatId int, userId int) *sendablePromoteChatMember

note: set all as true for promotion by default

func (Bot) NewSendableRestrictChatMember

func (b Bot) NewSendableRestrictChatMember(chatId int, userId int) *sendableRestrictChatMember

func (Bot) NewSendableSetChatAdministratorCustomTitle

func (b Bot) NewSendableSetChatAdministratorCustomTitle(chatId int, userId int, customTitle string) *sendableSetChatAdministratorCustomTitle

note: set all as true for promotion by default

func (Bot) NewSendableSetChatPermissions

func (b Bot) NewSendableSetChatPermissions(chatId int, perms ChatPermissions) *sendableSetChatPermissions

note: set all as true for promotion by default

func (Bot) NewSendableSetChatPhoto

func (b Bot) NewSendableSetChatPhoto(chatId int) *sendableSetChatPhoto

func (Bot) NewSendableSetGameScore

func (b Bot) NewSendableSetGameScore(userId int, score int, chatId int, messageId int) *sendableSetGameScore

func (Bot) NewSendableSetGameScoreInline

func (b Bot) NewSendableSetGameScoreInline(userId int, score int, inlineMessageId string) *sendableSetGameScore

func (Bot) NewSendableSetStickerSetThumb

func (b Bot) NewSendableSetStickerSetThumb(userId int) *sendableSetStickerSetThumb

func (Bot) NewSendableSticker

func (b Bot) NewSendableSticker(chatId int) *sendableSticker

func (Bot) NewSendableStopMessageLiveLocation

func (b Bot) NewSendableStopMessageLiveLocation(chatId int) *sendableStopMessageLiveLocation

func (Bot) NewSendableUploadStickerFile

func (b Bot) NewSendableUploadStickerFile(userId int) *sendableUploadStickerFile

func (Bot) NewSendableVenue

func (b Bot) NewSendableVenue(chatId int) *sendableVenue

NewSendableVenue creates a new venue struct to send

func (Bot) NewSendableVideo

func (b Bot) NewSendableVideo(chatId int, caption string) *sendableVideo

NewSendableVideo creates a new video struct to send

func (Bot) NewSendableVideoNote

func (b Bot) NewSendableVideoNote(chatId int) *sendableVideoNote

NewSendableVideoNote creates a new videonote struct to send

func (Bot) NewSendableVoice

func (b Bot) NewSendableVoice(chatId int, caption string) *sendableVoice

NewSendableVoice creates a new voice struct to send

func (Bot) ParseMessage

func (b Bot) ParseMessage(message json.RawMessage) (mess *Message, err error)

func (Bot) PinChatMessage

func (b Bot) PinChatMessage(chatId int, messageId int) (bool, error)

func (Bot) PinChatMessageQuiet

func (b Bot) PinChatMessageQuiet(chatId int, messageId int) (bool, error)

func (Bot) Post

func (b Bot) Post(method string, params url.Values, data map[string]PostFile) (json.RawMessage, error)

Post -> convenience function to execute commands against the TG API. the "data" map is used to fill out the multipart form data to send to TG.

func (Bot) PromoteChatMember

func (b Bot) PromoteChatMember(chatId int, userId int) (bool, error)

func (Bot) ReplyAudio

func (b Bot) ReplyAudio(chatId int, audio InputFile, replyToMessageId int) (*Message, error)

func (Bot) ReplyContact

func (b Bot) ReplyContact(chatId int, phoneNumber string, firstName string, replyToMessageId int) (*Message, error)

func (Bot) ReplyDocument

func (b Bot) ReplyDocument(chatId int, document InputFile, replyToMessageId int) (*Message, error)

func (Bot) ReplyDocumentCaption

func (b Bot) ReplyDocumentCaption(chatId int, document InputFile, caption string, replyToMessageId int) (*Message, error)

func (Bot) ReplyHTML

func (b Bot) ReplyHTML(chatId int, text string, replyToMessageId int) (*Message, error)

func (Bot) ReplyLocation

func (b Bot) ReplyLocation(chatId int, latitude float64, longitude float64, replyToMessageId int) (*Message, error)

func (Bot) ReplyMarkdown

func (b Bot) ReplyMarkdown(chatId int, text string, replyToMessageId int) (*Message, error)

func (Bot) ReplyMarkdownV2

func (b Bot) ReplyMarkdownV2(chatId int, text string, replyToMessageId int) (*Message, error)

func (Bot) ReplyPhoto

func (b Bot) ReplyPhoto(chatId int, photo InputFile, replyToMessageId int) (*Message, error)

func (Bot) ReplyPhotoCaption

func (b Bot) ReplyPhotoCaption(chatId int, photo InputFile, caption string, replyToMessageId int) (*Message, error)

func (Bot) ReplyPoll

func (b Bot) ReplyPoll(chatId int, question string, options []string, replyToMessageId int) (*Message, error)

func (Bot) ReplySticker

func (b Bot) ReplySticker(chatId int, s InputFile, replyToMessageId int) (*Message, error)

func (Bot) ReplyText

func (b Bot) ReplyText(chatId int, text string, replyToMessageId int) (*Message, error)

func (Bot) ReplyVenue

func (b Bot) ReplyVenue(chatId int, latitude float64, longitude float64, title string, address string, replyToMessageId int) (*Message, error)

func (Bot) ReplyVideo

func (b Bot) ReplyVideo(chatId int, video InputFile, replyToMessageId int) (*Message, error)

func (Bot) ReplyVideoNote

func (b Bot) ReplyVideoNote(chatId int, videoNote InputFile, replyToMessageId int) (*Message, error)

func (Bot) ReplyVoice

func (b Bot) ReplyVoice(chatId int, voice InputFile, replyToMessageId int) (*Message, error)

func (Bot) RestrictChatMember

func (b Bot) RestrictChatMember(chatId int, userId int) (bool, error)

func (Bot) SendAudio

func (b Bot) SendAudio(chatId int, audio InputFile) (*Message, error)

func (Bot) SendChatAction

func (b Bot) SendChatAction(chatId int, action string) (bool, error)

func (Bot) SendContact

func (b Bot) SendContact(chatId int, phoneNumber string, firstName string) (*Message, error)

func (Bot) SendDocument

func (b Bot) SendDocument(chatId int, document InputFile) (*Message, error)

func (Bot) SendDocumentCaption

func (b Bot) SendDocumentCaption(chatId int, document InputFile, caption string) (*Message, error)

func (Bot) SendGame

func (b Bot) SendGame(chatId int, gameShortName string) (*Message, error)

func (Bot) SendInvoice

func (b Bot) SendInvoice(chatId int, title string, description string, payload string,
	providerToken string, startParameter string, currency string,
	prices []LabeledPrice) (*Message, error)

func (Bot) SendLocation

func (b Bot) SendLocation(chatId int, latitude float64, longitude float64) (*Message, error)

func (Bot) SendMessage

func (b Bot) SendMessage(chatId int, text string) (*Message, error)

func (Bot) SendMessageHTML

func (b Bot) SendMessageHTML(chatId int, text string) (*Message, error)

func (Bot) SendMessageMarkdown

func (b Bot) SendMessageMarkdown(chatId int, text string) (*Message, error)

func (Bot) SendMessageMarkdownV2

func (b Bot) SendMessageMarkdownV2(chatId int, text string) (*Message, error)

func (Bot) SendPhoto

func (b Bot) SendPhoto(chatId int, photo InputFile) (*Message, error)

func (Bot) SendPhotoCaption

func (b Bot) SendPhotoCaption(chatId int, photo InputFile, caption string) (*Message, error)

func (Bot) SendPoll

func (b Bot) SendPoll(chatId int, question string, options []string) (*Message, error)

func (Bot) SendSticker

func (b Bot) SendSticker(chatId int, s InputFile) (*Message, error)

func (Bot) SendVenue

func (b Bot) SendVenue(chatId int, latitude float64, longitude float64, title string, address string) (*Message, error)

func (Bot) SendVideo

func (b Bot) SendVideo(chatId int, video InputFile) (*Message, error)

func (Bot) SendVideoNote

func (b Bot) SendVideoNote(chatId int, videoNote InputFile) (*Message, error)

func (Bot) SendVoice

func (b Bot) SendVoice(chatId int, voice InputFile) (*Message, error)

func (Bot) SetChatAdministratorCustomTitle

func (b Bot) SetChatAdministratorCustomTitle(chatId int, userId int, customTitle string) (bool, error)

func (Bot) SetChatDescription

func (b Bot) SetChatDescription(chatId int, description string) (bool, error)

func (Bot) SetChatPermissions

func (b Bot) SetChatPermissions(chatId int, perms ChatPermissions) (bool, error)

func (Bot) SetChatPhoto

func (b Bot) SetChatPhoto(chatId int, photo InputFile) (bool, error)

func (Bot) SetChatStickerSet

func (b Bot) SetChatStickerSet(chatId int, stickerSetName string) (bool, error)

func (Bot) SetChatTitle

func (b Bot) SetChatTitle(chatId int, title string) (bool, error)

func (Bot) SetGameScore

func (b Bot) SetGameScore(userId int, score int, chatId int, messageId int) (bool, error)

func (Bot) SetGameScoreInline

func (b Bot) SetGameScoreInline(userId int, score int, inlineMessageId string) (bool, error)

func (Bot) SetMyCommands

func (b Bot) SetMyCommands(cmds []BotCommand) (bool, error)

SetMyCommands gets the list of bot commands assigned to the bot.

func (Bot) SetPassportDataErrors

func (b Bot) SetPassportDataErrors(userId int, errors ...PassportElementError)

func (Bot) SetStickerPositionInSet

func (b Bot) SetStickerPositionInSet(sticker string, position int) (bool, error)

func (Bot) SetWebhook

func (b Bot) SetWebhook(path string, webhook Webhook) (bool, error)

SetWebhook Set the webhook url for telegram to contact with updates

func (Bot) StopPoll

func (b Bot) StopPoll(chatId int, messageId int) (*Poll, error)

func (Bot) StopPollMarkup

func (b Bot) StopPollMarkup(chatId int, messageId int, replyMarkup InlineKeyboardMarkup) (*Poll, error)

func (Bot) UnRestrictChatMember

func (b Bot) UnRestrictChatMember(chatId int, userId int) (bool, error)

func (Bot) UnbanChatMember

func (b Bot) UnbanChatMember(chatId int, userId int) (bool, error)

func (Bot) UnbanChatMemberOnlyIfBanned

func (b Bot) UnbanChatMemberOnlyIfBanned(chatId int, userId int, onlyIfBanned bool) (bool, error)

func (Bot) UnpinAllChatMessages

func (b Bot) UnpinAllChatMessages(chatId int) (bool, error)

func (Bot) UnpinChatMessage

func (b Bot) UnpinChatMessage(chatId int) (bool, error)

func (Bot) UnpinChatMessageById

func (b Bot) UnpinChatMessageById(chatId int, messageId int) (bool, error)

func (Bot) UploadSticker

func (b Bot) UploadSticker(userId int, s InputFile) (*File, error)

type BotCommand

type BotCommand struct {
	Command     string `json:"command"`
	Description string `json:"description"`
}

type CallbackQuery

type CallbackQuery struct {
	Bot             Bot      `json:"-"`
	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"`
}

func (*CallbackQuery) AnswerCallbackQuery

func (cq *CallbackQuery) AnswerCallbackQuery() (bool, error)

func (*CallbackQuery) AnswerCallbackQueryText

func (cq *CallbackQuery) AnswerCallbackQueryText(text string, alert bool) (bool, error)

func (*CallbackQuery) AnswerCallbackQueryURL

func (cq *CallbackQuery) AnswerCallbackQueryURL(url string) (bool, error)

type Chat

type Chat struct {
	Bot              Bot              `json:"-"`
	Id               int              `json:"id"`
	Type             string           `json:"type"`
	Title            string           `json:"title"`
	Username         string           `json:"username"`
	FirstName        string           `json:"first_name"`
	LastName         string           `json:"last_name"`
	Photo            *ChatPhoto       `json:"photo"`
	Bio              string           `json:"bio"`
	Description      string           `json:"description"`
	InviteLink       string           `json:"invite_link"`
	PinnedMessage    *Message         `json:"pinned_message"`
	Permissions      *ChatPermissions `json:"permissions"`
	SlowModeDelay    int              `json:"slow_mode_delay"`
	StickerSetName   string           `json:"sticker_set_name"`
	CanSetStickerSet bool             `json:"can_set_sticker_set"`
	LinkedChatId     int              `json:"linked_chat_id"`
	Location         ChatLocation     `json:"location"`
}

func (Chat) DeleteMessage

func (chat Chat) DeleteMessage(messageId int) (bool, error)

func (Chat) DeletePhoto

func (chat Chat) DeletePhoto() (bool, error)

func (Chat) DeleteStickerSet

func (chat Chat) DeleteStickerSet() (bool, error)

func (Chat) DemoteMember

func (chat Chat) DemoteMember(userId int) (bool, error)
func (chat Chat) ExportInviteLink() (string, error)

func (Chat) Get

func (chat Chat) Get() (*Chat, error)

func (Chat) GetAdministrators

func (chat Chat) GetAdministrators() ([]ChatMember, error)

func (Chat) GetMember

func (chat Chat) GetMember(userId int) (*ChatMember, error)

func (Chat) GetMembersCount

func (chat Chat) GetMembersCount() (int, error)

func (Chat) KickMember

func (chat Chat) KickMember(userId int) (bool, error)

func (Chat) Leave

func (chat Chat) Leave() (bool, error)

func (Chat) PinMessage

func (chat Chat) PinMessage(messageId int) (bool, error)

func (Chat) PinMessageQuiet

func (chat Chat) PinMessageQuiet(messageId int) (bool, error)

func (Chat) PromoteMember

func (chat Chat) PromoteMember(userId int) (bool, error)

func (Chat) RestrictMember

func (chat Chat) RestrictMember(userId int) (bool, error)

func (Chat) SendAction

func (chat Chat) SendAction(action string) (bool, error)

func (Chat) SetAdministratorCustomTitle

func (chat Chat) SetAdministratorCustomTitle(userId int, customTitle string) (bool, error)

func (Chat) SetChatPermissions

func (chat Chat) SetChatPermissions(perms ChatPermissions) (bool, error)

func (Chat) SetChatPhoto

func (chat Chat) SetChatPhoto(photo InputFile) (bool, error)

func (Chat) SetDescription

func (chat Chat) SetDescription(description string) (bool, error)

func (Chat) SetStickerSet

func (chat Chat) SetStickerSet(stickerSetName string) (bool, error)

func (Chat) SetTitle

func (chat Chat) SetTitle(title string) (bool, error)

func (Chat) UnRestrictMember

func (chat Chat) UnRestrictMember(userId int) (bool, error)

func (Chat) UnbanMember

func (chat Chat) UnbanMember(userId int) (bool, error)

func (Chat) UnpinAll

func (chat Chat) UnpinAll() (bool, error)

func (Chat) UnpinMessage

func (chat Chat) UnpinMessage() (bool, error)

func (Chat) UnpinMessageById

func (chat Chat) UnpinMessageById(messageId int) (bool, error)

type ChatLocation

type ChatLocation struct {
	Location Location `json:"location"`
	Address  string   `json:"address"`
}

type ChatMember

type ChatMember struct {
	User                  *User  `json:"user"`
	Status                string `json:"status"`
	CustomTitle           string `json:"custom_title"`
	IsAnonymous           bool   `json:"is_anonymous"`
	CanBeEdited           bool   `json:"can_be_edited"`
	CanPostMessages       bool   `json:"can_post_messages"`
	CanEditMessages       bool   `json:"can_edit_messages"`
	CanDeleteMessages     bool   `json:"can_delete_messages"`
	CanRestrictMembers    bool   `json:"can_restrict_members"`
	CanPromoteMembers     bool   `json:"can_promote_members"`
	CanChangeInfo         bool   `json:"can_change_info"`
	CanInviteUsers        bool   `json:"can_invite_users"`
	CanPinMessages        bool   `json:"can_pin_messages"`
	IsMember              bool   `json:"is_member"`
	CanSendMessages       bool   `json:"can_send_messages"`
	CanSendMediaMessages  bool   `json:"can_send_media_messages"`
	CanSendPolls          bool   `json:"can_send_polls"`
	CanSendOtherMessages  bool   `json:"can_send_other_messages"`
	CanAddWebPagePreviews bool   `json:"can_add_web_page_previews"`
	UntilDate             int64  `json:"until_date"`
}

type ChatPermissions

type ChatPermissions struct {
	CanSendMessages       *bool `json:"can_send_messages,omitempty"`
	CanSendMediaMessages  *bool `json:"can_send_media_messages,omitempty"`
	CanSendPolls          *bool `json:"can_send_polls,omitempty"`
	CanSendOtherMessages  *bool `json:"can_send_other_messages,omitempty"`
	CanAddWebPagePreviews *bool `json:"can_add_web_page_previews,omitempty"`
	CanChangeInfo         *bool `json:"can_change_info,omitempty"`
	CanInviteUsers        *bool `json:"can_invite_users,omitempty"`
	CanPinMessages        *bool `json:"can_pin_messages,omitempty"`
}

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

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

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

type Dice

type Dice struct {
	Bot   Bot    `json:"-"`
	Emoji string `json:"emoji"`
	Value int    `json:"value"`
}

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

type EncryptedCredentials

type EncryptedCredentials struct {
	Data   string `json:"data"`
	Hash   string `json:"hash"`
	Secret string `json:"secret"`
}

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"`
	Translation []PassportFile `json:"translation"`
	Hash        string         `json:"hash"`
}

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"`
	// contains filtered or unexported fields
}

type ForceReply

type ForceReply struct {
	ForceReply bool `json:"force_reply"`
	Selective  bool `json:"selective"`
}

func (*ForceReply) Marshal

func (fr *ForceReply) Marshal() ([]byte, error)

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

type GameHighScore

type GameHighScore struct {
	Position int  `json:"position"`
	User     User `json:"user"`
	Score    int  `json:"score"`
}

type InlineKeyboardButton

type InlineKeyboardButton struct {
	Text                         string    `json:"text"`
	Url                          string    `json:"url"`
	LoginUrl                     *LoginUrl `json:"login_url"`
	CallbackData                 string    `json:"callback_data"`
	SwitchInlineQuery            string    `json:"switch_inline_query"`
	SwitchInlineQueryCurrentChat string    `json:"switch_inline_query_current_chat"`
	// Callback_game                    *CallbackGame
	Pay bool `json:"pay"`
}

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	InlineKeyboard *[][]InlineKeyboardButton `json:"inline_keyboard"`
}

func (*InlineKeyboardMarkup) Marshal

func (rkm *InlineKeyboardMarkup) Marshal() ([]byte, error)

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

type InlineQueryResult

type InlineQueryResult struct{}

type InlineQueryResultArticle

type InlineQueryResultArticle struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	Title               string                `json:"title"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	Url                 string                `json:"url"`
	HideUrl             bool                  `json:"hide_url"`
	Description         string                `json:"description"`
	ThumbUrl            string                `json:"thumb_url"`
	ThumbWidth          int                   `json:"thumb_width"`
	ThumbHeight         int                   `json:"thumb_height"`
}

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	AudioUrl            string                `json:"audio_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption"`
	Performer           string                `json:"performer"`
	AudioDuration       int                   `json:"audio_duration"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultCachedAudio

type InlineQueryResultCachedAudio struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	AudioFileId         string                `json:"audio_file_id"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultCachedDocument

type InlineQueryResultCachedDocument struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	Title               string                `json:"title"`
	DocumentFileId      string                `json:"document_file_id"`
	Description         string                `json:"description"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultCachedGif

type InlineQueryResultCachedGif struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	GifFileId           string                `json:"gif_file_id"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultCachedMpeg4Gif

type InlineQueryResultCachedMpeg4Gif struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	Mpeg4FileId         string                `json:"mpeg4_file_id"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultCachedPhoto

type InlineQueryResultCachedPhoto struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	PhotoFileId         string                `json:"photo_file_id"`
	Title               string                `json:"title"`
	Description         string                `json:"description"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultCachedSticker

type InlineQueryResultCachedSticker struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	StickerFileId       string                `json:"sticker_file_id"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultCachedVideo

type InlineQueryResultCachedVideo struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	VideoFileId         string                `json:"video_file_id"`
	Title               string                `json:"title"`
	Description         string                `json:"description"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultCachedVoice

type InlineQueryResultCachedVoice struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	VoiceFileId         string                `json:"voice_file_id"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultContact

type InlineQueryResultContact struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	PhoneNumber         string                `json:"phone_number"`
	FirstName           string                `json:"first_name"`
	LastName            string                `json:"last_name"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
	ThumbUrl            string                `json:"thumb_url"`
	ThumbWidth          int                   `json:"thumb_width"`
	ThumbHeight         int                   `json:"thumb_height"`
}

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption"`
	DocumentUrl         string                `json:"document_url"`
	MimeType            string                `json:"mime_type"`
	Description         string                `json:"description"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
	ThumbUrl            string                `json:"thumb_url"`
	ThumbWidth          int                   `json:"thumb_width"`
	ThumbHeight         int                   `json:"thumb_height"`
}

type InlineQueryResultGame

type InlineQueryResultGame struct {
	InlineQueryResult
	Type          string                `json:"type"`
	Id            string                `json:"id"`
	GameShortName string                `json:"game_short_name"`
	ReplyMarkup   *InlineKeyboardMarkup `json:"reply_markup"`
}

type InlineQueryResultGif

type InlineQueryResultGif struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	GifUrl              string                `json:"gif_url"`
	GifWidth            int                   `json:"gif_width"`
	GifHeight           int                   `json:"gif_height"`
	GifDuration         int                   `json:"gif_duration"`
	ThumbUrl            string                `json:"thumb_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	InlineQueryResult
	Type                 string                `json:"type"`
	Id                   string                `json:"id"`
	Latitude             float64               `json:"latitude"`
	Longitude            float64               `json:"longitude"`
	Title                string                `json:"title"`
	HorizontalAccuracy   float64               `json:"horizontal_accuracy"`
	LivePeriod           int                   `json:"live_period"`
	Heading              int                   `json:"heading"`
	ProximityAlertRadius int                   `json:"proximity_alert_radius"`
	ReplyMarkup          *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent  InputMessageContent   `json:"input_message_content"`
	ThumbUrl             string                `json:"thumb_url"`
	ThumbWidth           int                   `json:"thumb_width"`
	ThumbHeight          int                   `json:"thumb_height"`
}

type InlineQueryResultMpeg4Gif

type InlineQueryResultMpeg4Gif struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	Mpeg4Url            string                `json:"mpeg4_url"`
	Mpeg4Width          int                   `json:"mpeg4_width"`
	Mpeg4Height         int                   `json:"mpeg4_height"`
	Mpeg4Duration       int                   `json:"mpeg4_duration"`
	ThumbUrl            string                `json:"thumb_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	PhotoUrl            string                `json:"photo_url"`
	ThumbUrl            string                `json:"thumb_url"`
	PhotoWidth          int                   `json:"photo_width"`
	PhotoHeight         int                   `json:"photo_height"`
	Title               string                `json:"title"`
	Description         string                `json:"description"`
	Caption             string                `json:"caption"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultVenue

type InlineQueryResultVenue struct {
	InlineQueryResult
	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"`
	FoursquareType      string                `json:"foursquare_type"`
	GooglePlaceId       string                `json:"google_place_id"`
	GooglePlaceType     string                `json:"google_place_type"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
	ThumbUrl            string                `json:"thumb_url"`
	ThumbWidth          int                   `json:"thumb_width"`
	ThumbHeight         int                   `json:"thumb_height"`
}

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	InlineQueryResult
	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"`
	VideoWidth          int                   `json:"video_width"`
	VideoHeight         int                   `json:"video_height"`
	VideoDuration       int                   `json:"video_duration"`
	Description         string                `json:"description"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	InlineQueryResult
	Type                string                `json:"type"`
	Id                  string                `json:"id"`
	VoiceUrl            string                `json:"voice_url"`
	Title               string                `json:"title"`
	Caption             string                `json:"caption"`
	VoiceDuration       int                   `json:"voice_duration"`
	ReplyMarkup         *InlineKeyboardMarkup `json:"reply_markup"`
	InputMessageContent InputMessageContent   `json:"input_message_content"`
}

type InputContactMessageContent

type InputContactMessageContent struct {
	InputMessageContent
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
}

type InputFile

type InputFile struct {
	Name   string
	FileId string
	Reader io.Reader
	URL    string
	// contains filtered or unexported fields
}

func (InputFile) GetMediaType

func (f InputFile) GetMediaType(attachAs string, data map[string]PostFile) string

type InputLocationMessageContent

type InputLocationMessageContent struct {
	InputMessageContent
	Latitude             float64 `json:"latitude"`
	Longitude            float64 `json:"longitude"`
	HorizontalAccuracy   float64 `json:"horizontal_accuracy"`
	LivePeriod           int     `json:"live_period"`
	Heading              int     `json:"heading"`
	ProximityAlertRadius int     `json:"proximity_alert_radius"`
}

type InputMedia

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

type InputMediaAnimation

type InputMediaAnimation struct {
	Media           InputFile
	Thumb           *InputFile
	Caption         string
	ParseMode       string
	CaptionEntities []MessageEntity
	Width           int
	Height          int
	Duration        int
}

type InputMediaAudio

type InputMediaAudio struct {
	Media           InputFile
	Thumb           *InputFile
	Caption         string
	ParseMode       string
	CaptionEntities []MessageEntity
	Duration        int
	Performer       string
	Title           string
}

type InputMediaDocument

type InputMediaDocument struct {
	Media                       InputFile
	Thumb                       *InputFile
	Caption                     string
	ParseMode                   string
	CaptionEntities             []MessageEntity
	DisableContentTypeDetection bool
}

type InputMediaPhoto

type InputMediaPhoto struct {
	Media           InputFile
	Caption         string
	ParseMode       string
	CaptionEntities []MessageEntity
}

type InputMediaVideo

type InputMediaVideo struct {
	Media            InputFile
	Thumb            *InputFile
	Caption          string
	ParseMode        string
	CaptionEntities  []MessageEntity
	Width            int
	Height           int
	Duration         int
	SupportStreaming bool
}

type InputMessageContent

type InputMessageContent struct{}

type InputTextMessageContent

type InputTextMessageContent struct {
	InputMessageContent
	MessageText           string `json:"message_text"`
	ParseMode             string `json:"parse_mode"`
	DisableWebPagePreview bool   `json:"disable_web_page_preview"`
}

type InputVenueMessageContent

type InputVenueMessageContent struct {
	InputMessageContent
	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"`
	GooglePlaceId   string  `json:"google_place_id"`
	GooglePlaceType string  `json:"google_place_type"`
}

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

type KeyboardButton

type KeyboardButton struct {
	Text            string                  `json:"text"`
	RequestContact  bool                    `json:"request_contact"`
	RequestLocation bool                    `json:"request_location"`
	RequestPoll     *KeyboardButtonPollType `json:"request_poll"`
}

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	Type []string `json:"type"`
}

type LabeledPrice

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

type Location

type Location struct {
	Longitude            float64 `json:"longitude"`
	Latitude             float64 `json:"latitude"`
	HorizontalAccuracy   float64 `json:"horizontal_accuracy"`
	LivePeriod           int     `json:"live_period"`
	Heading              int     `json:"heading"`
	ProximityAlertRadius int     `json:"proximity_alert_radius"`
}

type LoginUrl

type LoginUrl struct {
	Url                string `json:"url"`
	ForwardText        string `json:"forward_text"`
	BotUsername        string `json:"bot_username"`
	RequestWriteAccess bool   `json:"request_write_access"`
}

type MaskPosition

type MaskPosition struct {
	Point  string  `json:"point"`
	XShift float64 `json:"x_shift"`
	YShift float64 `json:"y_shift"`
	Scale  float64 `json:"scale"`
}

type Message

type Message struct {
	Bot                     Bot                      `json:"-"`
	MessageId               int                      `json:"message_id"`
	From                    *User                    `json:"from"`
	SenderChat              *Chat                    `json:"sender_chat"`
	Date                    int                      `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             int                      `json:"forward_date"`
	ReplyToMessage          *Message                 `json:"reply_to_message"`
	ViaBot                  *User                    `json:"via_bot"`
	EditDate                int                      `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"`
	Animation               *Animation               `json:"animation"`
	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"`
	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered"`
	ReplyMarkup             *InlineKeyboardMarkup    `json:"reply_markup"`
	// contains filtered or unexported fields
}

func (Message) Delete

func (m Message) Delete() (bool, error)

func (Message) EditCaption

func (m Message) EditCaption(text string) (*Message, error)

func (Message) EditCaptionHTML

func (m Message) EditCaptionHTML(text string) (*Message, error)

func (Message) EditCaptionHTMLf

func (m Message) EditCaptionHTMLf(format string, a ...interface{}) (*Message, error)

func (Message) EditCaptionMarkdown

func (m Message) EditCaptionMarkdown(text string) (*Message, error)

func (Message) EditCaptionMarkdownf

func (m Message) EditCaptionMarkdownf(format string, a ...interface{}) (*Message, error)

func (Message) EditCaptionf

func (m Message) EditCaptionf(format string, a ...interface{}) (*Message, error)

func (Message) EditHTML

func (m Message) EditHTML(text string) (*Message, error)

func (Message) EditHTMLf

func (m Message) EditHTMLf(format string, a ...interface{}) (*Message, error)

func (Message) EditMarkdown

func (m Message) EditMarkdown(text string) (*Message, error)

func (Message) EditMarkdownf

func (m Message) EditMarkdownf(format string, a ...interface{}) (*Message, error)

func (Message) EditText

func (m Message) EditText(text string) (*Message, error)

func (Message) EditTextf

func (m Message) EditTextf(format string, a ...interface{}) (*Message, error)

func (Message) Forward

func (m Message) Forward(chatId int) (*Message, error)

func (*Message) OriginalCaption

func (m *Message) OriginalCaption() string

func (*Message) OriginalCaptionHTML

func (m *Message) OriginalCaptionHTML() string

func (*Message) OriginalCaptionV2

func (m *Message) OriginalCaptionV2() string

func (*Message) OriginalHTML

func (m *Message) OriginalHTML() string

func (*Message) OriginalText

func (m *Message) OriginalText() string

func (*Message) OriginalTextV2

func (m *Message) OriginalTextV2() string

func (*Message) ParseCaptionEntities

func (m *Message) ParseCaptionEntities() (out []ParsedMessageEntity)

func (*Message) ParseCaptionEntity

func (m *Message) ParseCaptionEntity(entity MessageEntity) ParsedMessageEntity

func (*Message) ParseCaptionEntityTypes

func (m *Message) ParseCaptionEntityTypes(accepted map[string]struct{}) (out []ParsedMessageEntity)

func (*Message) ParseEntities

func (m *Message) ParseEntities() (out []ParsedMessageEntity)

func (*Message) ParseEntity

func (m *Message) ParseEntity(entity MessageEntity) ParsedMessageEntity

func (*Message) ParseEntityTypes

func (m *Message) ParseEntityTypes(accepted map[string]struct{}) (out []ParsedMessageEntity)

func (Message) ReplyAudio

func (m Message) ReplyAudio(audio InputFile) (*Message, error)

func (Message) ReplyDocument

func (m Message) ReplyDocument(document InputFile) (*Message, error)

func (Message) ReplyHTML

func (m Message) ReplyHTML(text string) (*Message, error)

func (Message) ReplyHTMLf

func (m Message) ReplyHTMLf(format string, a ...interface{}) (*Message, error)

func (Message) ReplyLocation

func (m Message) ReplyLocation(latitude float64, longitude float64) (*Message, error)

func (Message) ReplyMarkdown

func (m Message) ReplyMarkdown(text string) (*Message, error)

func (Message) ReplyMarkdownf

func (m Message) ReplyMarkdownf(format string, a ...interface{}) (*Message, error)

func (Message) ReplyPhoto

func (m Message) ReplyPhoto(photo InputFile) (*Message, error)

func (Message) ReplySticker

func (m Message) ReplySticker(sticker InputFile) (*Message, error)

func (Message) ReplyText

func (m Message) ReplyText(text string) (*Message, error)

func (Message) ReplyTextf

func (m Message) ReplyTextf(format string, a ...interface{}) (*Message, error)

func (Message) ReplyVenue

func (m Message) ReplyVenue(latitude float64, longitude float64, title string, address string) (*Message, error)

func (Message) ReplyVideo

func (m Message) ReplyVideo(video InputFile) (*Message, error)

func (Message) ReplyVideoNote

func (m Message) ReplyVideoNote(videoNote InputFile) (*Message, error)

func (Message) ReplyVoice

func (m Message) ReplyVoice(voice InputFile) (*Message, error)

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

type OrderInfo

type OrderInfo struct {
	Name            string          `json:"name"`
	PhoneNumber     string          `json:"phone_number"`
	Email           string          `json:"email"`
	ShippingAddress ShippingAddress `json:"shipping_address"`
}

type ParsedMessageEntity

type ParsedMessageEntity struct {
	Type   string `json:"type"`
	Offset int    `json:"offset"`
	Length int    `json:"length"`
	Url    string `json:"url"`
	User   *User  `json:"user"`
	Text   string `json:"text"`
}

type PassportData

type PassportData struct {
	Data        []EncryptedPassportElement `json:"data"`
	Credentials EncryptedCredentials       `json:"credentials"`
}

type PassportElementError

type PassportElementError interface {
	Data() (url.Values, error) // return interface as url values
}

type PassportElementErrorDataField

type PassportElementErrorDataField struct {
	BasePassportError
	FieldName string
	DataHash  string
}

func (PassportElementErrorDataField) Data

type PassportElementErrorFile

type PassportElementErrorFile struct {
	BasePassportError
	FileHash string
}

func (PassportElementErrorFile) Data

type PassportElementErrorFiles

type PassportElementErrorFiles struct {
	BasePassportError
	FileHashes []string
}

func (PassportElementErrorFiles) Data

type PassportElementErrorFrontSide

type PassportElementErrorFrontSide struct {
	BasePassportError
	FileHash string
}

func (PassportElementErrorFrontSide) Data

type PassportElementErrorReverseSide

type PassportElementErrorReverseSide struct {
	BasePassportError
	FileHash string
}

func (PassportElementErrorReverseSide) Data

type PassportElementErrorSelfie

type PassportElementErrorSelfie struct {
	BasePassportError
	FileHash string
}

func (PassportElementErrorSelfie) Data

type PassportElementErrorTranslationFile

type PassportElementErrorTranslationFile struct {
	BasePassportError
	FileHash string
}

func (PassportElementErrorTranslationFile) Data

type PassportElementErrorTranslationFiles

type PassportElementErrorTranslationFiles struct {
	BasePassportError
	FileHashes []string
}

func (PassportElementErrorTranslationFiles) Data

type PassportElementErrorUnspecified

type PassportElementErrorUnspecified struct {
	BasePassportError
	ElementHash string
}

func (PassportElementErrorUnspecified) Data

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

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

type Poll

type Poll struct {
	Bot                   Bot             `json:"-"`
	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"`
	Explanation           string          `json:"explanation"`
	ExplanationEntities   []MessageEntity `json:"explanation_entities"`
	OpenPeriod            int             `json:"open_period"`
	CloseDate             int             `json:"close_date"`
}

type PollAnswer

type PollAnswer struct {
	Bot       Bot    `json:"-"`
	PollId    string `json:"poll_id"`
	User      *User  `json:"user"`
	OptionIds []int  `json:"option_ids"`
}

type PollOption

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

type PostFile

type PostFile struct {
	File     io.Reader
	FileName string
}

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

type ProximityAlertTriggered

type ProximityAlertTriggered struct {
	Traveler User `json:"traveler"`
	Watcher  User `json:"watcher"`
	Distance int  `json:"distance"`
}

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	Keyboard        *[][]KeyboardButton `json:"keyboard"`
	ResizeKeyboard  bool                `json:"resize_keyboard"`
	OneTimeKeyboard bool                `json:"one_time_keyboard"`
	Selective       bool                `json:"selective"`
}

func (*ReplyKeyboardMarkup) Marshal

func (rkm *ReplyKeyboardMarkup) Marshal() ([]byte, error)

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	RemoveKeyboard bool `json:"remove_keyboard"`
	Selective      bool `json:"selective"`
}

func (*ReplyKeyboardRemove) Marshal

func (rkm *ReplyKeyboardRemove) Marshal() ([]byte, error)

type ReplyMarkup

type ReplyMarkup interface {
	Marshal() ([]byte, error)
}

type Requester

type Requester interface {
	Get(l *zap.SugaredLogger, token string, method string, params url.Values) (json.RawMessage, error)
	Post(l *zap.SugaredLogger, token string, method string, params url.Values, data map[string]PostFile) (json.RawMessage, error)
}

type ResponseParameters

type ResponseParameters struct {
	MigrateToChatId int `json:"migrate_to_chat_id"`
	RetryAfter      int `json:"retry_after"`
}

type Sendable

type Sendable interface {
	Send() (*Message, error)
}

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

type ShippingOption

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

type ShippingQuery

type ShippingQuery struct {
	Id              string          `json:"id"`
	From            *User           `json:"from"`
	InvoicePayload  string          `json:"invoice_payload"`
	ShippingAddress ShippingAddress `json:"shipping_address"`
}

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"`
	SetName      string       `json:"set_name"`
	MaskPosition MaskPosition `json:"mask_position"`
	FileSize     int          `json:"file_size"`
}

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

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

type TelegramError

type TelegramError struct {
	Method      string
	Values      url.Values
	Code        int
	Description string
}

func (*TelegramError) Error

func (t *TelegramError) Error() string

type User

type User struct {
	Bot                     Bot    `json:"-"`
	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"`
}

func (User) GetProfilePhotos

func (user User) GetProfilePhotos() (*UserProfilePhotos, error)

GetProfilePhotos Retrieves a user's profile pictures

func (User) GetProfilePhotosOffset

func (user User) GetProfilePhotosOffset(offset int, limit int) (*UserProfilePhotos, error)

GetProfilePhotosOffset Retrieves a user's profile pictures

type UserProfilePhotos

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

type Venue

type Venue struct {
	Location        Location `json:"location"`
	Title           string   `json:"title"`
	Address         string   `json:"address"`
	FoursquareId    string   `json:"foursquare_id"`
	FoursquareType  string   `json:"foursquare_type"`
	GooglePlaceId   string   `json:"google_place_id"`
	GooglePlaceType string   `json:"google_place_type"`
}

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"`
	Thumb        *PhotoSize `json:"thumb"`
	FileName     string     `json:"file_name"`
	MimeType     string     `json:"mime_type"`
	FileSize     int        `json:"file_size"`
}

type VideoNote

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

type Voice

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

type Webhook

type Webhook struct {
	Serve     string // base url to where you listen
	ServePath string // path you listen to
	ServePort int    // port you listen on
	URL       string // where you set the webhook to send to
	// CertPath       string   // TODO
	IPAddress          string   // where you set the webhook to send to
	MaxConnections     int      // max connections; max 100, default 40
	AllowedUpdates     []string // which updates to allow
	DropPendingUpdates bool     // should start from scratch on the new updates
}

func (Webhook) GetListenUrl

func (w Webhook) GetListenUrl() string

type WebhookInfo

type WebhookInfo struct {
	URL                  string   `json:"url"`
	HasCustomCertificate bool     `json:"has_custom_certificate"`
	PendingUpdateCount   int      `json:"pending_update_count"`
	IPAddress            string   `json:"ip_address"`
	LastErrorDate        int      `json:"last_error_date"`
	LastErrorMessage     int      `json:"last_error_message"`
	MaxConnections       int      `json:"max_connections"`
	AllowedUpdates       []string `json:"allowed_updates"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL