tba

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartWebHook

func StartWebHook(cfg *cfg.BotConfigs) error

StartWebHook starts the webhook.

Types

type BotAPIInterface

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

BotAPIInterface is the interface which connects the telegram bot API to the bot.

func CreateInterface

func CreateInterface(botCfg *cfgs.BotConfigs) (*BotAPIInterface, error)

CreateInterface returns an iterface to communicate with the bot api. If the updateFrequency argument is not nil, the update routine begins automtically

func (*BotAPIInterface) AddStickerToSet

func (bai *BotAPIInterface) AddStickerToSet(userId int, name string, sticker *objs.InputSticker, file *os.File) (*objs.Result[bool], error)

AddStickerToSet adds a new sticker to the given set.

func (*BotAPIInterface) AnswerCallbackQuery

func (bai *BotAPIInterface) AnswerCallbackQuery(callbackQueryId, text, url string, showAlert bool, CacheTime int) (*objs.Result[bool], error)

AnswerCallbackQuery answers a callback query

func (*BotAPIInterface) AnswerInlineQuery

func (bai *BotAPIInterface) AnswerInlineQuery(inlineQueryId string, results []objs.InlineQueryResult, cacheTime int, isPersonal bool, nextOffset string, button *objs.InlineQueryResultsButton) (*objs.Result[bool], error)

AnswerInlineQuery answers an inline query with the given parameters

func (*BotAPIInterface) AnswerPreCheckoutQuery

func (bai *BotAPIInterface) AnswerPreCheckoutQuery(preCheckoutQueryId string, ok bool, errorMessage string) (*objs.Result[bool], error)

AnswerPreCheckoutQuery answers a pre checkout query

func (*BotAPIInterface) AnswerShippingQuery

func (bai *BotAPIInterface) AnswerShippingQuery(shippingQueryId string, ok bool, shippingOptions []objs.ShippingOption, errorMessage string) (*objs.Result[bool], error)

AnswerShippingQuery answers a shipping query

func (*BotAPIInterface) AnswerWebAppQuery

func (bai *BotAPIInterface) AnswerWebAppQuery(webAppQueryId string, result objs.InlineQueryResult) (*objs.SentWebAppMessage, error)

AnswerWebAppQuery answers a web app query

func (*BotAPIInterface) ApproveChatJoinRequest

func (bai *BotAPIInterface) ApproveChatJoinRequest(chatIdInt int, chatIdString string, userId int) (*objs.Result[bool], error)

ApproveChatJoinRequest approves a request from the given user to join the chat.

func (*BotAPIInterface) BanChatMember

func (bai *BotAPIInterface) BanChatMember(chatIdInt int, chatIdString string, userId, untilDate int, revokeMessages bool) (*objs.Result[bool], error)

BanChatMember bans a chat member

func (*BotAPIInterface) BanOrUnbanChatSenderChat

func (bai *BotAPIInterface) BanOrUnbanChatSenderChat(chatIdInt int, chatIdString string, senderChatId int, ban bool) (*objs.Result[bool], error)

BanOrUnbanChatSenderChat bans or unbans a channel in the group..

func (*BotAPIInterface) CloseForumTopic

func (bai *BotAPIInterface) CloseForumTopic(chatIdInt int, chatIdString string, messageThreadId int) (*objs.Result[bool], error)

CloseForumTopic closes an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic

func (*BotAPIInterface) CloseGeneralForumTopic

func (bai *BotAPIInterface) CloseGeneralForumTopic(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

CloseGeneralForumTopic closes an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights

func (*BotAPIInterface) CopyMessage

func (bai *BotAPIInterface) CopyMessage(chatIdInt, fromChatIdInt int, chatIdString, fromChatIdString string, messageId int, disableNotif bool, caption, parseMode string, replyTo int, allowSendingWihtoutReply, ProtectContent bool, replyMarkUp objs.ReplyMarkup, captionEntities []objs.MessageEntity) (*objs.Result[*objs.Message], error)

CopyMessage copies a message from a user or channel and sends it to a user or channel. If the source or destination (or both) of the forwarded message is a channel, only string chat ids should be given to the function, and if it is user only int chat ids should be given. "chatId", "fromChatId" and "messageId" arguments are required. other arguments are optional for bot api.

func (bai *BotAPIInterface) CreateChatInviteLink(chatIdInt int, chatIdString, name string, expireDate, memberLimit int, createsJoinRequest bool) (*objs.Result[*objs.ChatInviteLink], error)

CreateChatInviteLink creates a new invite link for the chat.

func (*BotAPIInterface) CreateForumTopic

func (bai *BotAPIInterface) CreateForumTopic(chatIdInt int, chatIdString, name, iconCustomEmojiId string, iconColor int) (*objs.Result[*objs.ForumTopic], error)

CreateForumTopic creates a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights

func (bai *BotAPIInterface) CreateInvoiceLink(title, description, payload, providerToken, currency string, prices []objs.LabeledPrice, maxTipAmount int, suggestedTipAmounts []int, providerData, photoURL string, photoSize, photoWidth, photoHeight int, needName, needPhoneNumber, needEmail, needSippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible bool) (*objs.Result[string], error)

CreateInvoiceLink sends an invoice

func (*BotAPIInterface) CreateNewStickerSet

func (bai *BotAPIInterface) CreateNewStickerSet(userId int, name, title, StickerFormat, StickerType string, needsRepainting bool, stickers []*objs.InputSticker, files ...*os.File) (*objs.Result[bool], error)

CreateNewStickerSet creates a new sticker set with the given arguments

func (*BotAPIInterface) DeclineChatJoinRequest

func (bai *BotAPIInterface) DeclineChatJoinRequest(chatIdInt int, chatIdString string, userId int) (*objs.Result[bool], error)

DeclineChatJoinRequest declines a request from the given user to join the chat.

func (*BotAPIInterface) DeleteChatPhoto

func (bai *BotAPIInterface) DeleteChatPhoto(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

DeleteChatPhoto deletes chat photo.

func (*BotAPIInterface) DeleteChatStickerSet

func (bai *BotAPIInterface) DeleteChatStickerSet(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

DeleteChatStickerSet deletes the sticker set of the chat..

func (*BotAPIInterface) DeleteForumTopic

func (bai *BotAPIInterface) DeleteForumTopic(chatIdInt int, chatIdString string, messageThreadId int) (*objs.Result[bool], error)

DeleteForumTopic deletes a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights

func (*BotAPIInterface) DeleteMessage

func (bai *BotAPIInterface) DeleteMessage(chatIdInt int, chatIdString string, messageId int) (*objs.Result[bool], error)

DeleteMessage deletes the given message int the given chat.

func (*BotAPIInterface) DeleteMyCommands

func (bai *BotAPIInterface) DeleteMyCommands(scope objs.BotCommandScope, languageCode string) (*objs.Result[bool], error)

DeleteMyCommands deletes the commands of the bot

func (*BotAPIInterface) DeleteStickerFromSet

func (bai *BotAPIInterface) DeleteStickerFromSet(sticker string) (*objs.Result[bool], error)

DeleteStickerFromSet deletes the given sticker from a set created by the bot

func (*BotAPIInterface) DeleteStickerSet

func (bai *BotAPIInterface) DeleteStickerSet(name string) (*objs.Result[bool], error)

DeleteStickerSet deletes a sticker set that was created by the bot. Returns True on success.

func (*BotAPIInterface) DeleteWebhook

func (bai *BotAPIInterface) DeleteWebhook(dropPendingUpdates bool) (*objs.Result[bool], error)

DeleteWebhook deletes the webhook for this bot

func (*BotAPIInterface) DownloadFile

func (bai *BotAPIInterface) DownloadFile(fileObject *objs.File, file *os.File) error

DownloadFile downloads a file from telegram servers and saves it into the given file.

This method closes the given file. If the file is nil, this method will create a file based on the name of the file stored in telegram servers.

func (bai *BotAPIInterface) EditChatInviteLink(chatIdInt int, chatIdString, inviteLink, name string, expireDate, memberLimit int, createsJoinRequest bool) (*objs.Result[*objs.ChatInviteLink], error)

EditChatInviteLink edits an existing invite link for the chat.

func (*BotAPIInterface) EditForumTopic

func (bai *BotAPIInterface) EditForumTopic(chatIdInt int, chatIdString, name, iconCustomEmojiId string, messageThreadId int) (*objs.Result[bool], error)

EditForumTopic edits name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic

func (*BotAPIInterface) EditGeneralForumTopic

func (bai *BotAPIInterface) EditGeneralForumTopic(chatIdInt int, chatIdString, name string) (*objs.Result[bool], error)

EditGeneralForumTopic edits the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights

func (*BotAPIInterface) EditMessageCaption

func (bai *BotAPIInterface) EditMessageCaption(chatIdInt int, chatIdString string, messageId int, inlineMessageId, caption, parseMode string, captionEntities []objs.MessageEntity, replyMakrup *objs.InlineKeyboardMarkup) (*objs.Result[json.RawMessage], error)

EditMessageCaption edits the caption of the given message in the given chat.

func (*BotAPIInterface) EditMessageLiveLocation

func (bai *BotAPIInterface) EditMessageLiveLocation(chatIdInt int, chatIdString, inlineMessageId string, messageId int, latitude, longitude, horizontalAccuracy float32, heading, proximityAlertRadius int, reply_markup *objs.InlineKeyboardMarkup) (*objs.Result[json.RawMessage], error)

EditMessageLiveLocation edits a live location sent to a channel (chatIdString) or a chat (chatIdInt) "chatId","latitude" and "longitude" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) EditMessageMedia

func (bai *BotAPIInterface) EditMessageMedia(chatIdInt int, chatIdString string, messageId int, inlineMessageId string, media objs.InputMedia, replyMakrup *objs.InlineKeyboardMarkup, file ...*os.File) (*objs.Result[json.RawMessage], error)

EditMessageMedia edits the media of the given message in the given chat.

func (*BotAPIInterface) EditMessageText

func (bai *BotAPIInterface) EditMessageText(chatIdInt int, chatIdString string, messageId int, inlineMessageId, text, parseMode string, entities []objs.MessageEntity, disableWebPagePreview bool, replyMakrup *objs.InlineKeyboardMarkup) (*objs.Result[json.RawMessage], error)

EditMessageText edits the text of the given message in the given chat.

func (*BotAPIInterface) EditMessagereplyMarkup

func (bai *BotAPIInterface) EditMessagereplyMarkup(chatIdInt int, chatIdString string, messageId int, inlineMessageId string, replyMakrup *objs.InlineKeyboardMarkup) (*objs.Result[json.RawMessage], error)

EditMessagereplyMarkup edits the reply makrup of the given message in the given chat.

func (bai *BotAPIInterface) ExportChatInviteLink(chatIdInt int, chatIdString string) (*objs.Result[string], error)

ExportChatInviteLink exports the chat invite link and returns the new invite link as string.

func (*BotAPIInterface) ForwardMessage

func (bai *BotAPIInterface) ForwardMessage(chatIdInt, fromChatIdInt int, chatIdString, fromChatIdString string, disableNotif, ProtectContent bool, messageId, messageThreadId int) (*objs.Result[*objs.Message], error)

ForwardMessage forwards a message from a user or channel to a user or channel. If the source or destination (or both) of the forwarded message is a channel, only string chat ids should be given to the function, and if it is user only int chat ids should be given. "chatId", "fromChatId" and "messageId" arguments are required. other arguments are optional for bot api.

func (*BotAPIInterface) GetChat

func (bai *BotAPIInterface) GetChat(chatIdInt int, chatIdString string) (*objs.Result[*objs.Chat], error)

GetChat : a Chat object containing the information of the chat will be returned

func (*BotAPIInterface) GetChatAdministrators

func (bai *BotAPIInterface) GetChatAdministrators(chatIdInt int, chatIdString string) (*objs.Result[[]objs.ChatMemberOwner], error)

GetChatAdministrators returns an array of ChatMember containing the informations of the chat administrators.

func (*BotAPIInterface) GetChatMember

func (bai *BotAPIInterface) GetChatMember(chatIdInt int, chatIdString string, userId int) (*objs.Result[json.RawMessage], error)

GetChatMember returns the information of the member in a ChatMember object.

func (*BotAPIInterface) GetChatMemberCount

func (bai *BotAPIInterface) GetChatMemberCount(chatIdInt int, chatIdString string) (*objs.Result[int], error)

GetChatMemberCount returns the number of the memebrs of the chat.

func (*BotAPIInterface) GetChatMenuButton

func (bai *BotAPIInterface) GetChatMenuButton(chatId int64) (*objs.Result[*objs.MenuButton], error)

GetChatMenuButton gets the menu button for the given chat

func (*BotAPIInterface) GetChatUpdateChannel

func (bai *BotAPIInterface) GetChatUpdateChannel() *chan *objs.ChatUpdate

GetChatUpdateChannel returnes the chat update channel

func (*BotAPIInterface) GetCustomEmojiStickers

func (bai *BotAPIInterface) GetCustomEmojiStickers(customEmojiIds []string) (*objs.Result[[]*objs.Sticker], error)

GetCustomEmojiStickers returns the information of the speicified stickers by id

func (*BotAPIInterface) GetFile

func (bai *BotAPIInterface) GetFile(fileId string) (*objs.Result[*objs.File], error)

GetFile gets the file based on the given file id and returns the file object.

func (*BotAPIInterface) GetForumTopicIconStickers

func (bai *BotAPIInterface) GetForumTopicIconStickers() (*objs.Result[[]*objs.Sticker], error)

GetForumTopicIconStickers returns custom emoji stickers, which can be used as a forum topic icon by any user.

func (*BotAPIInterface) GetGameHighScores

func (bai *BotAPIInterface) GetGameHighScores(userId, chatId, messageId int, inlineMessageId string) (*objs.Result[[]*objs.GameHighScore], error)

GetGameHighScores gets the high scores of the user

func (*BotAPIInterface) GetMe

func (bai *BotAPIInterface) GetMe() (*objs.Result[*objs.User], error)

GetMe gets the bot info

func (*BotAPIInterface) GetMyCommands

func (bai *BotAPIInterface) GetMyCommands(scope objs.BotCommandScope, languageCode string) (*objs.Result[[]objs.BotCommand], error)

GetMyCommands gets the commands of the bot

func (*BotAPIInterface) GetMyDefaultAdministratorRights

func (bai *BotAPIInterface) GetMyDefaultAdministratorRights(forChannels bool) (*objs.Result[*objs.ChatAdministratorRights], error)

GetMyDefaultAdministratorRights gets the admin rights

func (*BotAPIInterface) GetMyDescription

func (bai *BotAPIInterface) GetMyDescription(languageCode string) (*objs.Result[*objs.BotDescription], error)

GetMyDescription gets the current bot description for the given user language. Returns BotDescription on success.

func (*BotAPIInterface) GetMyName

func (bai *BotAPIInterface) GetMyName(languageCode string) (*objs.Result[*objs.BotName], error)

GetMyName gets the current bot name for the given user language. Returns BotName on success.

func (*BotAPIInterface) GetMyShortDescription

func (bai *BotAPIInterface) GetMyShortDescription(languageCode string) (*objs.Result[*objs.BotShortDescription], error)

GetMyShortDescription gets the current bot short description for the given user language. Returns BotShortDescription on success.

func (*BotAPIInterface) GetStickerSet

func (bai *BotAPIInterface) GetStickerSet(name string) (*objs.Result[*objs.StickerSet], error)

GetStickerSet gets the sticker set by the given name

func (*BotAPIInterface) GetUpdateChannel

func (bai *BotAPIInterface) GetUpdateChannel() *chan *objs.Update

GetUpdateChannel returns the update channel

func (*BotAPIInterface) GetUserProfilePhotos

func (bai *BotAPIInterface) GetUserProfilePhotos(userId, offset, limit int) (*objs.Result[*objs.UserProfilePhotos], error)

GetUserProfilePhotos gets the user profile photos

func (*BotAPIInterface) GetWebhookInfo

func (bai *BotAPIInterface) GetWebhookInfo() (*objs.Result[*objs.WebhookInfo], error)

GetWebhookInfo returns the web hook info of the bot.

func (*BotAPIInterface) HideGeneralForumTopic

func (bai *BotAPIInterface) HideGeneralForumTopic(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

HideGeneralForumTopic hides the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open.

func (*BotAPIInterface) LeaveChat

func (bai *BotAPIInterface) LeaveChat(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

LeaveChat, the bot will leave the chat if this method is called.

func (*BotAPIInterface) ParseUpdate added in v2.1.0

func (bai *BotAPIInterface) ParseUpdate(body []byte) (int, error)

ParseUpdate parses the received update and returns the last update offset.

func (*BotAPIInterface) PinChatMessage

func (bai *BotAPIInterface) PinChatMessage(chatIdInt int, chatIdString string, messageId int, disableNotification bool) (*objs.Result[bool], error)

PinChatMessage pins the message in the chat.

func (*BotAPIInterface) PromoteChatMember

func (bai *BotAPIInterface) PromoteChatMember(chatIdInt int, chatIdString string, userId int, isAnonymous, canManageChat, canPostmessages, canEditMessages, canDeleteMessages, canManageVideoChats, canRestrictMembers, canPromoteMembers, canChangeInfo, canInviteUsers, canPinMessages, canManageTopics bool) (*objs.Result[bool], error)

PromoteChatMember promotes a chat member

func (*BotAPIInterface) ReopenForumTopic

func (bai *BotAPIInterface) ReopenForumTopic(chatIdInt int, chatIdString string, messageThreadId int) (*objs.Result[bool], error)

ReopenForumTopic reopens a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic

func (*BotAPIInterface) ReopenGeneralForumTopic

func (bai *BotAPIInterface) ReopenGeneralForumTopic(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

ReopenGeneralForumTopic reopens a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden.

func (*BotAPIInterface) RestrictChatMember

func (bai *BotAPIInterface) RestrictChatMember(chatIdInt int, chatIdString string, userId int, permissions objs.ChatPermissions, useIndependentChatPermissions bool, untilDate int) (*objs.Result[bool], error)

RestrictChatMember restricts a chat member

func (bai *BotAPIInterface) RevokeChatInviteLink(chatIdInt int, chatIdString, inviteLink string) (*objs.Result[*objs.ChatInviteLink], error)

RevokeChatInviteLink revokes the given invite link.

func (*BotAPIInterface) SendAnimation

func (bai *BotAPIInterface) SendAnimation(chatIdInt int, chatIdString, animation string, animationFile *os.File, caption, parseMode string, width, height, duration int, reply_to_message_id, messageThreadId int, thumb string, thumbFile *os.File, disable_notification, allow_sending_without_reply, protectContent, hasSpoiler bool, captionEntities []objs.MessageEntity, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendAnimation sends an animation (file,url,telegramId) to a channel (chatIdString) or a chat (chatIdInt) "chatId" and "animation" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendAudio

func (bai *BotAPIInterface) SendAudio(chatIdInt int, chatIdString, audio string, audioFile *os.File, caption, parseMode string, reply_to_message_id, messageThreadId int, thumb string, thumbFile *os.File, disable_notification, allow_sending_without_reply, ProtectContent bool, captionEntities []objs.MessageEntity, duration int, performer, title string, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendAudio sends an audio (file,url,telegramId) to a channel (chatIdString) or a chat (chatIdInt) "chatId" and "audio" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0,to ignore string arguments pass "")

func (*BotAPIInterface) SendChatAction

func (bai *BotAPIInterface) SendChatAction(chatIdInt, messageThreadId int, chatIdString, chatAction string) (*objs.Result[*objs.Message], error)

SendChatAction sends a chat action message to a channel (chatIdString) or a chat (chatIdInt) "chatId" argument is required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendContact

func (bai *BotAPIInterface) SendContact(chatIdInt int, chatIdString, phoneNumber, firstName, lastName, vCard string, reply_to_message_id, messageThreadId int, disable_notification, allow_sending_without_reply, ProtectContent bool, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendContact sends a contact to a channel (chatIdString) or a chat (chatIdInt) "chatId","phoneNumber" and "firstName" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendCustom

func (bai *BotAPIInterface) SendCustom(methodName string, args objs.MethodArguments, MP bool, files ...*os.File) ([]byte, error)

SendCustom calls the given method on api server with the given arguments. "MP" options indicates that the request should be made in multipart/formdata form. If this method sends a file to the api server the "MP" option should be true

func (*BotAPIInterface) SendDice

func (bai *BotAPIInterface) SendDice(chatIdInt int, chatIdString, emoji string, reply_to_message_id, messageThreadId int, disable_notification, allow_sending_without_reply, ProtectContent bool, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendDice sends a dice message to a channel (chatIdString) or a chat (chatIdInt) "chatId" argument is required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendDocument

func (bai *BotAPIInterface) SendDocument(chatIdInt int, chatIdString, document string, documentFile *os.File, caption, parseMode string, reply_to_message_id, messageThreadId int, thumb string, thumbFile *os.File, disable_notification, allow_sending_without_reply, ProtectContent bool, captionEntities []objs.MessageEntity, DisableContentTypeDetection bool, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

sSendDocument sends a document (file,url,telegramId) to a channel (chatIdString) or a chat (chatIdInt) "chatId" and "document" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendGame

func (bai *BotAPIInterface) SendGame(chatId int, gameShortName string, disableNotif bool, replyTo int, allowSendingWithoutReply bool, replyMarkup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendGame sends a game

func (*BotAPIInterface) SendInvoice

func (bai *BotAPIInterface) SendInvoice(chatIdInt int, chatIdString, title, description, payload, providerToken, currency string, prices []objs.LabeledPrice, maxTipAmount int, suggestedTipAmounts []int, startParameter, providerData, photoURL string, photoSize, photoWidth, photoHeight int, needName, needPhoneNumber, needEmail, needSippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible, disableNotif bool, replyToMessageId, messageThreadId int, allowSendingWithoutReply bool, replyMarkup objs.InlineKeyboardMarkup) (*objs.Result[*objs.Message], error)

SendInvoice sends an invoice

func (*BotAPIInterface) SendLocation

func (bai *BotAPIInterface) SendLocation(chatIdInt int, chatIdString string, latitude, longitude, horizontalAccuracy float32, livePeriod, heading, proximityAlertRadius, reply_to_message_id, messageThreadId int, disable_notification, allow_sending_without_reply, ProtectContent bool, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendLocation sends a location to a channel (chatIdString) or a chat (chatIdInt) "chatId","latitude" and "longitude" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendMediaGroup

func (bai *BotAPIInterface) SendMediaGroup(chatIdInt int, chatIdString string, reply_to_message_id, messageThreadId int, media []objs.InputMedia, disable_notification, allow_sending_without_reply, ProtectContent bool, reply_markup objs.ReplyMarkup, files ...*os.File) (*objs.Result[[]objs.Message], error)

SendMediaGroup sends an album of media (file,url,telegramId) to a channel (chatIdString) or a chat (chatIdInt) "chatId" and "media" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendMessage

func (bai *BotAPIInterface) SendMessage(chatIdInt int, chatIdString, text, parseMode string, entities []objs.MessageEntity, disable_web_page_preview, disable_notification, allow_sending_without_reply, ProtectContent bool, reply_to_message_id, messageThreadId int, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendMessage sends a message to the user. chatIdInt is used for all chats but channles and chatidString is used for channels (in form of @channleusername) and only of them has be populated, otherwise ChatIdProblem error will be returned. "chatId" and "text" arguments are required. other arguments are optional for bot api.

func (*BotAPIInterface) SendPhoto

func (bai *BotAPIInterface) SendPhoto(chatIdInt int, chatIdString, photo string, photoFile *os.File, caption, parseMode string, reply_to_message_id, messageThreadId int, disable_notification, allow_sending_without_reply, protectContent, hasSpoiler bool, reply_markup objs.ReplyMarkup, captionEntities []objs.MessageEntity) (*objs.Result[*objs.Message], error)

SendPhoto sends a photo (file,url,telegramId) to a channel (chatIdString) or a chat (chatIdInt) "chatId" and "photo" arguments are required. other arguments are optional for bot api.

func (*BotAPIInterface) SendPoll

func (bai *BotAPIInterface) SendPoll(chatIdInt int, chatIdString, question string, options []string, isClosed, isAnonymous bool, pollType string, allowMultipleAnswers bool, correctOptionIndex int, explanation, explanationParseMode string, explanationEntities []objs.MessageEntity, openPeriod, closeDate int, reply_to_message_id, messageThreadId int, disable_notification, allow_sending_without_reply, ProtectContent bool, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendPoll sends a poll to a channel (chatIdString) or a chat (chatIdInt) "chatId","phoneNumber" and "firstName" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendSticker

func (bai *BotAPIInterface) SendSticker(chatIdInt int, chatIdString, sticker, emoji string, disableNotif, allowSendingWithoutreply, protectContent bool, replyTo, messageThreadId int, replyMarkup objs.ReplyMarkup, file *os.File) (*objs.Result[*objs.Message], error)

SendSticker sends an sticker to the given chat id.

func (*BotAPIInterface) SendVenue

func (bai *BotAPIInterface) SendVenue(chatIdInt int, chatIdString string, latitude, longitude float32, title, address, fourSquareId, fourSquareType, googlePlaceId, googlePlaceType string, reply_to_message_id, messageThreadId int, disable_notification, allow_sending_without_reply, ProtectContent bool, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendVenue sends a venue to a channel (chatIdString) or a chat (chatIdInt) "chatId","latitude","longitude","title" and "address" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendVideo

func (bai *BotAPIInterface) SendVideo(chatIdInt int, chatIdString, video string, videoFile *os.File, caption, parseMode string, reply_to_message_id, messageThreadId int, thumb string, thumbFile *os.File, disable_notification, allow_sending_without_reply, protectContent, hasSpoiler bool, captionEntities []objs.MessageEntity, duration int, supportsStreaming bool, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendVideo sends a video (file,url,telegramId) to a channel (chatIdString) or a chat (chatIdInt) "chatId" and "video" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SendVideoNote

func (bai *BotAPIInterface) SendVideoNote(chatIdInt int, chatIdString, videoNote string, videoNoteFile *os.File, caption, parseMode string, length, duration int, reply_to_message_id, messageThreadId int, thumb string, thumbFile *os.File, disable_notification, allow_sending_without_reply, ProtectContent bool, captionEntities []objs.MessageEntity, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

SendVideoNote sends a video note (file,url,telegramId) to a channel (chatIdString) or a chat (chatIdInt) "chatId" and "videoNote" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0) Note that sending video note by URL is not supported by telegram.

func (*BotAPIInterface) SendVoice

func (bai *BotAPIInterface) SendVoice(chatIdInt int, chatIdString, voice string, voiceFile *os.File, caption, parseMode string, duration int, reply_to_message_id, messageThreadId int, disable_notification, allow_sending_without_reply, ProtectContent bool, captionEntities []objs.MessageEntity, reply_markup objs.ReplyMarkup) (*objs.Result[*objs.Message], error)

sSendVoice sends a voice (file,url,telegramId) to a channel (chatIdString) or a chat (chatIdInt) "chatId" and "voice" arguments are required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) SetChatAdministratorCustomTitle

func (bai *BotAPIInterface) SetChatAdministratorCustomTitle(chatIdInt int, chatIdString string, userId int, customTitle string) (*objs.Result[bool], error)

SetChatAdministratorCustomTitle sets a custom title for the administrator.

func (*BotAPIInterface) SetChatDescription

func (bai *BotAPIInterface) SetChatDescription(chatIdInt int, chatIdString, descriptions string) (*objs.Result[bool], error)

SetChatDescription sets the chat description.

func (*BotAPIInterface) SetChatMenuButton

func (bai *BotAPIInterface) SetChatMenuButton(chatId int64, menuButton *objs.MenuButton) (*objs.Result[bool], error)

SetChatMenuButton sets the menu button for the given chat

func (*BotAPIInterface) SetChatPermissions

func (bai *BotAPIInterface) SetChatPermissions(chatIdInt int, chatIdString string, useIndependentChatPermissions bool, permissions objs.ChatPermissions) (*objs.Result[bool], error)

SetChatPermissions sets default permissions for all users in the chat.

func (*BotAPIInterface) SetChatPhoto

func (bai *BotAPIInterface) SetChatPhoto(chatIdInt int, chatIdString string, file *os.File) (*objs.Result[bool], error)

SetChatPhoto sets the chat photo to given file.

func (*BotAPIInterface) SetChatStickerSet

func (bai *BotAPIInterface) SetChatStickerSet(chatIdInt int, chatIdString, stickerSetName string) (*objs.Result[bool], error)

SetChatStickerSet sets the sticker set of the chat.

func (*BotAPIInterface) SetChatTitle

func (bai *BotAPIInterface) SetChatTitle(chatIdInt int, chatIdString, title string) (*objs.Result[bool], error)

SetChatTitle sets the chat title.

func (*BotAPIInterface) SetGameScore

func (bai *BotAPIInterface) SetGameScore(userId, score int, force, disableEditMessage bool, chatId, messageId int, inlineMessageId string) (*objs.Result[json.RawMessage], error)

SetGameScore sets the game high score

func (*BotAPIInterface) SetMyCommands

func (bai *BotAPIInterface) SetMyCommands(commands []objs.BotCommand, scope objs.BotCommandScope, languageCode string) (*objs.Result[bool], error)

SetMyCommands sets the commands of the bot

func (*BotAPIInterface) SetMyDefaultAdministratorRights

func (bai *BotAPIInterface) SetMyDefaultAdministratorRights(forChannels, isAnonymous, canManageChat, canPostmessages, canEditMessages, canDeleteMessages, canManageVideoChats, canRestrictMembers, canPromoteMembers, canChangeInfo, canInviteUsers, canPinMessages bool) (*objs.Result[bool], error)

SetMyDefaultAdministratorRights sets the admin rights

func (*BotAPIInterface) SetMyDescription

func (bai *BotAPIInterface) SetMyDescription(description, languageCode string) (*objs.Result[bool], error)

SetMyDescription changes the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.

func (*BotAPIInterface) SetMyName

func (bai *BotAPIInterface) SetMyName(name, languageCode string) (*objs.Result[bool], error)

SetMyName changes the bot's name. Returns True on success.

func (*BotAPIInterface) SetMyShortDescription

func (bai *BotAPIInterface) SetMyShortDescription(description, languageCode string) (*objs.Result[bool], error)

SetMyShortDescription 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. Returns True on success.

func (*BotAPIInterface) SetPassportDataErrors

func (bai *BotAPIInterface) SetPassportDataErrors(userId int, errors []objs.PassportElementError) (*objs.Result[bool], error)

SetPassportDataErrors sets passport data errors

func (*BotAPIInterface) SetStickerEmojiList

func (bai *BotAPIInterface) SetStickerEmojiList(sticker string, emojiLst []string) (*objs.Result[bool], error)

SetStickerEmojiList changes the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

func (*BotAPIInterface) SetStickerKeywords

func (bai *BotAPIInterface) SetStickerKeywords(sticker string, keywords []string) (*objs.Result[bool], error)

SetStickerKeywords changes search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

func (*BotAPIInterface) SetStickerMaskPosition

func (bai *BotAPIInterface) SetStickerMaskPosition(sticker string, maskPosition *objs.MaskPosition) (*objs.Result[bool], error)

SetStickerMaskPosition changes the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success.

func (*BotAPIInterface) SetStickerPositionInSet

func (bai *BotAPIInterface) SetStickerPositionInSet(sticker string, position int) (*objs.Result[bool], error)

SetStickerPositionInSet sets the position of a sticker in an sticker set

func (*BotAPIInterface) SetStickerSetThumb

func (bai *BotAPIInterface) SetStickerSetThumb(name, thumb string, userId int, file *os.File) (*objs.Result[bool], error)

SetStickerSetThumb sets the thumbnail for the given sticker

func (*BotAPIInterface) SetStickerSetTitle

func (bai *BotAPIInterface) SetStickerSetTitle(name, title string) (*objs.Result[bool], error)

SetStickerSetTitle sets the title of a created sticker set. Returns True on success.

func (*BotAPIInterface) SetWebhook

func (bai *BotAPIInterface) SetWebhook(url, ip string, maxCnc int, allowedUpdates []string, dropPendingUpdates bool, keyFile *os.File) (*objs.Result[bool], error)

SetWebhook sets a webhook for the bot.

func (*BotAPIInterface) StartUpdateRoutine

func (bai *BotAPIInterface) StartUpdateRoutine() error

StartUpdateRoutine starts the update routine to receive updates from api sever

func (*BotAPIInterface) StopMessageLiveLocation

func (bai *BotAPIInterface) StopMessageLiveLocation(chatIdInt int, chatIdString, inlineMessageId string, messageId int, replyMarkup *objs.InlineKeyboardMarkup) (*objs.Result[json.RawMessage], error)

StopMessageLiveLocation stops a live location sent to a channel (chatIdString) or a chat (chatIdInt) "chatId" argument is required. other arguments are optional for bot api. (to ignore int arguments, pass 0)

func (*BotAPIInterface) StopPoll

func (bai *BotAPIInterface) StopPoll(chatIdInt int, chatIdString string, messageId int, replyMakrup *objs.InlineKeyboardMarkup) (*objs.Result[*objs.Poll], error)

StopPoll stops the poll.

func (*BotAPIInterface) StopUpdateRoutine

func (bai *BotAPIInterface) StopUpdateRoutine()

StopUpdateRoutine stops the update routine

func (*BotAPIInterface) UnbanChatMember

func (bai *BotAPIInterface) UnbanChatMember(chatIdInt int, chatIdString string, userId int, onlyIfBanned bool) (*objs.Result[bool], error)

UnbanChatMember unbans a chat member

func (*BotAPIInterface) UnhideGeneralForumTopic

func (bai *BotAPIInterface) UnhideGeneralForumTopic(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

UnhideGeneralForumTopic unhides the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.

func (*BotAPIInterface) UnpinAllChatMessages

func (bai *BotAPIInterface) UnpinAllChatMessages(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

UnpinAllChatMessages unpins all the pinned messages in the chat.

func (*BotAPIInterface) UnpinAllForumTopicMessages

func (bai *BotAPIInterface) UnpinAllForumTopicMessages(chatIdInt int, chatIdString string, messageThreadId int) (*objs.Result[bool], error)

UnpinAllForumTopicMessages clears the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup

func (*BotAPIInterface) UnpinAllGeneralForumTopicMessages

func (bai *BotAPIInterface) UnpinAllGeneralForumTopicMessages(chatIdInt int, chatIdString string) (*objs.Result[bool], error)

UnpinAllGeneralForumTopicMessages clears the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup.

func (*BotAPIInterface) UnpinChatMessage

func (bai *BotAPIInterface) UnpinChatMessage(chatIdInt int, chatIdString string, messageId int) (*objs.Result[bool], error)

UnpinChatMessage unpins the pinned message in the chat.

func (*BotAPIInterface) UploadStickerFile

func (bai *BotAPIInterface) UploadStickerFile(userId int, stickerFormat string, sticker *objs.InputSticker, file *os.File) (*objs.Result[*objs.File], error)

UploadStickerFile uploads the given file as an sticker on the telegram servers.

Jump to

Keyboard shortcuts

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