bot

package module
v0.0.0-...-b447b7a Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 13 Imported by: 0

README

GoTGramBot

GoTGramBot is the Golang bindings for the Telegram Bot API

Most of the methods and types used in this library are auto-generated by scraping the official documentation of Telegram Bot Api

So there are high chances of getting bugs and other issues. So please let us know through the issue section about the bug you have encountered. If something isn't clear, open an issue or submit a pull request.

This lib is the successor of TGramBot which is actually in python. But I ended up in much bigger problems in Tgrambot. Some of the functions are still not stable and are more complex to import it. So I thought of making a lib much similar to it in Go which is much better.

Installing.

go get github.com/KeralaBots/GoTGramBot

This Library is still in its Alpha phase. More tests and analysis are still in progress to make it more user friendly and easy to use

Example

package main

import (
	"net/http"

	bot "github.com/KeralaBots/GoTGramBot"
	filters "github.com/KeralaBots/GoTGramBot/filters"
	types "github.com/KeralaBots/GoTGramBot/types"
)

func start(b *bot.Bot, m *types.Message) error {
	replyButton := [][]types.InlineKeyboardButton{
		{
			{
				Text:         "Hi",
				CallbackData: "test",
			},
		},
	}

	_, err := b.SendMessage(
		m.Chat.Id,
		"Hi",
		&bot.SendMessageOpts{ReplyMarkup: types.InlineKeyboardMarkup{InlineKeyboard: replyButton}},
	)

	return err
}


func main() {
	tbot, _ := bot.CreateBot("token", &bot.ClientOpts{
		Client: http.Client{},
	})
  
	d := tbot.NewDispatcher()
	d.AddMessageHandler(start, filters.All)
  
  
	d.Run()
}

More examples are in samples directory

Credits

Special thanks to Paul Larsen for his libraries

Documentation

Index

Constants

View Source
const (
	APIURL  = "https://api.telegram.org"
	TIMEOUT = time.Second * 5
)

Variables

This section is empty.

Functions

func GetApiURL

func GetApiURL(token string, method string) string

Types

type AnswerCallbackQueryOpts

type AnswerCallbackQueryOpts struct {
	Text      string `json:"text,omitempty"`
	ShowAlert bool   `json:"show_alert,omitempty"`
	Url       string `json:"url,omitempty"`
	CacheTime int64  `json:"cache_time,omitempty"`
}

AnswerCallbackQuery methods's optional params

type AnswerInlineQueryOpts

type AnswerInlineQueryOpts struct {
	CacheTime  int64                           `json:"cache_time,omitempty"`
	IsPersonal bool                            `json:"is_personal,omitempty"`
	NextOffset string                          `json:"next_offset,omitempty"`
	Button     *types.InlineQueryResultsButton `json:"button,omitempty"`
}

AnswerInlineQuery methods's optional params

type AnswerPreCheckoutQueryOpts

type AnswerPreCheckoutQueryOpts struct {
	ErrorMessage string `json:"error_message,omitempty"`
}

AnswerPreCheckoutQuery methods's optional params

type AnswerShippingQueryOpts

type AnswerShippingQueryOpts struct {
	ShippingOptions []types.ShippingOption `json:"shipping_options,omitempty"`
	ErrorMessage    string                 `json:"error_message,omitempty"`
}

AnswerShippingQuery methods's optional params

type BanChatMemberOpts

type BanChatMemberOpts struct {
	UntilDate      int64 `json:"until_date,omitempty"`
	RevokeMessages bool  `json:"revoke_messages,omitempty"`
}

BanChatMember methods's optional params

type Bot

type Bot struct {
	Token  string      `json:"token"`
	Client http.Client `json:"-"`
}

func CreateBot

func CreateBot(token string, clientOpts *ClientOpts) (*Bot, error)

func (*Bot) AddStickerToSet

func (b *Bot) AddStickerToSet(userId int64, name string, sticker *types.InputSticker) (bool, error)

Use this method to add a new sticker to a set created by the bot. The format of the added sticker must match the format of the other stickers in the set. Emoji sticker sets can have up to 200 stickers. Animated and video sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success.

func (*Bot) AnswerCallbackQuery

func (b *Bot) AnswerCallbackQuery(callbackQueryId string, opts *AnswerCallbackQueryOpts) (bool, error)

Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.

func (*Bot) AnswerInlineQuery

func (b *Bot) AnswerInlineQuery(inlineQueryId string, results []types.InlineQueryResult, opts *AnswerInlineQueryOpts) (bool, error)

Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.

func (*Bot) AnswerPreCheckoutQuery

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

Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.

func (*Bot) AnswerShippingQuery

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

If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.

func (*Bot) AnswerWebAppQuery

func (b *Bot) AnswerWebAppQuery(webAppQueryId string, result *types.InlineQueryResult) (*types.SentWebAppMessage, error)

Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.

func (*Bot) ApproveChatJoinRequest

func (b *Bot) ApproveChatJoinRequest(chatId int64, userId int64) (bool, error)

Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.

func (*Bot) BanChatMember

func (b *Bot) BanChatMember(chatId int64, userId int64, opts *BanChatMemberOpts) (bool, error)

Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

func (*Bot) BanChatSenderChat

func (b *Bot) BanChatSenderChat(chatId int64, senderChatId int64) (bool, error)

Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.

func (*Bot) Close

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

Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.

func (*Bot) CloseForumTopic

func (b *Bot) CloseForumTopic(chatId int64, messageThreadId int64) (bool, error)

Use this method to close 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. Returns True on success.

func (*Bot) CloseGeneralForumTopic

func (b *Bot) CloseGeneralForumTopic(chatId int64) (bool, error)

Use this method to close 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. Returns True on success.

func (*Bot) CopyMessage

func (b *Bot) CopyMessage(chatId int64, fromChatId int64, messageId int64, opts *CopyMessageOpts) (*types.MessageId, error)

Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

func (b *Bot) CreateChatInviteLink(chatId int64, opts *CreateChatInviteLinkOpts) (*types.ChatInviteLink, error)

Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.

func (*Bot) CreateForumTopic

func (b *Bot) CreateForumTopic(chatId int64, name string, opts *CreateForumTopicOpts) (*types.ForumTopic, error)

Use this method to create 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. Returns information about the created topic as a ForumTopic object.

func (b *Bot) CreateInvoiceLink(title string, description string, payload string, providerToken string, currency string, prices []types.LabeledPrice, opts *CreateInvoiceLinkOpts) (string, error)

Use this method to create a link for an invoice. Returns the created invoice link as String on success.

func (*Bot) CreateNewStickerSet

func (b *Bot) CreateNewStickerSet(userId int64, name string, title string, stickers []types.InputSticker, stickerFormat string, opts *CreateNewStickerSetOpts) (bool, error)

Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success.

func (*Bot) DeclineChatJoinRequest

func (b *Bot) DeclineChatJoinRequest(chatId int64, userId int64) (bool, error)

Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.

func (*Bot) DeleteChatPhoto

func (b *Bot) DeleteChatPhoto(chatId int64) (bool, error)

Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

func (*Bot) DeleteChatStickerSet

func (b *Bot) DeleteChatStickerSet(chatId int64) (bool, error)

Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

func (*Bot) DeleteForumTopic

func (b *Bot) DeleteForumTopic(chatId int64, messageThreadId int64) (bool, error)

Use this method to delete 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. Returns True on success.

func (*Bot) DeleteMessage

func (b *Bot) DeleteMessage(chatId int64, messageId int64) (bool, error)

Use this method to delete a message, including service messages, with the following limitations: - A message can only be deleted if it was sent less than 48 hours ago. - Service messages about a supergroup, channel, or forum topic creation can't be deleted. - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there. Returns True on success.

func (*Bot) DeleteMyCommands

func (b *Bot) DeleteMyCommands(opts *DeleteMyCommandsOpts) (bool, error)

Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.

func (*Bot) DeleteStickerFromSet

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

Use this method to delete a sticker from a set created by the bot. Returns True on success.

func (*Bot) DeleteStickerSet

func (b *Bot) DeleteStickerSet(name string) (bool, error)

Use this method to delete a sticker set that was created by the bot. Returns True on success.

func (*Bot) DeleteWebhook

func (b *Bot) DeleteWebhook(opts *DeleteWebhookOpts) (bool, error)

Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.

func (b *Bot) EditChatInviteLink(chatId int64, inviteLink string, opts *EditChatInviteLinkOpts) (*types.ChatInviteLink, error)

Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object.

func (*Bot) EditForumTopic

func (b *Bot) EditForumTopic(chatId int64, messageThreadId int64, opts *EditForumTopicOpts) (bool, error)

Use this method to edit 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. Returns True on success.

func (*Bot) EditGeneralForumTopic

func (b *Bot) EditGeneralForumTopic(chatId int64, name string) (bool, error)

Use this method to edit 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. Returns True on success.

func (*Bot) EditMessageCaption

func (b *Bot) EditMessageCaption(opts *EditMessageCaptionOpts) (*types.Message, error)

Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

func (*Bot) EditMessageLiveLocation

func (b *Bot) EditMessageLiveLocation(latitude float64, longitude float64, opts *EditMessageLiveLocationOpts) (*types.Message, error)

Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

func (*Bot) EditMessageMedia

func (b *Bot) EditMessageMedia(media *types.InputMedia, opts *EditMessageMediaOpts) (*types.Message, error)

Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

func (*Bot) EditMessageReplyMarkup

func (b *Bot) EditMessageReplyMarkup(opts *EditMessageReplyMarkupOpts) (*types.Message, error)

Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

func (*Bot) EditMessageText

func (b *Bot) EditMessageText(text string, opts *EditMessageTextOpts) (*types.Message, error)

Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

func (b *Bot) ExportChatInviteLink(chatId int64) (string, error)

Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.

func (*Bot) ForwardMessage

func (b *Bot) ForwardMessage(chatId int64, fromChatId int64, messageId int64, opts *ForwardMessageOpts) (*types.Message, error)

Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent Message is returned.

func (*Bot) GetChat

func (b *Bot) GetChat(chatId int64) (*types.Chat, error)

Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.

func (*Bot) GetChatAdministrators

func (b *Bot) GetChatAdministrators(chatId int64) ([]types.ChatMember, error)

Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects.

func (*Bot) GetChatMember

func (b *Bot) GetChatMember(chatId int64, userId int64) (*types.ChatMember, error)

Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success.

func (*Bot) GetChatMemberCount

func (b *Bot) GetChatMemberCount(chatId int64) (int64, error)

Use this method to get the number of members in a chat. Returns Int on success.

func (*Bot) GetChatMenuButton

func (b *Bot) GetChatMenuButton(opts *GetChatMenuButtonOpts) (*types.MenuButton, error)

Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.

func (*Bot) GetCustomEmojiStickers

func (b *Bot) GetCustomEmojiStickers(customEmojiIds []string) ([]types.Sticker, error)

Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.

func (*Bot) GetFile

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

Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.

func (*Bot) GetForumTopicIconStickers

func (b *Bot) GetForumTopicIconStickers() ([]types.Sticker, error)

Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.

func (*Bot) GetGameHighScores

func (b *Bot) GetGameHighScores(userId int64, opts *GetGameHighScoresOpts) ([]types.GameHighScore, error)

Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.

func (*Bot) GetMe

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

A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.

func (*Bot) GetMyCommands

func (b *Bot) GetMyCommands(opts *GetMyCommandsOpts) ([]types.BotCommand, error)

Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.

func (*Bot) GetMyDefaultAdministratorRights

func (b *Bot) GetMyDefaultAdministratorRights(opts *GetMyDefaultAdministratorRightsOpts) (*types.ChatAdministratorRights, error)

Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.

func (*Bot) GetMyDescription

func (b *Bot) GetMyDescription(opts *GetMyDescriptionOpts) (*types.BotDescription, error)

Use this method to get the current bot description for the given user language. Returns BotDescription on success.

func (*Bot) GetMyName

func (b *Bot) GetMyName(opts *GetMyNameOpts) (*types.BotName, error)

Use this method to get the current bot name for the given user language. Returns BotName on success.

func (*Bot) GetMyShortDescription

func (b *Bot) GetMyShortDescription(opts *GetMyShortDescriptionOpts) (*types.BotShortDescription, error)

Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.

func (*Bot) GetStickerSet

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

Use this method to get a sticker set. On success, a StickerSet object is returned.

func (*Bot) GetUpdates

func (b *Bot) GetUpdates(opts *GetUpdatesOpts) ([]types.Update, error)

Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.

func (*Bot) GetUserProfilePhotos

func (b *Bot) GetUserProfilePhotos(userId int64, opts *GetUserProfilePhotosOpts) (*types.UserProfilePhotos, error)

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

func (*Bot) GetWebhookInfo

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

Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.

func (*Bot) HideGeneralForumTopic

func (b *Bot) HideGeneralForumTopic(chatId int64) (bool, error)

Use this method to hide 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. Returns True on success.

func (*Bot) LeaveChat

func (b *Bot) LeaveChat(chatId int64) (bool, error)

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.

func (*Bot) LogOut

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

Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.

func (*Bot) NewDispatcher

func (b *Bot) NewDispatcher() *Dispatcher

func (*Bot) PinChatMessage

func (b *Bot) PinChatMessage(chatId int64, messageId int64, opts *PinChatMessageOpts) (bool, error)

Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.

func (*Bot) PromoteChatMember

func (b *Bot) PromoteChatMember(chatId int64, userId int64, opts *PromoteChatMemberOpts) (bool, error)

Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.

func (*Bot) ReopenForumTopic

func (b *Bot) ReopenForumTopic(chatId int64, messageThreadId int64) (bool, error)

Use this method to reopen 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. Returns True on success.

func (*Bot) ReopenGeneralForumTopic

func (b *Bot) ReopenGeneralForumTopic(chatId int64) (bool, error)

Use this method to reopen 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. Returns True on success.

func (*Bot) Request

func (b *Bot) Request(method string, params map[string]string, files map[string]string) (json.RawMessage, error)

func (*Bot) RestrictChatMember

func (b *Bot) RestrictChatMember(chatId int64, userId int64, permissions *types.ChatPermissions, opts *RestrictChatMemberOpts) (bool, error)

Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.

func (b *Bot) RevokeChatInviteLink(chatId int64, inviteLink string) (*types.ChatInviteLink, error)

Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.

func (*Bot) SendAnimation

func (b *Bot) SendAnimation(chatId int64, animation types.InputFile, opts *SendAnimationOpts) (*types.Message, error)

Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.

func (*Bot) SendAudio

func (b *Bot) SendAudio(chatId int64, audio types.InputFile, opts *SendAudioOpts) (*types.Message, error)

Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For sending voice messages, use the sendVoice method instead.

func (*Bot) SendChatAction

func (b *Bot) SendChatAction(chatId int64, action string, opts *SendChatActionOpts) (bool, error)

Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

func (*Bot) SendContact

func (b *Bot) SendContact(chatId int64, phoneNumber string, firstName string, opts *SendContactOpts) (*types.Message, error)

Use this method to send phone contacts. On success, the sent Message is returned.

func (*Bot) SendDice

func (b *Bot) SendDice(chatId int64, opts *SendDiceOpts) (*types.Message, error)

Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.

func (*Bot) SendDocument

func (b *Bot) SendDocument(chatId int64, document types.InputFile, opts *SendDocumentOpts) (*types.Message, error)

Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

func (*Bot) SendGame

func (b *Bot) SendGame(chatId int64, gameShortName string, opts *SendGameOpts) (*types.Message, error)

Use this method to send a game. On success, the sent Message is returned.

func (*Bot) SendInvoice

func (b *Bot) SendInvoice(chatId int64, title string, description string, payload string, providerToken string, currency string, prices []types.LabeledPrice, opts *SendInvoiceOpts) (*types.Message, error)

Use this method to send invoices. On success, the sent Message is returned.

func (*Bot) SendLocation

func (b *Bot) SendLocation(chatId int64, latitude float64, longitude float64, opts *SendLocationOpts) (*types.Message, error)

Use this method to send point on the map. On success, the sent Message is returned.

func (*Bot) SendMediaGroup

func (b *Bot) SendMediaGroup(chatId int64, media []types.InputMediaAudio, opts *SendMediaGroupOpts) ([]types.Message, error)

Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.

func (*Bot) SendMessage

func (b *Bot) SendMessage(chatId int64, text string, opts *SendMessageOpts) (*types.Message, error)

Use this method to send text messages. On success, the sent Message is returned.

func (*Bot) SendPhoto

func (b *Bot) SendPhoto(chatId int64, photo types.InputFile, opts *SendPhotoOpts) (*types.Message, error)

Use this method to send photos. On success, the sent Message is returned.

func (*Bot) SendPoll

func (b *Bot) SendPoll(chatId int64, question string, options []string, opts *SendPollOpts) (*types.Message, error)

Use this method to send a native poll. On success, the sent Message is returned.

func (*Bot) SendSticker

func (b *Bot) SendSticker(chatId int64, sticker types.InputFile, opts *SendStickerOpts) (*types.Message, error)

Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned.

func (*Bot) SendVenue

func (b *Bot) SendVenue(chatId int64, latitude float64, longitude float64, title string, address string, opts *SendVenueOpts) (*types.Message, error)

Use this method to send information about a venue. On success, the sent Message is returned.

func (*Bot) SendVideo

func (b *Bot) SendVideo(chatId int64, video types.InputFile, opts *SendVideoOpts) (*types.Message, error)

Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

func (*Bot) SendVideoNote

func (b *Bot) SendVideoNote(chatId int64, videoNote types.InputFile, opts *SendVideoNoteOpts) (*types.Message, error)

As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.

func (*Bot) SendVoice

func (b *Bot) SendVoice(chatId int64, voice types.InputFile, opts *SendVoiceOpts) (*types.Message, error)

Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

func (*Bot) SetChatAdministratorCustomTitle

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

Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.

func (*Bot) SetChatDescription

func (b *Bot) SetChatDescription(chatId int64, opts *SetChatDescriptionOpts) (bool, error)

Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

func (*Bot) SetChatMenuButton

func (b *Bot) SetChatMenuButton(opts *SetChatMenuButtonOpts) (bool, error)

Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.

func (*Bot) SetChatPermissions

func (b *Bot) SetChatPermissions(chatId int64, permissions *types.ChatPermissions, opts *SetChatPermissionsOpts) (bool, error)

Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.

func (*Bot) SetChatPhoto

func (b *Bot) SetChatPhoto(chatId int64, photo types.InputFile) (bool, error)

Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

func (*Bot) SetChatStickerSet

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

Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

func (*Bot) SetChatTitle

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

Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

func (*Bot) SetCustomEmojiStickerSetThumbnail

func (b *Bot) SetCustomEmojiStickerSetThumbnail(name string, opts *SetCustomEmojiStickerSetThumbnailOpts) (bool, error)

Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.

func (*Bot) SetGameScore

func (b *Bot) SetGameScore(userId int64, score int64, opts *SetGameScoreOpts) (*types.Message, error)

Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.

func (*Bot) SetMyCommands

func (b *Bot) SetMyCommands(commands []types.BotCommand, opts *SetMyCommandsOpts) (bool, error)

Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success.

func (*Bot) SetMyDefaultAdministratorRights

func (b *Bot) SetMyDefaultAdministratorRights(opts *SetMyDefaultAdministratorRightsOpts) (bool, error)

Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success.

func (*Bot) SetMyDescription

func (b *Bot) SetMyDescription(opts *SetMyDescriptionOpts) (bool, error)

Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.

func (*Bot) SetMyName

func (b *Bot) SetMyName(opts *SetMyNameOpts) (bool, error)

Use this method to change the bot's name. Returns True on success.

func (*Bot) SetMyShortDescription

func (b *Bot) SetMyShortDescription(opts *SetMyShortDescriptionOpts) (bool, error)

Use this method to change 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 (*Bot) SetPassportDataErrors

func (b *Bot) SetPassportDataErrors(userId int64, errors []types.PassportElementError) (bool, error)

Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.

func (*Bot) SetStickerEmojiList

func (b *Bot) SetStickerEmojiList(sticker string, emojiList []string) (bool, error)

Use this method to change 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 (*Bot) SetStickerKeywords

func (b *Bot) SetStickerKeywords(sticker string, opts *SetStickerKeywordsOpts) (bool, error)

Use this method to change 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 (*Bot) SetStickerMaskPosition

func (b *Bot) SetStickerMaskPosition(sticker string, opts *SetStickerMaskPositionOpts) (bool, error)

Use this method to change 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 (*Bot) SetStickerPositionInSet

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

Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.

func (*Bot) SetStickerSetThumbnail

func (b *Bot) SetStickerSetThumbnail(name string, userId int64, opts *SetStickerSetThumbnailOpts) (bool, error)

Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success.

func (*Bot) SetStickerSetTitle

func (b *Bot) SetStickerSetTitle(name string, title string) (bool, error)

Use this method to set the title of a created sticker set. Returns True on success.

func (*Bot) SetWebhook

func (b *Bot) SetWebhook(url string, opts *SetWebhookOpts) (bool, error)

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header "X-Telegram-Bot-Api-Secret-Token" with the secret token as content.

func (*Bot) StopMessageLiveLocation

func (b *Bot) StopMessageLiveLocation(opts *StopMessageLiveLocationOpts) (*types.Message, error)

Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.

func (*Bot) StopPoll

func (b *Bot) StopPoll(chatId int64, messageId int64, opts *StopPollOpts) (*types.Poll, error)

Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.

func (*Bot) UnbanChatMember

func (b *Bot) UnbanChatMember(chatId int64, userId int64, opts *UnbanChatMemberOpts) (bool, error)

Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.

func (*Bot) UnbanChatSenderChat

func (b *Bot) UnbanChatSenderChat(chatId int64, senderChatId int64) (bool, error)

Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.

func (*Bot) UnhideGeneralForumTopic

func (b *Bot) UnhideGeneralForumTopic(chatId int64) (bool, error)

Use this method to unhide 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. Returns True on success.

func (*Bot) UnpinAllChatMessages

func (b *Bot) UnpinAllChatMessages(chatId int64) (bool, error)

Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.

func (*Bot) UnpinAllForumTopicMessages

func (b *Bot) UnpinAllForumTopicMessages(chatId int64, messageThreadId int64) (bool, error)

Use this method to clear 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. Returns True on success.

func (*Bot) UnpinChatMessage

func (b *Bot) UnpinChatMessage(chatId int64, opts *UnpinChatMessageOpts) (bool, error)

Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.

func (*Bot) UploadStickerFile

func (b *Bot) UploadStickerFile(userId int64, sticker types.InputFile, stickerFormat string) (*types.File, error)

Use this method to upload a file with a sticker for later use in the createNewStickerSet and addStickerToSet methods (the file can be used multiple times). Returns the uploaded File on success.

type CallbackDispatch

type CallbackDispatch func(b *Bot, m *types.CallbackQuery) error

type CallbackHandlers

type CallbackHandlers struct {
	Function CallbackDispatch
	Filter   filters.FilterResponse
}

type ClientOpts

type ClientOpts struct {
	Client http.Client
}

type CopyMessageOpts

type CopyMessageOpts struct {
	MessageThreadId          int64                 `json:"message_thread_id,omitempty"`
	Caption                  string                `json:"caption,omitempty"`
	ParseMode                string                `json:"parse_mode,omitempty"`
	CaptionEntities          []types.MessageEntity `json:"caption_entities,omitempty"`
	DisableNotification      bool                  `json:"disable_notification,omitempty"`
	ProtectContent           bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

CopyMessage methods's optional params

type CreateChatInviteLinkOpts

type CreateChatInviteLinkOpts struct {
	Name               string `json:"name,omitempty"`
	ExpireDate         int64  `json:"expire_date,omitempty"`
	MemberLimit        int64  `json:"member_limit,omitempty"`
	CreatesJoinRequest bool   `json:"creates_join_request,omitempty"`
}

CreateChatInviteLink methods's optional params

type CreateForumTopicOpts

type CreateForumTopicOpts struct {
	IconColor         int64  `json:"icon_color,omitempty"`
	IconCustomEmojiId string `json:"icon_custom_emoji_id,omitempty"`
}

CreateForumTopic methods's optional params

type CreateInvoiceLinkOpts

type CreateInvoiceLinkOpts struct {
	MaxTipAmount              int64   `json:"max_tip_amount,omitempty"`
	SuggestedTipAmounts       []int64 `json:"suggested_tip_amounts,omitempty"`
	ProviderData              string  `json:"provider_data,omitempty"`
	PhotoUrl                  string  `json:"photo_url,omitempty"`
	PhotoSize                 int64   `json:"photo_size,omitempty"`
	PhotoWidth                int64   `json:"photo_width,omitempty"`
	PhotoHeight               int64   `json:"photo_height,omitempty"`
	NeedName                  bool    `json:"need_name,omitempty"`
	NeedPhoneNumber           bool    `json:"need_phone_number,omitempty"`
	NeedEmail                 bool    `json:"need_email,omitempty"`
	NeedShippingAddress       bool    `json:"need_shipping_address,omitempty"`
	SendPhoneNumberToProvider bool    `json:"send_phone_number_to_provider,omitempty"`
	SendEmailToProvider       bool    `json:"send_email_to_provider,omitempty"`
	IsFlexible                bool    `json:"is_flexible,omitempty"`
}

CreateInvoiceLink methods's optional params

type CreateNewStickerSetOpts

type CreateNewStickerSetOpts struct {
	StickerType     string `json:"sticker_type,omitempty"`
	NeedsRepainting bool   `json:"needs_repainting,omitempty"`
}

CreateNewStickerSet methods's optional params

type DeleteMyCommandsOpts

type DeleteMyCommandsOpts struct {
	Scope        *types.BotCommandScope `json:"scope,omitempty"`
	LanguageCode string                 `json:"language_code,omitempty"`
}

DeleteMyCommands methods's optional params

type DeleteWebhookOpts

type DeleteWebhookOpts struct {
	DropPendingUpdates bool `json:"drop_pending_updates,omitempty"`
}

DeleteWebhook methods's optional params

type Dispatcher

type Dispatcher struct {
	Bot                   *Bot
	IsRunning             bool
	Offset                int64
	MessageHandlers       []MessageHandlers
	CallbackHandlers      []CallbackHandlers
	EditedMessageHandlers []MessageHandlers
}

func (*Dispatcher) AddCallbackHandler

func (d *Dispatcher) AddCallbackHandler(fn CallbackDispatch, filter filters.FilterResponse) error

func (*Dispatcher) AddEditedMessageHandler

func (d *Dispatcher) AddEditedMessageHandler(fn MessageDispatch, filter filters.FilterResponse) error

func (*Dispatcher) AddMessageHandler

func (d *Dispatcher) AddMessageHandler(fn MessageDispatch, filter filters.FilterResponse) error

func (*Dispatcher) Idle

func (d *Dispatcher) Idle()

func (*Dispatcher) Run

func (d *Dispatcher) Run()

func (*Dispatcher) Start

func (d *Dispatcher) Start()

func (*Dispatcher) Stop

func (d *Dispatcher) Stop()

type EditChatInviteLinkOpts

type EditChatInviteLinkOpts struct {
	Name               string `json:"name,omitempty"`
	ExpireDate         int64  `json:"expire_date,omitempty"`
	MemberLimit        int64  `json:"member_limit,omitempty"`
	CreatesJoinRequest bool   `json:"creates_join_request,omitempty"`
}

EditChatInviteLink methods's optional params

type EditForumTopicOpts

type EditForumTopicOpts struct {
	Name              string `json:"name,omitempty"`
	IconCustomEmojiId string `json:"icon_custom_emoji_id,omitempty"`
}

EditForumTopic methods's optional params

type EditMessageCaptionOpts

type EditMessageCaptionOpts struct {
	ChatId          int64                       `json:"chat_id,omitempty"`
	MessageId       int64                       `json:"message_id,omitempty"`
	InlineMessageId string                      `json:"inline_message_id,omitempty"`
	Caption         string                      `json:"caption,omitempty"`
	ParseMode       string                      `json:"parse_mode,omitempty"`
	CaptionEntities []types.MessageEntity       `json:"caption_entities,omitempty"`
	ReplyMarkup     *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageCaption methods's optional params

type EditMessageLiveLocationOpts

type EditMessageLiveLocationOpts struct {
	ChatId               int64                       `json:"chat_id,omitempty"`
	MessageId            int64                       `json:"message_id,omitempty"`
	InlineMessageId      string                      `json:"inline_message_id,omitempty"`
	HorizontalAccuracy   float64                     `json:"horizontal_accuracy,omitempty"`
	Heading              int64                       `json:"heading,omitempty"`
	ProximityAlertRadius int64                       `json:"proximity_alert_radius,omitempty"`
	ReplyMarkup          *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageLiveLocation methods's optional params

type EditMessageMediaOpts

type EditMessageMediaOpts struct {
	ChatId          int64                       `json:"chat_id,omitempty"`
	MessageId       int64                       `json:"message_id,omitempty"`
	InlineMessageId string                      `json:"inline_message_id,omitempty"`
	ReplyMarkup     *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageMedia methods's optional params

type EditMessageReplyMarkupOpts

type EditMessageReplyMarkupOpts struct {
	ChatId          int64                       `json:"chat_id,omitempty"`
	MessageId       int64                       `json:"message_id,omitempty"`
	InlineMessageId string                      `json:"inline_message_id,omitempty"`
	ReplyMarkup     *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageReplyMarkup methods's optional params

type EditMessageTextOpts

type EditMessageTextOpts struct {
	ChatId                int64                       `json:"chat_id,omitempty"`
	MessageId             int64                       `json:"message_id,omitempty"`
	InlineMessageId       string                      `json:"inline_message_id,omitempty"`
	ParseMode             string                      `json:"parse_mode,omitempty"`
	Entities              []types.MessageEntity       `json:"entities,omitempty"`
	DisableWebPagePreview bool                        `json:"disable_web_page_preview,omitempty"`
	ReplyMarkup           *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageText methods's optional params

type FileReader

type FileReader struct {
	FileName string
	File     []byte
}

type ForwardMessageOpts

type ForwardMessageOpts struct {
	MessageThreadId     int64 `json:"message_thread_id,omitempty"`
	DisableNotification bool  `json:"disable_notification,omitempty"`
	ProtectContent      bool  `json:"protect_content,omitempty"`
}

ForwardMessage methods's optional params

type GetChatMenuButtonOpts

type GetChatMenuButtonOpts struct {
	ChatId int64 `json:"chat_id,omitempty"`
}

GetChatMenuButton methods's optional params

type GetGameHighScoresOpts

type GetGameHighScoresOpts struct {
	ChatId          int64  `json:"chat_id,omitempty"`
	MessageId       int64  `json:"message_id,omitempty"`
	InlineMessageId string `json:"inline_message_id,omitempty"`
}

GetGameHighScores methods's optional params

type GetMyCommandsOpts

type GetMyCommandsOpts struct {
	Scope        *types.BotCommandScope `json:"scope,omitempty"`
	LanguageCode string                 `json:"language_code,omitempty"`
}

GetMyCommands methods's optional params

type GetMyDefaultAdministratorRightsOpts

type GetMyDefaultAdministratorRightsOpts struct {
	ForChannels bool `json:"for_channels,omitempty"`
}

GetMyDefaultAdministratorRights methods's optional params

type GetMyDescriptionOpts

type GetMyDescriptionOpts struct {
	LanguageCode string `json:"language_code,omitempty"`
}

GetMyDescription methods's optional params

type GetMyNameOpts

type GetMyNameOpts struct {
	LanguageCode string `json:"language_code,omitempty"`
}

GetMyName methods's optional params

type GetMyShortDescriptionOpts

type GetMyShortDescriptionOpts struct {
	LanguageCode string `json:"language_code,omitempty"`
}

GetMyShortDescription methods's optional params

type GetUpdatesOpts

type GetUpdatesOpts struct {
	Offset         int64    `json:"offset,omitempty"`
	Limit          int64    `json:"limit,omitempty"`
	Timeout        int64    `json:"timeout,omitempty"`
	AllowedUpdates []string `json:"allowed_updates,omitempty"`
}

GetUpdates methods's optional params

type GetUserProfilePhotosOpts

type GetUserProfilePhotosOpts struct {
	Offset int64 `json:"offset,omitempty"`
	Limit  int64 `json:"limit,omitempty"`
}

GetUserProfilePhotos methods's optional params

type MessageDispatch

type MessageDispatch func(b *Bot, m *types.Message) error

type MessageHandlers

type MessageHandlers struct {
	Function MessageDispatch
	Filter   filters.FilterResponse
}

type PinChatMessageOpts

type PinChatMessageOpts struct {
	DisableNotification bool `json:"disable_notification,omitempty"`
}

PinChatMessage methods's optional params

type PromoteChatMemberOpts

type PromoteChatMemberOpts struct {
	IsAnonymous         bool `json:"is_anonymous,omitempty"`
	CanManageChat       bool `json:"can_manage_chat,omitempty"`
	CanPostMessages     bool `json:"can_post_messages,omitempty"`
	CanEditMessages     bool `json:"can_edit_messages,omitempty"`
	CanDeleteMessages   bool `json:"can_delete_messages,omitempty"`
	CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"`
	CanRestrictMembers  bool `json:"can_restrict_members,omitempty"`
	CanPromoteMembers   bool `json:"can_promote_members,omitempty"`
	CanChangeInfo       bool `json:"can_change_info,omitempty"`
	CanInviteUsers      bool `json:"can_invite_users,omitempty"`
	CanPinMessages      bool `json:"can_pin_messages,omitempty"`
	CanManageTopics     bool `json:"can_manage_topics,omitempty"`
}

PromoteChatMember methods's optional params

type Response

type Response struct {
	Ok          bool                      `json:"ok"`
	Result      json.RawMessage           `json:"result"`
	ErrorCode   int                       `json:"error_code"`
	Description string                    `json:"description"`
	Parameters  *types.ResponseParameters `json:"parameters"`
}

type RestrictChatMemberOpts

type RestrictChatMemberOpts struct {
	UseIndependentChatPermissions bool  `json:"use_independent_chat_permissions,omitempty"`
	UntilDate                     int64 `json:"until_date,omitempty"`
}

RestrictChatMember methods's optional params

type SendAnimationOpts

type SendAnimationOpts struct {
	MessageThreadId          int64                 `json:"message_thread_id,omitempty"`
	Duration                 int64                 `json:"duration,omitempty"`
	Width                    int64                 `json:"width,omitempty"`
	Height                   int64                 `json:"height,omitempty"`
	Thumbnail                types.InputFile       `json:"thumbnail,omitempty"`
	Caption                  string                `json:"caption,omitempty"`
	ParseMode                string                `json:"parse_mode,omitempty"`
	CaptionEntities          []types.MessageEntity `json:"caption_entities,omitempty"`
	HasSpoiler               bool                  `json:"has_spoiler,omitempty"`
	DisableNotification      bool                  `json:"disable_notification,omitempty"`
	ProtectContent           bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

SendAnimation methods's optional params

type SendAudioOpts

type SendAudioOpts struct {
	MessageThreadId          int64                 `json:"message_thread_id,omitempty"`
	Caption                  string                `json:"caption,omitempty"`
	ParseMode                string                `json:"parse_mode,omitempty"`
	CaptionEntities          []types.MessageEntity `json:"caption_entities,omitempty"`
	Duration                 int64                 `json:"duration,omitempty"`
	Performer                string                `json:"performer,omitempty"`
	Title                    string                `json:"title,omitempty"`
	Thumbnail                types.InputFile       `json:"thumbnail,omitempty"`
	DisableNotification      bool                  `json:"disable_notification,omitempty"`
	ProtectContent           bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

SendAudio methods's optional params

type SendChatActionOpts

type SendChatActionOpts struct {
	MessageThreadId int64 `json:"message_thread_id,omitempty"`
}

SendChatAction methods's optional params

type SendContactOpts

type SendContactOpts struct {
	MessageThreadId          int64             `json:"message_thread_id,omitempty"`
	LastName                 string            `json:"last_name,omitempty"`
	Vcard                    string            `json:"vcard,omitempty"`
	DisableNotification      bool              `json:"disable_notification,omitempty"`
	ProtectContent           bool              `json:"protect_content,omitempty"`
	ReplyToMessageId         int64             `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool              `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup `json:"reply_markup,omitempty"`
}

SendContact methods's optional params

type SendDiceOpts

type SendDiceOpts struct {
	MessageThreadId          int64             `json:"message_thread_id,omitempty"`
	Emoji                    string            `json:"emoji,omitempty"`
	DisableNotification      bool              `json:"disable_notification,omitempty"`
	ProtectContent           bool              `json:"protect_content,omitempty"`
	ReplyToMessageId         int64             `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool              `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup `json:"reply_markup,omitempty"`
}

SendDice methods's optional params

type SendDocumentOpts

type SendDocumentOpts struct {
	MessageThreadId             int64                 `json:"message_thread_id,omitempty"`
	Thumbnail                   types.InputFile       `json:"thumbnail,omitempty"`
	Caption                     string                `json:"caption,omitempty"`
	ParseMode                   string                `json:"parse_mode,omitempty"`
	CaptionEntities             []types.MessageEntity `json:"caption_entities,omitempty"`
	DisableContentTypeDetection bool                  `json:"disable_content_type_detection,omitempty"`
	DisableNotification         bool                  `json:"disable_notification,omitempty"`
	ProtectContent              bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId            int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply    bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup                 types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

SendDocument methods's optional params

type SendGameOpts

type SendGameOpts struct {
	MessageThreadId          int64                       `json:"message_thread_id,omitempty"`
	DisableNotification      bool                        `json:"disable_notification,omitempty"`
	ProtectContent           bool                        `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                       `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                        `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

SendGame methods's optional params

type SendInvoiceOpts

type SendInvoiceOpts struct {
	MessageThreadId           int64                       `json:"message_thread_id,omitempty"`
	MaxTipAmount              int64                       `json:"max_tip_amount,omitempty"`
	SuggestedTipAmounts       []int64                     `json:"suggested_tip_amounts,omitempty"`
	StartParameter            string                      `json:"start_parameter,omitempty"`
	ProviderData              string                      `json:"provider_data,omitempty"`
	PhotoUrl                  string                      `json:"photo_url,omitempty"`
	PhotoSize                 int64                       `json:"photo_size,omitempty"`
	PhotoWidth                int64                       `json:"photo_width,omitempty"`
	PhotoHeight               int64                       `json:"photo_height,omitempty"`
	NeedName                  bool                        `json:"need_name,omitempty"`
	NeedPhoneNumber           bool                        `json:"need_phone_number,omitempty"`
	NeedEmail                 bool                        `json:"need_email,omitempty"`
	NeedShippingAddress       bool                        `json:"need_shipping_address,omitempty"`
	SendPhoneNumberToProvider bool                        `json:"send_phone_number_to_provider,omitempty"`
	SendEmailToProvider       bool                        `json:"send_email_to_provider,omitempty"`
	IsFlexible                bool                        `json:"is_flexible,omitempty"`
	DisableNotification       bool                        `json:"disable_notification,omitempty"`
	ProtectContent            bool                        `json:"protect_content,omitempty"`
	ReplyToMessageId          int64                       `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply  bool                        `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup               *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

SendInvoice methods's optional params

type SendLocationOpts

type SendLocationOpts struct {
	MessageThreadId          int64             `json:"message_thread_id,omitempty"`
	HorizontalAccuracy       float64           `json:"horizontal_accuracy,omitempty"`
	LivePeriod               int64             `json:"live_period,omitempty"`
	Heading                  int64             `json:"heading,omitempty"`
	ProximityAlertRadius     int64             `json:"proximity_alert_radius,omitempty"`
	DisableNotification      bool              `json:"disable_notification,omitempty"`
	ProtectContent           bool              `json:"protect_content,omitempty"`
	ReplyToMessageId         int64             `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool              `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup `json:"reply_markup,omitempty"`
}

SendLocation methods's optional params

type SendMediaGroupOpts

type SendMediaGroupOpts struct {
	MessageThreadId          int64 `json:"message_thread_id,omitempty"`
	DisableNotification      bool  `json:"disable_notification,omitempty"`
	ProtectContent           bool  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool  `json:"allow_sending_without_reply,omitempty"`
}

SendMediaGroup methods's optional params

type SendMessageOpts

type SendMessageOpts struct {
	MessageThreadId          int64                 `json:"message_thread_id,omitempty"`
	ParseMode                string                `json:"parse_mode,omitempty"`
	Entities                 []types.MessageEntity `json:"entities,omitempty"`
	DisableWebPagePreview    bool                  `json:"disable_web_page_preview,omitempty"`
	DisableNotification      bool                  `json:"disable_notification,omitempty"`
	ProtectContent           bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

SendMessage methods's optional params

type SendPhotoOpts

type SendPhotoOpts struct {
	MessageThreadId          int64                 `json:"message_thread_id,omitempty"`
	Caption                  string                `json:"caption,omitempty"`
	ParseMode                string                `json:"parse_mode,omitempty"`
	CaptionEntities          []types.MessageEntity `json:"caption_entities,omitempty"`
	HasSpoiler               bool                  `json:"has_spoiler,omitempty"`
	DisableNotification      bool                  `json:"disable_notification,omitempty"`
	ProtectContent           bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

SendPhoto methods's optional params

type SendPollOpts

type SendPollOpts struct {
	MessageThreadId          int64                 `json:"message_thread_id,omitempty"`
	IsAnonymous              bool                  `json:"is_anonymous,omitempty"`
	Type                     string                `json:"type,omitempty"`
	AllowsMultipleAnswers    bool                  `json:"allows_multiple_answers,omitempty"`
	CorrectOptionId          int64                 `json:"correct_option_id,omitempty"`
	Explanation              string                `json:"explanation,omitempty"`
	ExplanationParseMode     string                `json:"explanation_parse_mode,omitempty"`
	ExplanationEntities      []types.MessageEntity `json:"explanation_entities,omitempty"`
	OpenPeriod               int64                 `json:"open_period,omitempty"`
	CloseDate                int64                 `json:"close_date,omitempty"`
	IsClosed                 bool                  `json:"is_closed,omitempty"`
	DisableNotification      bool                  `json:"disable_notification,omitempty"`
	ProtectContent           bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

SendPoll methods's optional params

type SendStickerOpts

type SendStickerOpts struct {
	MessageThreadId          int64             `json:"message_thread_id,omitempty"`
	Emoji                    string            `json:"emoji,omitempty"`
	DisableNotification      bool              `json:"disable_notification,omitempty"`
	ProtectContent           bool              `json:"protect_content,omitempty"`
	ReplyToMessageId         int64             `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool              `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup `json:"reply_markup,omitempty"`
}

SendSticker methods's optional params

type SendVenueOpts

type SendVenueOpts struct {
	MessageThreadId          int64             `json:"message_thread_id,omitempty"`
	FoursquareId             string            `json:"foursquare_id,omitempty"`
	FoursquareType           string            `json:"foursquare_type,omitempty"`
	GooglePlaceId            string            `json:"google_place_id,omitempty"`
	GooglePlaceType          string            `json:"google_place_type,omitempty"`
	DisableNotification      bool              `json:"disable_notification,omitempty"`
	ProtectContent           bool              `json:"protect_content,omitempty"`
	ReplyToMessageId         int64             `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool              `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup `json:"reply_markup,omitempty"`
}

SendVenue methods's optional params

type SendVideoNoteOpts

type SendVideoNoteOpts struct {
	MessageThreadId          int64             `json:"message_thread_id,omitempty"`
	Duration                 int64             `json:"duration,omitempty"`
	Length                   int64             `json:"length,omitempty"`
	Thumbnail                types.InputFile   `json:"thumbnail,omitempty"`
	DisableNotification      bool              `json:"disable_notification,omitempty"`
	ProtectContent           bool              `json:"protect_content,omitempty"`
	ReplyToMessageId         int64             `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool              `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup `json:"reply_markup,omitempty"`
}

SendVideoNote methods's optional params

type SendVideoOpts

type SendVideoOpts struct {
	MessageThreadId          int64                 `json:"message_thread_id,omitempty"`
	Duration                 int64                 `json:"duration,omitempty"`
	Width                    int64                 `json:"width,omitempty"`
	Height                   int64                 `json:"height,omitempty"`
	Thumbnail                types.InputFile       `json:"thumbnail,omitempty"`
	Caption                  string                `json:"caption,omitempty"`
	ParseMode                string                `json:"parse_mode,omitempty"`
	CaptionEntities          []types.MessageEntity `json:"caption_entities,omitempty"`
	HasSpoiler               bool                  `json:"has_spoiler,omitempty"`
	SupportsStreaming        bool                  `json:"supports_streaming,omitempty"`
	DisableNotification      bool                  `json:"disable_notification,omitempty"`
	ProtectContent           bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

SendVideo methods's optional params

type SendVoiceOpts

type SendVoiceOpts struct {
	MessageThreadId          int64                 `json:"message_thread_id,omitempty"`
	Caption                  string                `json:"caption,omitempty"`
	ParseMode                string                `json:"parse_mode,omitempty"`
	CaptionEntities          []types.MessageEntity `json:"caption_entities,omitempty"`
	Duration                 int64                 `json:"duration,omitempty"`
	DisableNotification      bool                  `json:"disable_notification,omitempty"`
	ProtectContent           bool                  `json:"protect_content,omitempty"`
	ReplyToMessageId         int64                 `json:"reply_to_message_id,omitempty"`
	AllowSendingWithoutReply bool                  `json:"allow_sending_without_reply,omitempty"`
	ReplyMarkup              types.ReplyMarkup     `json:"reply_markup,omitempty"`
}

SendVoice methods's optional params

type SetChatDescriptionOpts

type SetChatDescriptionOpts struct {
	Description string `json:"description,omitempty"`
}

SetChatDescription methods's optional params

type SetChatMenuButtonOpts

type SetChatMenuButtonOpts struct {
	ChatId     int64             `json:"chat_id,omitempty"`
	MenuButton *types.MenuButton `json:"menu_button,omitempty"`
}

SetChatMenuButton methods's optional params

type SetChatPermissionsOpts

type SetChatPermissionsOpts struct {
	UseIndependentChatPermissions bool `json:"use_independent_chat_permissions,omitempty"`
}

SetChatPermissions methods's optional params

type SetCustomEmojiStickerSetThumbnailOpts

type SetCustomEmojiStickerSetThumbnailOpts struct {
	CustomEmojiId string `json:"custom_emoji_id,omitempty"`
}

SetCustomEmojiStickerSetThumbnail methods's optional params

type SetGameScoreOpts

type SetGameScoreOpts struct {
	Force              bool   `json:"force,omitempty"`
	DisableEditMessage bool   `json:"disable_edit_message,omitempty"`
	ChatId             int64  `json:"chat_id,omitempty"`
	MessageId          int64  `json:"message_id,omitempty"`
	InlineMessageId    string `json:"inline_message_id,omitempty"`
}

SetGameScore methods's optional params

type SetMyCommandsOpts

type SetMyCommandsOpts struct {
	Scope        *types.BotCommandScope `json:"scope,omitempty"`
	LanguageCode string                 `json:"language_code,omitempty"`
}

SetMyCommands methods's optional params

type SetMyDefaultAdministratorRightsOpts

type SetMyDefaultAdministratorRightsOpts struct {
	Rights      *types.ChatAdministratorRights `json:"rights,omitempty"`
	ForChannels bool                           `json:"for_channels,omitempty"`
}

SetMyDefaultAdministratorRights methods's optional params

type SetMyDescriptionOpts

type SetMyDescriptionOpts struct {
	Description  string `json:"description,omitempty"`
	LanguageCode string `json:"language_code,omitempty"`
}

SetMyDescription methods's optional params

type SetMyNameOpts

type SetMyNameOpts struct {
	Name         string `json:"name,omitempty"`
	LanguageCode string `json:"language_code,omitempty"`
}

SetMyName methods's optional params

type SetMyShortDescriptionOpts

type SetMyShortDescriptionOpts struct {
	ShortDescription string `json:"short_description,omitempty"`
	LanguageCode     string `json:"language_code,omitempty"`
}

SetMyShortDescription methods's optional params

type SetStickerKeywordsOpts

type SetStickerKeywordsOpts struct {
	Keywords []string `json:"keywords,omitempty"`
}

SetStickerKeywords methods's optional params

type SetStickerMaskPositionOpts

type SetStickerMaskPositionOpts struct {
	MaskPosition *types.MaskPosition `json:"mask_position,omitempty"`
}

SetStickerMaskPosition methods's optional params

type SetStickerSetThumbnailOpts

type SetStickerSetThumbnailOpts struct {
	Thumbnail types.InputFile `json:"thumbnail,omitempty"`
}

SetStickerSetThumbnail methods's optional params

type SetWebhookOpts

type SetWebhookOpts struct {
	Certificate        types.InputFile `json:"certificate,omitempty"`
	IpAddress          string          `json:"ip_address,omitempty"`
	MaxConnections     int64           `json:"max_connections,omitempty"`
	AllowedUpdates     []string        `json:"allowed_updates,omitempty"`
	DropPendingUpdates bool            `json:"drop_pending_updates,omitempty"`
	SecretToken        string          `json:"secret_token,omitempty"`
}

SetWebhook methods's optional params

type StopMessageLiveLocationOpts

type StopMessageLiveLocationOpts struct {
	ChatId          int64                       `json:"chat_id,omitempty"`
	MessageId       int64                       `json:"message_id,omitempty"`
	InlineMessageId string                      `json:"inline_message_id,omitempty"`
	ReplyMarkup     *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

StopMessageLiveLocation methods's optional params

type StopPollOpts

type StopPollOpts struct {
	ReplyMarkup *types.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

StopPoll methods's optional params

type UnbanChatMemberOpts

type UnbanChatMemberOpts struct {
	OnlyIfBanned bool `json:"only_if_banned,omitempty"`
}

UnbanChatMember methods's optional params

type UnpinChatMessageOpts

type UnpinChatMessageOpts struct {
	MessageId int64 `json:"message_id,omitempty"`
}

UnpinChatMessage methods's optional params

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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