Documentation ¶
Index ¶
- Variables
- func OnErrorDefault(c Context, result any, err error) error
- type Animation
- type Audio
- type Ban
- type BaseContext
- type Bot
- func (b *Bot) API() *api.API
- func (b *Bot) Close() error
- func (b *Bot) DeleteCommands(s tg.CommandScope, lang string) error
- func (b *Bot) DeleteWebhook(dropPending bool) (bool, error)
- func (b *Bot) Err() error
- func (b *Bot) GetCommands(s tg.CommandScope, lang string) ([]tg.Command, error)
- func (b *Bot) GetDefaultAdminRights(forChannels bool) (*tg.ChatAdministratorRights, error)
- func (b *Bot) GetDefaultChatMenuButton() (*tg.MenuButton, error)
- func (b *Bot) GetDescription(lang string) (*tg.BotDescription, error)
- func (b *Bot) GetMe() (*tg.User, error)
- func (b *Bot) GetName(lang string) (*tg.BotName, error)
- func (b *Bot) GetShortDescription(lang string) (*tg.BotShortDescription, error)
- func (b *Bot) GetUpdates(ctx context.Context, p GetUpdates) ([]tg.Update, error)
- func (b *Bot) GetWebhookInfo() (*tg.WebhookInfo, error)
- func (b *Bot) Handle(upd *tg.Update) error
- func (b *Bot) LogOut() error
- func (b *Bot) MakeContext(name string) Context
- func (b *Bot) Me() tg.User
- func (b *Bot) SetCommands(cd *CommandsData) error
- func (b *Bot) SetDefaultAdminRights(rights *tg.ChatAdministratorRights, forChannels bool) error
- func (b *Bot) SetDefaultChatMenuButton(menu tg.MenuButton) error
- func (b *Bot) SetDescription(description, lang string) error
- func (b *Bot) SetError(err error)
- func (b *Bot) SetName(name, lang string) error
- func (b *Bot) SetShortDescription(shortDescription, lang string) error
- func (b *Bot) SetWebhook(s WebhookData) (bool, error)
- type CallbackAnswer
- type CallbackContext
- type CaptionData
- type Chat
- type ChatContext
- func (c ChatContext) ApproveJoinRequest(userID int64) error
- func (c ChatContext) Ban(b Ban) error
- func (c ChatContext) BanSenderChat(senderID int64) error
- func (c ChatContext) Child(name string) ChatContext
- func (c ChatContext) CloseForumTopic(threadID int) error
- func (c ChatContext) CloseGeneralForumTopic() error
- func (c ChatContext) Copy(from Chat, cp Copy, opts ...SendOptions) (*tg.MessageID, error)
- func (c ChatContext) CreateForumTopic(name string, iconColor int, iconEmojiID string) (*tg.ForumTopic, error)
- func (c ChatContext) CreateInviteLink(i InviteLink) (*tg.ChatInviteLink, error)
- func (c ChatContext) DeclineJoinRequest(userID int64) error
- func (c ChatContext) DeleteForumTopic(threadID int) error
- func (c ChatContext) DeleteMessage(msgID int) error
- func (c ChatContext) DeletePhoto() error
- func (c ChatContext) DeleteStickerSet() error
- func (c ChatContext) EditForumTopic(threadID int, name, iconEmojiID string) error
- func (c ChatContext) EditGeneralForumTopic(name string) error
- func (c ChatContext) EditInviteLink(link string, i InviteLink) (*tg.ChatInviteLink, error)
- func (c ChatContext) ExportInviteLink() (string, error)
- func (c ChatContext) Forward(from Chat, fwd Forward) (*tg.Message, error)
- func (c ChatContext) GetAdmins() ([]tg.ChatMember, error)
- func (c ChatContext) GetInfo() (*tg.Chat, error)
- func (c ChatContext) GetMember(userID int64) (*tg.ChatMember, error)
- func (c ChatContext) GetMenuButton() (*tg.MenuButton, error)
- func (c ChatContext) HideGeneralForumTopic() error
- func (c ChatContext) Leave() error
- func (c ChatContext) MemberCount() (int, error)
- func (c ChatContext) OpenForumTopic(threadID int) Topic
- func (c ChatContext) PinMessage(msgID int, notify bool) error
- func (c ChatContext) Promote(userID int64, rights tg.ChatAdministratorRights) error
- func (c ChatContext) ReopenForumTopic(threadID int) error
- func (c ChatContext) ReopenGeneralForumTopic() error
- func (c ChatContext) Reply(to int, s Sendable) (*tg.Message, error)
- func (c ChatContext) ReplyE(to int, s Sendable) error
- func (c ChatContext) Restrict(r RestrictChatMember) error
- func (c ChatContext) RevokeInviteLink(link string) (*tg.ChatInviteLink, error)
- func (c ChatContext) Send(s Sendable, opts ...SendOptions) (*tg.Message, error)
- func (c ChatContext) SendChatAction(act tg.ChatAction) error
- func (c ChatContext) SendE(s Sendable, opts ...SendOptions) error
- func (c ChatContext) SendMediaGroup(mg MediaGroup, opts ...SendOptions) ([]tg.Message, error)
- func (c ChatContext) SendText(text string, pm ...tg.ParseMode) error
- func (c ChatContext) SetAdminTitle(userID int64, title string) error
- func (c ChatContext) SetDescription(description string) error
- func (c ChatContext) SetMenuButton(menu tg.MenuButton) error
- func (c ChatContext) SetPermissions(perms tg.ChatPermissions, independentPerms ...bool) error
- func (c ChatContext) SetPhoto(photo *tg.InputFile) error
- func (c ChatContext) SetStickerSet(stickerSet string) error
- func (c ChatContext) SetTitle(title string) error
- func (c ChatContext) StopPoll(msgID int, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Poll, error)
- func (c ChatContext) Unban(userID int64, onlyIfBanned bool) error
- func (c ChatContext) UnbanSenderChat(senderID int64) error
- func (c ChatContext) UnhideGeneralForumTopic() error
- func (c ChatContext) UnpinAllMessages() error
- func (c ChatContext) UnpinMessage(msgID int) error
- type CommandsData
- type Contact
- type Context
- func (c Context) AddSticker(sticker NewSticker) error
- func (c Context) Child(name string) Context
- func (c Context) CreateInvoiceLink(l CreateInvoiceLink) (string, error)
- func (c Context) CreateNewStickerSet(newSet NewStickerSet) error
- func (c Context) Ctx() Context
- func (c Context) DeleteSticker(stickerFileID string) error
- func (c Context) DeleteStickerSet(setName string) error
- func (c Context) Download(f *tg.File) ([]byte, error)
- func (c Context) DownloadFile(fid string) ([]byte, error)
- func (c Context) DownloadReader(f *tg.File) (io.ReadCloser, error)
- func (c Context) DownloadReaderFile(fid string) (io.ReadCloser, error)
- func (c Context) GetCustomEmojiStickers(ids ...string) ([]tg.Sticker, error)
- func (c Context) GetFile(fileID string) (*tg.File, error)
- func (c Context) GetForumTopicIconStickers() ([]tg.Sticker, error)
- func (c Context) GetMe() (*tg.User, error)
- func (c Context) GetStickerSet(name string) (*tg.StickerSet, error)
- func (c Context) GetUserPhotos(userID int64) (*tg.UserProfilePhotos, error)
- func (c Context) Name() string
- func (c Context) OpenChat(chatID Chat) ChatContext
- func (c Context) OpenMessage(sig MsgSignature) MessageContext
- func (c Context) SetCustomEmojiStickerSetThumbnail(setName string, customEmojiID string) error
- func (c Context) SetStickerEmojiList(stickerFileID string, emojiList []string) error
- func (c Context) SetStickerKeywords(stickerFileID string, keywords []string) error
- func (c Context) SetStickerMaskPosition(stickerFileID string, maskPos tg.MaskPosition) error
- func (c Context) SetStickerPosition(stickerFileID string, position int) error
- func (c Context) SetStickerSetThumbnail(setName string, userID int64, thumb tg.Inputtable) error
- func (c Context) SetStickerSetTitle(setName string, title string) error
- func (c Context) UploadStickerFile(userID int64, sticker *tg.InputFile, format tg.StickerFormat) (*tg.File, error)
- type Copy
- type CreateInvoiceLink
- type Dice
- type Document
- type EditText
- type Forward
- type Game
- type GetUpdates
- type Handler
- type InlineAnswer
- type InlineContext
- type InviteLink
- type Invoice
- type LiveLocation
- type Location
- type MediaGroup
- type Message
- type MessageContext
- func (c MessageContext) EditCaption(cap CaptionData, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
- func (c MessageContext) EditLiveLocation(l LiveLocation, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
- func (c MessageContext) EditMedia(m tg.MediaInputter, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
- func (c MessageContext) EditReplyMarkup(replyMarkup *tg.InlineKeyboardMarkup) (*tg.Message, error)
- func (c MessageContext) EditText(t EditText, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
- func (c MessageContext) GetGameHighScores(userID int64) ([]tg.GameHighScore, error)
- func (c MessageContext) SetGameScore(userID int64, s SetGameScore) (*tg.Message, error)
- func (c MessageContext) StopLiveLocation(replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
- type MsgSignature
- type NewSticker
- type NewStickerSet
- type Photo
- type Poll
- type PreCheckoutAnswer
- type PreCheckoutContext
- type QueryContext
- type RestrictChatMember
- type SendOptions
- type Sendable
- type SetGameScore
- type ShippingAnswer
- type ShippingContext
- type Sticker
- type Topic
- func (t Topic) Copy(from Chat, cp Copy, opts ...SendOptions) (*tg.MessageID, error)
- func (t Topic) Forward(from Chat, fwd Forward) (*tg.Message, error)
- func (t Topic) Send(s Sendable, opts ...SendOptions) (*tg.Message, error)
- func (t Topic) SendChatAction(act tg.ChatAction) error
- func (t Topic) SendMediaGroup(mg MediaGroup, opts ...SendOptions) ([]tg.Message, error)
- func (t Topic) UnpinAllMessages() error
- type Venue
- type Video
- type VideoNote
- type Voice
- type WebAppAnswer
- type WebAppContext
- type WebhookData
Constants ¶
This section is empty.
Variables ¶
var ErrNotSpecified = errors.New("handler is not specified")
ErrNotSpecified is returned by Handle if the update contains an object not specified in Handler.
Functions ¶
func OnErrorDefault ¶
OnErrorDefault represents default error handler.
It:
- panics if the JSON response cannot be parsed;
- panics if the method is not found;
- cancels the current call (using runtime.Goexit) and changes the state of the bot to an error if 401 (Not Authorized) or or 500 (Internal Server Error) status is returned;
- returns the err in any other case.
Types ¶
type Animation ¶
type Animation struct { Animation tg.Inputtable Thumbnail tg.Inputtable CaptionData Duration int Width int Height int HasSpoiler bool ReplyMarkup tg.ReplyMarkup }
Animation contains information about the animation to be sent.
type Audio ¶
type Audio struct { Audio tg.Inputtable Thumbnail tg.Inputtable CaptionData Duration int Performer string Title string ReplyMarkup tg.ReplyMarkup }
Audio contains information about the audio to be sent.
type BaseContext ¶
type BaseContext[c baseContext] interface { Child(string) c // contains filtered or unexported methods }
BaseContext can infer any context type.
type Bot ¶
type Bot struct { // OnError is called when an error occurs while method execution with context. // The returned error will be returned to the method caller. // If this function is nil, OnErrorDefault is used. OnError func(c Context, result any, err error) error Handler // contains filtered or unexported fields }
Bot type.
func NewWithToken ¶
NewWithToken creates new bit with specified token and default http client.
func (*Bot) Close ¶
Close method.
Use this method to close the bot instance before moving it from one local server to another.
func (*Bot) DeleteCommands ¶
func (b *Bot) DeleteCommands(s tg.CommandScope, lang string) error
DeleteCommands deletes the list of the bot's commands for the given scope and user language.
func (*Bot) DeleteWebhook ¶
DeleteWebhook removes webhook integration if you decide to switch back to getUpdates.
func (*Bot) GetCommands ¶
GetCommands returns the current list of the bot's commands for the given scope and user language.
func (*Bot) GetDefaultAdminRights ¶
func (b *Bot) GetDefaultAdminRights(forChannels bool) (*tg.ChatAdministratorRights, error)
GetDefaultAdminRights returns the current default administrator rights of the bot.
func (*Bot) GetDefaultChatMenuButton ¶
func (b *Bot) GetDefaultChatMenuButton() (*tg.MenuButton, error)
GetDefaultChatMenuButton returns the current value of the bot's default menu button.
This method is a wrapper for getChatMenuButton without specifying the chat id.
func (*Bot) GetDescription ¶
func (b *Bot) GetDescription(lang string) (*tg.BotDescription, error)
GetDescription returns the current bot description for the given user language.
func (*Bot) GetShortDescription ¶
func (b *Bot) GetShortDescription(lang string) (*tg.BotShortDescription, error)
GetShortDescription returns the current bot short description for the given user language.
func (*Bot) GetUpdates ¶
GetUpdates receives incoming updates using long polling.
func (*Bot) GetWebhookInfo ¶
func (b *Bot) GetWebhookInfo() (*tg.WebhookInfo, error)
GetWebhookInfo returns current webhook status.
func (*Bot) LogOut ¶
LogOut method.
Use this method to log out from the cloud Bot API server before launching the bot locally.
func (*Bot) MakeContext ¶
MakeContext creates new context.
The context must be used in a separate goroutine because in case of fatal errors the bot will be closed and the goroutine will be terminated.
func (*Bot) SetCommands ¶
func (b *Bot) SetCommands(cd *CommandsData) error
SetCommands changes the list of the bot's commands.
func (*Bot) SetDefaultAdminRights ¶
func (b *Bot) SetDefaultAdminRights(rights *tg.ChatAdministratorRights, forChannels bool) error
SetDefaultAdminRights changes the default administrator rights requested by the bot when it's added as an administrator to groups or channels.
func (*Bot) SetDefaultChatMenuButton ¶
func (b *Bot) SetDefaultChatMenuButton(menu tg.MenuButton) error
SetDefaultChatMenuButton changes the bot's default menu button.
This method is a wrapper for setChatMenuButton without specifying the chat id.
func (*Bot) SetDescription ¶
SetDescription changes the bot's description, which is shown in the chat with the bot if the chat is empty.
func (*Bot) SetError ¶
SetError changes the state of the bot to an error. It does nothing if the bot is already in an error state. The error state prevents any updates handling.
func (*Bot) SetShortDescription ¶
SetShortDescription changes the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot.
func (*Bot) SetWebhook ¶
func (b *Bot) SetWebhook(s WebhookData) (bool, error)
SetWebhook specifies a webhook URL. Use this method to specify a URL and receive incoming updates via an outgoing webhook.
type CallbackAnswer ¶
CallbackAnswer represents an answer to callback query.
type CaptionData ¶
type CaptionData struct { Caption string ParseMode tg.ParseMode Entities []tg.MessageEntity }
CaptionData represents caption with entities and parse mode.
type ChatContext ¶
type ChatContext struct { Context // contains filtered or unexported fields }
ChatContext provides chat API.
func (ChatContext) ApproveJoinRequest ¶
func (c ChatContext) ApproveJoinRequest(userID int64) error
ApproveJoinRequest approves a chat join request.
func (ChatContext) Ban ¶
func (c ChatContext) Ban(b Ban) error
Ban bans a user in a group, a supergroup or a channel.
func (ChatContext) BanSenderChat ¶
func (c ChatContext) BanSenderChat(senderID int64) error
BanSenderChat bans a channel chat in a supergroup or a channel.
func (ChatContext) Child ¶
func (c ChatContext) Child(name string) ChatContext
Child creates sub context.
func (ChatContext) CloseForumTopic ¶
func (c ChatContext) CloseForumTopic(threadID int) error
CloseForumTopic closes an open topic in a forum supergroup chat.
func (ChatContext) CloseGeneralForumTopic ¶
func (c ChatContext) CloseGeneralForumTopic() error
CloseGeneralForumTopic closes an open 'General' topic in a forum supergroup chat.
func (ChatContext) Copy ¶
func (c ChatContext) Copy(from Chat, cp Copy, opts ...SendOptions) (*tg.MessageID, error)
Copy copies messages of any kind. Service messages and invoice messages can't be copied.
func (ChatContext) CreateForumTopic ¶
func (c ChatContext) CreateForumTopic(name string, iconColor int, iconEmojiID string) (*tg.ForumTopic, error)
CreateForumTopic creates a topic in a forum supergroup chat.
func (ChatContext) CreateInviteLink ¶
func (c ChatContext) CreateInviteLink(i InviteLink) (*tg.ChatInviteLink, error)
CreateInviteLink creates an additional invite link for a chat.
func (ChatContext) DeclineJoinRequest ¶
func (c ChatContext) DeclineJoinRequest(userID int64) error
DeclineJoinRequest declines a chat join request.
func (ChatContext) DeleteForumTopic ¶
func (c ChatContext) DeleteForumTopic(threadID int) error
DeleteForumTopic deletes a forum topic along with all its messages in a forum supergroup chat.
func (ChatContext) DeleteMessage ¶
func (c ChatContext) DeleteMessage(msgID int) error
DeleteMessage deletes a message, including service messages.
func (ChatContext) DeletePhoto ¶
func (c ChatContext) DeletePhoto() error
DeletePhoto deletes a chat photo.
func (ChatContext) DeleteStickerSet ¶
func (c ChatContext) DeleteStickerSet() error
DeleteStickerSet deletes a group sticker set from a supergroup.
func (ChatContext) EditForumTopic ¶
func (c ChatContext) EditForumTopic(threadID int, name, iconEmojiID string) error
EditForumTopic edits name and icon of a topic in a forum supergroup chat.
func (ChatContext) EditGeneralForumTopic ¶
func (c ChatContext) EditGeneralForumTopic(name string) error
EditGeneralForumTopic edits the name of the 'General' topic in a forum supergroup chat.
func (ChatContext) EditInviteLink ¶
func (c ChatContext) EditInviteLink(link string, i InviteLink) (*tg.ChatInviteLink, error)
EditInviteLink edits a non-primary invite link created by the bot.
func (ChatContext) ExportInviteLink ¶
func (c ChatContext) ExportInviteLink() (string, error)
ExportInviteLink generates a new primary invite link for a chat; any previously generated primary link is revoked.
func (ChatContext) Forward ¶
Forward forwards messages of any kind. Service messages can't be forwarded.
func (ChatContext) GetAdmins ¶
func (c ChatContext) GetAdmins() ([]tg.ChatMember, error)
GetAdmins returns a list of administrators in a chat.
func (ChatContext) GetInfo ¶
func (c ChatContext) GetInfo() (*tg.Chat, error)
GetInfo returns up to date information about the chat.
func (ChatContext) GetMember ¶
func (c ChatContext) GetMember(userID int64) (*tg.ChatMember, error)
GetMember returns information about a member of a chat.
func (ChatContext) GetMenuButton ¶
func (c ChatContext) GetMenuButton() (*tg.MenuButton, error)
GetMenuButton returns the current value of the bot's menu button in a private chat.
func (ChatContext) HideGeneralForumTopic ¶
func (c ChatContext) HideGeneralForumTopic() error
HideGeneralForumTopic hides the 'General' topic in a forum supergroup chat.
func (ChatContext) MemberCount ¶
func (c ChatContext) MemberCount() (int, error)
MemberCount returns the number of members in a chat.
func (ChatContext) OpenForumTopic ¶
func (c ChatContext) OpenForumTopic(threadID int) Topic
OpenForumTopic makes forum topic interface.
func (ChatContext) PinMessage ¶
func (c ChatContext) PinMessage(msgID int, notify bool) error
PinMessage adds a message to the list of pinned messages in a chat.
func (ChatContext) Promote ¶
func (c ChatContext) Promote(userID int64, rights tg.ChatAdministratorRights) error
Promote promotes or demotes a user in a supergroup or a channel.
func (ChatContext) ReopenForumTopic ¶
func (c ChatContext) ReopenForumTopic(threadID int) error
ReopenForumTopic reopens a closed topic in a forum supergroup chat.
func (ChatContext) ReopenGeneralForumTopic ¶
func (c ChatContext) ReopenGeneralForumTopic() error
ReopenGeneralForumTopic reopens a closed 'General' topic in a forum supergroup chat.
func (ChatContext) ReplyE ¶
func (c ChatContext) ReplyE(to int, s Sendable) error
ReplyE replies to the specified message and returns only an error.
func (ChatContext) Restrict ¶
func (c ChatContext) Restrict(r RestrictChatMember) error
Restrict restricts a user in a supergroup.
func (ChatContext) RevokeInviteLink ¶
func (c ChatContext) RevokeInviteLink(link string) (*tg.ChatInviteLink, error)
RevokeInviteLink revokes an invite link created by the bot.
func (ChatContext) Send ¶
func (c ChatContext) Send(s Sendable, opts ...SendOptions) (*tg.Message, error)
Send sends any Sendable object.
func (ChatContext) SendChatAction ¶
func (c ChatContext) SendChatAction(act tg.ChatAction) error
SendChatAction sends chat action to tell the user that something is happening on the bot's side.
func (ChatContext) SendE ¶
func (c ChatContext) SendE(s Sendable, opts ...SendOptions) error
SendE sends the Sendable and returns only an error.
func (ChatContext) SendMediaGroup ¶
func (c ChatContext) SendMediaGroup(mg MediaGroup, opts ...SendOptions) ([]tg.Message, error)
SendMediaGroup sends a group of photos, videos, documents or audios as an album.
func (ChatContext) SendText ¶
func (c ChatContext) SendText(text string, pm ...tg.ParseMode) error
SendText sends just a text and returns only an error.
func (ChatContext) SetAdminTitle ¶
func (c ChatContext) SetAdminTitle(userID int64, title string) error
SetAdminTitle sets a custom title for an administrator in a supergroup promoted by the bot.
func (ChatContext) SetDescription ¶
func (c ChatContext) SetDescription(description string) error
SetDescription changes the description of a group, a supergroup or a channel.
func (ChatContext) SetMenuButton ¶
func (c ChatContext) SetMenuButton(menu tg.MenuButton) error
SetMenuButton changes the bot's menu button in a private chat.
func (ChatContext) SetPermissions ¶
func (c ChatContext) SetPermissions(perms tg.ChatPermissions, independentPerms ...bool) error
SetPermissions sets default chat permissions for all members.
func (ChatContext) SetPhoto ¶
func (c ChatContext) SetPhoto(photo *tg.InputFile) error
SetPhoto sets a new profile photo for the chat.
func (ChatContext) SetStickerSet ¶
func (c ChatContext) SetStickerSet(stickerSet string) error
SetStickerSet sets a new group sticker set for a supergroup.
func (ChatContext) SetTitle ¶
func (c ChatContext) SetTitle(title string) error
SetTitle change the title of a chat.
func (ChatContext) StopPoll ¶
func (c ChatContext) StopPoll(msgID int, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Poll, error)
StopPoll stops a poll which was sent by the bot.
func (ChatContext) Unban ¶
func (c ChatContext) Unban(userID int64, onlyIfBanned bool) error
Unban unbans a previously banned user in a supergroup or channel.
func (ChatContext) UnbanSenderChat ¶
func (c ChatContext) UnbanSenderChat(senderID int64) error
UnbanSenderChat unbans a previously banned channel chat in a supergroup or channel.
func (ChatContext) UnhideGeneralForumTopic ¶
func (c ChatContext) UnhideGeneralForumTopic() error
UnhideGeneralForumTopic unhides the 'General' topic in a forum supergroup chat.
func (ChatContext) UnpinAllMessages ¶
func (c ChatContext) UnpinAllMessages() error
UnpinAllMessages clears the list of pinned messages in a chat.
func (ChatContext) UnpinMessage ¶
func (c ChatContext) UnpinMessage(msgID int) error
UnpinMessage removes a message from the list of pinned messages in a chat.
type CommandsData ¶
type CommandsData struct { Commands []tg.Command Scope tg.CommandScope Lang string }
CommandsData contains parameters for setMyCommands method.
type Contact ¶
type Contact struct { PhoneNumber string FirstName string LastName string Vcard string ReplyMarkup tg.ReplyMarkup }
Contact contains information about the contact to be sent.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context type.
func (Context) AddSticker ¶
func (c Context) AddSticker(sticker NewSticker) error
AddSticker adds a new sticker to a set created by the bot.
func (Context) CreateInvoiceLink ¶
func (c Context) CreateInvoiceLink(l CreateInvoiceLink) (string, error)
CreateInvoiceLink creates a link for an invoice.
func (Context) CreateNewStickerSet ¶
func (c Context) CreateNewStickerSet(newSet NewStickerSet) error
CreateNewStickerSet creates a new sticker set owned by a user.
func (Context) DeleteSticker ¶
DeleteSticker deletes a sticker from a set created by the bot.
func (Context) DeleteStickerSet ¶
DeleteStickerSet deletes a sticker set that was created by the bot.
func (Context) DownloadFile ¶
DownloadFile downloads file from Telegram servers by file id.
func (Context) DownloadReader ¶
DownloadReader downloads file as io.ReadCloser from Telegram servers.
func (Context) DownloadReaderFile ¶
func (c Context) DownloadReaderFile(fid string) (io.ReadCloser, error)
DownloadReaderFile downloads file as io.ReadCloser from Telegram servers by file id.
func (Context) GetCustomEmojiStickers ¶
GetCustomEmojiStickers returns information about custom emoji stickers by their identifiers.
func (Context) GetFile ¶
GetFile returns basic information about a file and prepares it for downloading.
func (Context) GetForumTopicIconStickers ¶
GetForumTopicIconStickers returns custom emoji stickers, which can be used as a forum topic icon by any user.
func (Context) GetStickerSet ¶
func (c Context) GetStickerSet(name string) (*tg.StickerSet, error)
GetStickerSet returns a sticker set.
func (Context) GetUserPhotos ¶
func (c Context) GetUserPhotos(userID int64) (*tg.UserProfilePhotos, error)
GetUserPhotos returns a list of profile pictures for a user.
func (Context) OpenChat ¶
func (c Context) OpenChat(chatID Chat) ChatContext
OpenChat makes chat interface.
func (Context) OpenMessage ¶
func (c Context) OpenMessage(sig MsgSignature) MessageContext
OpenMessage makes message interface.
func (Context) SetCustomEmojiStickerSetThumbnail ¶
SetCustomEmojiStickerSetThumbnail sets the thumbnail of a custom emoji sticker set.
func (Context) SetStickerEmojiList ¶
SetStickerEmojiList changes the list of emoji assigned to a regular or custom emoji sticker.
func (Context) SetStickerKeywords ¶
SetStickerKeywords changes search keywords assigned to a regular or custom emoji sticker.
func (Context) SetStickerMaskPosition ¶
func (c Context) SetStickerMaskPosition(stickerFileID string, maskPos tg.MaskPosition) error
SetStickerMaskPosition changes the mask position of a mask sticker.
func (Context) SetStickerPosition ¶
SetStickerPosition moves a sticker in a set created by the bot to a specific position.
func (Context) SetStickerSetThumbnail ¶
SetStickerSetThumbnail sets the thumbnail of a sticker set.
func (Context) SetStickerSetTitle ¶
SetStickerSetTitle sets the title of a created sticker set.
type Copy ¶
type Copy struct { MessageID int CaptionData ReplyMarkup tg.ReplyMarkup }
Copy contains parameters for copying the message.
type CreateInvoiceLink ¶
type CreateInvoiceLink = tg.InputInvoiceMessageContent
CreateInvoiceLink contains parameters for creating an invoice link.
type Dice ¶
type Dice struct { Emoji tg.DiceEmoji ReplyMarkup tg.ReplyMarkup }
Dice contains information about the dice to be sent.
type Document ¶
type Document struct { Document tg.Inputtable Thumbnail tg.Inputtable CaptionData DisableTypeDetection bool ReplyMarkup tg.ReplyMarkup }
Document contains information about the document to be sent.
type EditText ¶
type EditText struct { Text string ParseMode tg.ParseMode Entities []tg.MessageEntity DisableWebPagePreview bool }
EditText contains parameters for editing message text.
type Game ¶
type Game struct { ShortName string ReplyMarkup *tg.InlineKeyboardMarkup }
Game contains information about the game to be sent.
type GetUpdates ¶
GetUpdates contains parameters for getUpdates method.
type Handler ¶
type Handler struct { OnMessage func(ChatContext, *tg.Message) OnEditedMessage func(ChatContext, *tg.Message) OnChannelPost func(ChatContext, *tg.Message) OnEditedChannelPost func(ChatContext, *tg.Message) OnCallbackQuery func(CallbackContext, *tg.CallbackQuery) OnInlineQuery func(InlineContext, *tg.InlineQuery) OnInlineChosen func(MessageContext, *tg.InlineChosen) OnShippingQuery func(ShippingContext, *tg.ShippingQuery) OnPreCheckoutQuery func(PreCheckoutContext, *tg.PreCheckoutQuery) OnPoll func(Context, *tg.Poll) OnPollAnswer func(Context, *tg.PollAnswer) OnMyChatMember func(ChatContext, *tg.ChatMemberUpdated) OnChatMember func(ChatContext, *tg.ChatMemberUpdated) OnChatJoinRequest func(ChatContext, *tg.ChatJoinRequest) }
Handler contains all available updates handler functions.
type InlineAnswer ¶
type InlineAnswer struct { Results []tg.InlineQueryResulter CacheTime *int IsPersonal bool NextOffset string Button *tg.InlineQueryResultsButton }
InlineAnswer represents an answer to inline query.
type InviteLink ¶
InviteLink contains parameters for manipulations with invite links.
type Invoice ¶
type Invoice struct { Title string Description string Payload string ProviderToken string Currency string Prices []tg.LabeledPrice MaxTipAmount int SuggestedTipAmounts []int ProviderData string PhotoURL string PhotoSize int PhotoWidth int PhotoHeight int NeedName bool NeedPhoneNumber bool NeedEmail bool NeedShippingAddress bool SendPhoneNumberToProvider bool SendEmailToProvider bool IsFlexible bool StartParameter string ReplyMarkup *tg.InlineKeyboardMarkup }
Invoice contains information about the invoice to be sent.
type LiveLocation ¶
type LiveLocation struct { Long float32 Lat float32 HorizontalAccuracy *float32 Heading int AlertRadius int }
LiveLocation contains parameters for editing the live location.
type Location ¶
type Location struct { tg.Location ReplyMarkup tg.ReplyMarkup }
Location contains information about the location to be sent.
type MediaGroup ¶
type MediaGroup struct { Media []tg.MediaInputter ReplyMarkup *tg.InlineKeyboardMarkup }
MediaGroup contains information about the media group to be sent.
type Message ¶
type Message struct { Text string ParseMode tg.ParseMode Entities []tg.MessageEntity DisableWebPagePreview bool ReplyMarkup tg.ReplyMarkup }
Message contains information about the message to be sent.
type MessageContext ¶
type MessageContext struct { Context // contains filtered or unexported fields }
MessageContext provides api for any message.
For inline messages the result message will always be nil.
func (MessageContext) EditCaption ¶
func (c MessageContext) EditCaption(cap CaptionData, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
EditCaption edits captions of messages.
func (MessageContext) EditLiveLocation ¶
func (c MessageContext) EditLiveLocation(l LiveLocation, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
EditLiveLocation edits live location messages.
func (MessageContext) EditMedia ¶
func (c MessageContext) EditMedia(m tg.MediaInputter, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
EditMedia edits animation, audio, document, photo, or video messages.
func (MessageContext) EditReplyMarkup ¶
func (c MessageContext) EditReplyMarkup(replyMarkup *tg.InlineKeyboardMarkup) (*tg.Message, error)
EditReplyMarkup edits only the reply markup of messages.
func (MessageContext) EditText ¶
func (c MessageContext) EditText(t EditText, replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
EditText edits text and game messages.
func (MessageContext) GetGameHighScores ¶
func (c MessageContext) GetGameHighScores(userID int64) ([]tg.GameHighScore, error)
GetGameHighScores returns data for high score tables.
func (MessageContext) SetGameScore ¶
func (c MessageContext) SetGameScore(userID int64, s SetGameScore) (*tg.Message, error)
SetGameScore sets the score of the specified user in a game message.
func (MessageContext) StopLiveLocation ¶
func (c MessageContext) StopLiveLocation(replyMarkup ...tg.InlineKeyboardMarkup) (*tg.Message, error)
StopLiveLocation stops updating a live location message before live_period expires.
type MsgSignature ¶
type MsgSignature struct {
// contains filtered or unexported fields
}
MsgSignature contains inline message id or chat id with message id.
func CallbackSignature ¶
func CallbackSignature(q *tg.CallbackQuery) MsgSignature
CallbackSignature creates a MessageSignature of any callback message type.
func InlineSignature ¶
func InlineSignature(i *tg.InlineChosen) MsgSignature
InlineSignature creates an inline message signature.
func MessageSignature ¶
func MessageSignature(msg *tg.Message) MsgSignature
MessageSignature creates a chat message signature.
type NewSticker ¶
type NewSticker struct { UserID int64 SetName string Sticker tg.InputSticker }
NewSticker contains parameters for adding a sticker to a set.
type NewStickerSet ¶
type NewStickerSet struct { UserID int64 Name string Title string Stickers []tg.InputSticker Format tg.StickerFormat Type tg.StickerType NeedsRepainting bool }
NewStickerSet contains parameters for creating a sticker set.
type Photo ¶
type Photo struct { Photo tg.Inputtable CaptionData HasSpoiler bool ReplyMarkup tg.ReplyMarkup }
Photo contains information about the photo to be sent.
type Poll ¶
type Poll struct { Question string Options []string IsAnonymous bool Type tg.PollType MultipleAnswers bool CorrectOption int Explanation string ExplanationParseMode tg.ParseMode ExplanationEntities []tg.MessageEntity OpenPeriod int CloseDate int64 IsClosed bool ReplyMarkup tg.ReplyMarkup }
Poll contains information about the poll to be sent.
type PreCheckoutAnswer ¶
PreCheckoutAnswer represents an answer to pre-checkout query.
type PreCheckoutContext ¶
type PreCheckoutContext = QueryContext[PreCheckoutAnswer]
PreCheckoutContext type.
type QueryContext ¶
type QueryContext[T answerable] struct { Context // contains filtered or unexported fields }
QueryContext is the common context for all queries that require an answer.
func (QueryContext[T]) Answer ¶
func (c QueryContext[T]) Answer(answer T) (err error)
func (QueryContext[T]) Child ¶
func (c QueryContext[T]) Child(name string) QueryContext[T]
type RestrictChatMember ¶
type RestrictChatMember struct { UserID int64 Permissions tg.ChatPermissions IndependentPermissions bool Until int64 }
RestrictChatMember contains parameters for restrictChatMember method.
type SendOptions ¶
type SendOptions struct { DisableNotification bool ProtectContent bool ReplyTo int AllowSendingWithoutReply bool }
SendOptions cointains common send* parameters.
type Sendable ¶
type Sendable interface {
// contains filtered or unexported methods
}
Sendable interface for Chat.Send.
type SetGameScore ¶
SetGameScore contains parameters for setting the game score.
type ShippingAnswer ¶
type ShippingAnswer struct { OK bool ShippingOptions []tg.ShippingOption ErrorMessage string }
ShippingAnswer represents an answer to shipping query.
type Sticker ¶
type Sticker struct { Sticker tg.Inputtable Emoji string ReplyMarkup tg.ReplyMarkup }
Sticker contains information about the sticker to be sent.
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
Topic provides forum topics api.
func (Topic) Copy ¶
Copy copies messages of any kind. Service messages and invoice messages can't be copied.
func (Topic) SendChatAction ¶
func (t Topic) SendChatAction(act tg.ChatAction) error
SendChatAction sends chat action to tell the user that something is happening on the bot's side.
func (Topic) SendMediaGroup ¶
func (t Topic) SendMediaGroup(mg MediaGroup, opts ...SendOptions) ([]tg.Message, error)
SendMediaGroup sends a group of photos, videos, documents or audios as an album.
func (Topic) UnpinAllMessages ¶
UnpinAllMessages clears the list of pinned messages in a forum topic.
type Venue ¶
type Venue struct { Lat float32 Long float32 Title string Address string FoursquareID string FoursquareType string GooglePlaceID string GooglePlaceType string ReplyMarkup tg.ReplyMarkup }
Venue contains information about the venue to be sent.
type Video ¶
type Video struct { Video tg.Inputtable Thumbnail tg.Inputtable CaptionData Duration int Width int Height int HasSpoiler bool SupportsStreaming bool ReplyMarkup tg.ReplyMarkup }
Video contains information about the video to be sent.
type VideoNote ¶
type VideoNote struct { VideoNote tg.Inputtable Thumbnail tg.Inputtable Duration int Length int ReplyMarkup tg.ReplyMarkup }
VideoNote contains information about the video note to be sent.
type Voice ¶
type Voice struct { Voice tg.Inputtable CaptionData Duration int ReplyMarkup tg.ReplyMarkup }
Voice contains information about the voice to be sent.
type WebAppAnswer ¶
type WebAppAnswer struct {
Result tg.InlineQueryResulter
}
WebAppAnswer represents an answer to WebApp query.
type WebAppContext ¶
type WebAppContext = QueryContext[WebAppAnswer]
WebAppContext is the context for WebApp query.
func MakeWebAppContext ¶
func MakeWebAppContext(ctx Context, queryID string) WebAppContext
MakeWebAppContext makes WebApp query context.