Documentation
¶
Overview ¶
Package teleiq is a client for the Telegram Bot API.
Example (ParseModeHTML) ¶
Text sent with ParseModeHTML is escaped with html.EscapeString from the standard library.
package main
import (
"fmt"
"html"
)
func main() {
fmt.Println("<b>Welcome,</b> " + html.EscapeString(`<Tom & "Jerry">`))
}
Output: <b>Welcome,</b> <Tom & "Jerry">
Index ¶
- Constants
- Variables
- func EscapeMarkdown(s string) string
- func Ptr[T any](v T) *T
- type AddStickerToSetParams
- type AnswerCallbackQueryParams
- type AnswerChatJoinRequestQueryParams
- type AnswerGuestQueryParams
- type AnswerInlineQueryParams
- type AnswerPreCheckoutQueryParams
- type AnswerShippingQueryParams
- type AnswerWebAppQueryParams
- type ApproveChatJoinRequestParams
- type ApproveSuggestedPostParams
- type Backoff
- type BanChatMemberParams
- type BanChatSenderChatParams
- type Client
- func (c *Client) AddStickerToSet(ctx context.Context, params AddStickerToSetParams) error
- func (c *Client) AnswerCallbackQuery(ctx context.Context, params AnswerCallbackQueryParams) error
- func (c *Client) AnswerChatJoinRequestQuery(ctx context.Context, params AnswerChatJoinRequestQueryParams) error
- func (c *Client) AnswerGuestQuery(ctx context.Context, params AnswerGuestQueryParams) (*models.SentGuestMessage, error)
- func (c *Client) AnswerInlineQuery(ctx context.Context, params AnswerInlineQueryParams) error
- func (c *Client) AnswerPreCheckoutQuery(ctx context.Context, params AnswerPreCheckoutQueryParams) error
- func (c *Client) AnswerShippingQuery(ctx context.Context, params AnswerShippingQueryParams) error
- func (c *Client) AnswerWebAppQuery(ctx context.Context, params AnswerWebAppQueryParams) (*models.SentWebAppMessage, error)
- func (c *Client) ApproveChatJoinRequest(ctx context.Context, params ApproveChatJoinRequestParams) error
- func (c *Client) ApproveSuggestedPost(ctx context.Context, params ApproveSuggestedPostParams) error
- func (c *Client) BanChatMember(ctx context.Context, params BanChatMemberParams) error
- func (c *Client) BanChatSenderChat(ctx context.Context, params BanChatSenderChatParams) error
- func (c *Client) Call(ctx context.Context, method string, params, result any) error
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) CloseForumTopic(ctx context.Context, params CloseForumTopicParams) error
- func (c *Client) CloseGeneralForumTopic(ctx context.Context, params CloseGeneralForumTopicParams) error
- func (c *Client) ConvertGiftToStars(ctx context.Context, params ConvertGiftToStarsParams) error
- func (c *Client) CopyMessage(ctx context.Context, params CopyMessageParams) (*models.MessageId, error)
- func (c *Client) CopyMessages(ctx context.Context, params CopyMessagesParams) ([]models.MessageId, error)
- func (c *Client) CreateChatInviteLink(ctx context.Context, params CreateChatInviteLinkParams) (*models.ChatInviteLink, error)
- func (c *Client) CreateChatSubscriptionInviteLink(ctx context.Context, params CreateChatSubscriptionInviteLinkParams) (*models.ChatInviteLink, error)
- func (c *Client) CreateForumTopic(ctx context.Context, params CreateForumTopicParams) (*models.ForumTopic, error)
- func (c *Client) CreateInvoiceLink(ctx context.Context, params CreateInvoiceLinkParams) (string, error)
- func (c *Client) CreateNewStickerSet(ctx context.Context, params CreateNewStickerSetParams) error
- func (c *Client) DeclineChatJoinRequest(ctx context.Context, params DeclineChatJoinRequestParams) error
- func (c *Client) DeclineSuggestedPost(ctx context.Context, params DeclineSuggestedPostParams) error
- func (c *Client) DeleteAllMessageReactions(ctx context.Context, params DeleteAllMessageReactionsParams) error
- func (c *Client) DeleteBusinessMessages(ctx context.Context, params DeleteBusinessMessagesParams) error
- func (c *Client) DeleteChatPhoto(ctx context.Context, params DeleteChatPhotoParams) error
- func (c *Client) DeleteChatStickerSet(ctx context.Context, params DeleteChatStickerSetParams) error
- func (c *Client) DeleteEphemeralMessage(ctx context.Context, params DeleteEphemeralMessageParams) error
- func (c *Client) DeleteForumTopic(ctx context.Context, params DeleteForumTopicParams) error
- func (c *Client) DeleteMessage(ctx context.Context, params DeleteMessageParams) error
- func (c *Client) DeleteMessageReaction(ctx context.Context, params DeleteMessageReactionParams) error
- func (c *Client) DeleteMessages(ctx context.Context, params DeleteMessagesParams) error
- func (c *Client) DeleteMyCommands(ctx context.Context, params DeleteMyCommandsParams) error
- func (c *Client) DeleteStickerFromSet(ctx context.Context, params DeleteStickerFromSetParams) error
- func (c *Client) DeleteStickerSet(ctx context.Context, params DeleteStickerSetParams) error
- func (c *Client) DeleteStory(ctx context.Context, params DeleteStoryParams) error
- func (c *Client) DeleteWebhook(ctx context.Context, params DeleteWebhookParams) error
- func (c *Client) Download(ctx context.Context, filePath string, dst io.Writer) error
- func (c *Client) EditChatInviteLink(ctx context.Context, params EditChatInviteLinkParams) (*models.ChatInviteLink, error)
- func (c *Client) EditChatSubscriptionInviteLink(ctx context.Context, params EditChatSubscriptionInviteLinkParams) (*models.ChatInviteLink, error)
- func (c *Client) EditEphemeralMessageCaption(ctx context.Context, params EditEphemeralMessageCaptionParams) error
- func (c *Client) EditEphemeralMessageMedia(ctx context.Context, params EditEphemeralMessageMediaParams) error
- func (c *Client) EditEphemeralMessageReplyMarkup(ctx context.Context, params EditEphemeralMessageReplyMarkupParams) error
- func (c *Client) EditEphemeralMessageText(ctx context.Context, params EditEphemeralMessageTextParams) error
- func (c *Client) EditForumTopic(ctx context.Context, params EditForumTopicParams) error
- func (c *Client) EditGeneralForumTopic(ctx context.Context, params EditGeneralForumTopicParams) error
- func (c *Client) EditMessageCaption(ctx context.Context, params EditMessageCaptionParams) (*models.Message, error)
- func (c *Client) EditMessageChecklist(ctx context.Context, params EditMessageChecklistParams) (*models.Message, error)
- func (c *Client) EditMessageLiveLocation(ctx context.Context, params EditMessageLiveLocationParams) (*models.Message, error)
- func (c *Client) EditMessageMedia(ctx context.Context, params EditMessageMediaParams) (*models.Message, error)
- func (c *Client) EditMessageReplyMarkup(ctx context.Context, params EditMessageReplyMarkupParams) (*models.Message, error)
- func (c *Client) EditMessageText(ctx context.Context, params EditMessageTextParams) (*models.Message, error)
- func (c *Client) EditStory(ctx context.Context, params EditStoryParams) (*models.Story, error)
- func (c *Client) EditUserStarSubscription(ctx context.Context, params EditUserStarSubscriptionParams) error
- func (c *Client) ExportChatInviteLink(ctx context.Context, params ExportChatInviteLinkParams) (string, error)
- func (c *Client) ForwardMessage(ctx context.Context, params ForwardMessageParams) (*models.Message, error)
- func (c *Client) ForwardMessages(ctx context.Context, params ForwardMessagesParams) ([]models.MessageId, error)
- func (c *Client) GetAvailableGifts(ctx context.Context) (*models.Gifts, error)
- func (c *Client) GetBusinessAccountGifts(ctx context.Context, params GetBusinessAccountGiftsParams) (*models.OwnedGifts, error)
- func (c *Client) GetBusinessAccountStarBalance(ctx context.Context, params GetBusinessAccountStarBalanceParams) (*models.StarAmount, error)
- func (c *Client) GetBusinessConnection(ctx context.Context, params GetBusinessConnectionParams) (*models.BusinessConnection, error)
- func (c *Client) GetChat(ctx context.Context, params GetChatParams) (*models.ChatFullInfo, error)
- func (c *Client) GetChatAdministrators(ctx context.Context, params GetChatAdministratorsParams) ([]models.ChatMember, error)
- func (c *Client) GetChatGifts(ctx context.Context, params GetChatGiftsParams) (*models.OwnedGifts, error)
- func (c *Client) GetChatMember(ctx context.Context, params GetChatMemberParams) (models.ChatMember, error)
- func (c *Client) GetChatMemberCount(ctx context.Context, params GetChatMemberCountParams) (int, error)
- func (c *Client) GetChatMenuButton(ctx context.Context, params GetChatMenuButtonParams) (models.MenuButton, error)
- func (c *Client) GetCustomEmojiStickers(ctx context.Context, params GetCustomEmojiStickersParams) ([]models.Sticker, error)
- func (c *Client) GetFile(ctx context.Context, params GetFileParams) (*models.File, error)
- func (c *Client) GetForumTopicIconStickers(ctx context.Context) ([]models.Sticker, error)
- func (c *Client) GetGameHighScores(ctx context.Context, params GetGameHighScoresParams) ([]models.GameHighScore, error)
- func (c *Client) GetManagedBotAccessSettings(ctx context.Context, params GetManagedBotAccessSettingsParams) (*models.BotAccessSettings, error)
- func (c *Client) GetManagedBotToken(ctx context.Context, params GetManagedBotTokenParams) (string, error)
- func (c *Client) GetMe(ctx context.Context) (*models.User, error)
- func (c *Client) GetMyCommands(ctx context.Context, params GetMyCommandsParams) ([]models.BotCommand, error)
- func (c *Client) GetMyDefaultAdministratorRights(ctx context.Context, params GetMyDefaultAdministratorRightsParams) (*models.ChatAdministratorRights, error)
- func (c *Client) GetMyDescription(ctx context.Context, params GetMyDescriptionParams) (*models.BotDescription, error)
- func (c *Client) GetMyName(ctx context.Context, params GetMyNameParams) (*models.BotName, error)
- func (c *Client) GetMyShortDescription(ctx context.Context, params GetMyShortDescriptionParams) (*models.BotShortDescription, error)
- func (c *Client) GetMyStarBalance(ctx context.Context) (*models.StarAmount, error)
- func (c *Client) GetStarTransactions(ctx context.Context, params GetStarTransactionsParams) (*models.StarTransactions, error)
- func (c *Client) GetStickerSet(ctx context.Context, params GetStickerSetParams) (*models.StickerSet, error)
- func (c *Client) GetUpdates(ctx context.Context, params GetUpdatesParams) ([]models.Update, error)
- func (c *Client) GetUserChatBoosts(ctx context.Context, params GetUserChatBoostsParams) (*models.UserChatBoosts, error)
- func (c *Client) GetUserGifts(ctx context.Context, params GetUserGiftsParams) (*models.OwnedGifts, error)
- func (c *Client) GetUserPersonalChatMessages(ctx context.Context, params GetUserPersonalChatMessagesParams) ([]models.Message, error)
- func (c *Client) GetUserProfileAudios(ctx context.Context, params GetUserProfileAudiosParams) (*models.UserProfileAudios, error)
- func (c *Client) GetUserProfilePhotos(ctx context.Context, params GetUserProfilePhotosParams) (*models.UserProfilePhotos, error)
- func (c *Client) GetWebhookInfo(ctx context.Context) (*models.WebhookInfo, error)
- func (c *Client) GiftPremiumSubscription(ctx context.Context, params GiftPremiumSubscriptionParams) error
- func (c *Client) HideGeneralForumTopic(ctx context.Context, params HideGeneralForumTopicParams) error
- func (c *Client) LeaveChat(ctx context.Context, params LeaveChatParams) error
- func (c *Client) LogOut(ctx context.Context) error
- func (c *Client) PinChatMessage(ctx context.Context, params PinChatMessageParams) error
- func (c *Client) PostStory(ctx context.Context, params PostStoryParams) (*models.Story, error)
- func (c *Client) PromoteChatMember(ctx context.Context, params PromoteChatMemberParams) error
- func (c *Client) ReadBusinessMessage(ctx context.Context, params ReadBusinessMessageParams) error
- func (c *Client) RefundStarPayment(ctx context.Context, params RefundStarPaymentParams) error
- func (c *Client) RemoveBusinessAccountProfilePhoto(ctx context.Context, params RemoveBusinessAccountProfilePhotoParams) error
- func (c *Client) RemoveChatVerification(ctx context.Context, params RemoveChatVerificationParams) error
- func (c *Client) RemoveMyProfilePhoto(ctx context.Context) error
- func (c *Client) RemoveUserVerification(ctx context.Context, params RemoveUserVerificationParams) error
- func (c *Client) ReopenForumTopic(ctx context.Context, params ReopenForumTopicParams) error
- func (c *Client) ReopenGeneralForumTopic(ctx context.Context, params ReopenGeneralForumTopicParams) error
- func (c *Client) ReplaceManagedBotToken(ctx context.Context, params ReplaceManagedBotTokenParams) (string, error)
- func (c *Client) ReplaceStickerInSet(ctx context.Context, params ReplaceStickerInSetParams) error
- func (c *Client) RepostStory(ctx context.Context, params RepostStoryParams) (*models.Story, error)
- func (c *Client) RestrictChatMember(ctx context.Context, params RestrictChatMemberParams) error
- func (c *Client) RevokeChatInviteLink(ctx context.Context, params RevokeChatInviteLinkParams) (*models.ChatInviteLink, error)
- func (c *Client) SavePreparedInlineMessage(ctx context.Context, params SavePreparedInlineMessageParams) (*models.PreparedInlineMessage, error)
- func (c *Client) SavePreparedKeyboardButton(ctx context.Context, params SavePreparedKeyboardButtonParams) (*models.PreparedKeyboardButton, error)
- func (c *Client) SendAnimation(ctx context.Context, params SendAnimationParams) (*models.Message, error)
- func (c *Client) SendAudio(ctx context.Context, params SendAudioParams) (*models.Message, error)
- func (c *Client) SendChatAction(ctx context.Context, params SendChatActionParams) error
- func (c *Client) SendChatJoinRequestWebApp(ctx context.Context, params SendChatJoinRequestWebAppParams) error
- func (c *Client) SendChecklist(ctx context.Context, params SendChecklistParams) (*models.Message, error)
- func (c *Client) SendContact(ctx context.Context, params SendContactParams) (*models.Message, error)
- func (c *Client) SendDice(ctx context.Context, params SendDiceParams) (*models.Message, error)
- func (c *Client) SendDocument(ctx context.Context, params SendDocumentParams) (*models.Message, error)
- func (c *Client) SendGame(ctx context.Context, params SendGameParams) (*models.Message, error)
- func (c *Client) SendGift(ctx context.Context, params SendGiftParams) error
- func (c *Client) SendInvoice(ctx context.Context, params SendInvoiceParams) (*models.Message, error)
- func (c *Client) SendLivePhoto(ctx context.Context, params SendLivePhotoParams) (*models.Message, error)
- func (c *Client) SendLocation(ctx context.Context, params SendLocationParams) (*models.Message, error)
- func (c *Client) SendMediaGroup(ctx context.Context, params SendMediaGroupParams) ([]models.Message, error)
- func (c *Client) SendMessage(ctx context.Context, params SendMessageParams) (*models.Message, error)
- func (c *Client) SendMessageDraft(ctx context.Context, params SendMessageDraftParams) error
- func (c *Client) SendPaidMedia(ctx context.Context, params SendPaidMediaParams) (*models.Message, error)
- func (c *Client) SendPhoto(ctx context.Context, params SendPhotoParams) (*models.Message, error)
- func (c *Client) SendPoll(ctx context.Context, params SendPollParams) (*models.Message, error)
- func (c *Client) SendRichMessage(ctx context.Context, params SendRichMessageParams) (*models.Message, error)
- func (c *Client) SendRichMessageDraft(ctx context.Context, params SendRichMessageDraftParams) error
- func (c *Client) SendSticker(ctx context.Context, params SendStickerParams) (*models.Message, error)
- func (c *Client) SendVenue(ctx context.Context, params SendVenueParams) (*models.Message, error)
- func (c *Client) SendVideo(ctx context.Context, params SendVideoParams) (*models.Message, error)
- func (c *Client) SendVideoNote(ctx context.Context, params SendVideoNoteParams) (*models.Message, error)
- func (c *Client) SendVoice(ctx context.Context, params SendVoiceParams) (*models.Message, error)
- func (c *Client) SetBusinessAccountBio(ctx context.Context, params SetBusinessAccountBioParams) error
- func (c *Client) SetBusinessAccountGiftSettings(ctx context.Context, params SetBusinessAccountGiftSettingsParams) error
- func (c *Client) SetBusinessAccountName(ctx context.Context, params SetBusinessAccountNameParams) error
- func (c *Client) SetBusinessAccountProfilePhoto(ctx context.Context, params SetBusinessAccountProfilePhotoParams) error
- func (c *Client) SetBusinessAccountUsername(ctx context.Context, params SetBusinessAccountUsernameParams) error
- func (c *Client) SetChatAdministratorCustomTitle(ctx context.Context, params SetChatAdministratorCustomTitleParams) error
- func (c *Client) SetChatDescription(ctx context.Context, params SetChatDescriptionParams) error
- func (c *Client) SetChatMemberTag(ctx context.Context, params SetChatMemberTagParams) error
- func (c *Client) SetChatMenuButton(ctx context.Context, params SetChatMenuButtonParams) error
- func (c *Client) SetChatPermissions(ctx context.Context, params SetChatPermissionsParams) error
- func (c *Client) SetChatPhoto(ctx context.Context, params SetChatPhotoParams) error
- func (c *Client) SetChatStickerSet(ctx context.Context, params SetChatStickerSetParams) error
- func (c *Client) SetChatTitle(ctx context.Context, params SetChatTitleParams) error
- func (c *Client) SetCustomEmojiStickerSetThumbnail(ctx context.Context, params SetCustomEmojiStickerSetThumbnailParams) error
- func (c *Client) SetGameScore(ctx context.Context, params SetGameScoreParams) (*models.Message, error)
- func (c *Client) SetManagedBotAccessSettings(ctx context.Context, params SetManagedBotAccessSettingsParams) error
- func (c *Client) SetMessageReaction(ctx context.Context, params SetMessageReactionParams) error
- func (c *Client) SetMyCommands(ctx context.Context, params SetMyCommandsParams) error
- func (c *Client) SetMyDefaultAdministratorRights(ctx context.Context, params SetMyDefaultAdministratorRightsParams) error
- func (c *Client) SetMyDescription(ctx context.Context, params SetMyDescriptionParams) error
- func (c *Client) SetMyName(ctx context.Context, params SetMyNameParams) error
- func (c *Client) SetMyProfilePhoto(ctx context.Context, params SetMyProfilePhotoParams) error
- func (c *Client) SetMyShortDescription(ctx context.Context, params SetMyShortDescriptionParams) error
- func (c *Client) SetPassportDataErrors(ctx context.Context, params SetPassportDataErrorsParams) error
- func (c *Client) SetStickerEmojiList(ctx context.Context, params SetStickerEmojiListParams) error
- func (c *Client) SetStickerKeywords(ctx context.Context, params SetStickerKeywordsParams) error
- func (c *Client) SetStickerMaskPosition(ctx context.Context, params SetStickerMaskPositionParams) error
- func (c *Client) SetStickerPositionInSet(ctx context.Context, params SetStickerPositionInSetParams) error
- func (c *Client) SetStickerSetThumbnail(ctx context.Context, params SetStickerSetThumbnailParams) error
- func (c *Client) SetStickerSetTitle(ctx context.Context, params SetStickerSetTitleParams) error
- func (c *Client) SetUserEmojiStatus(ctx context.Context, params SetUserEmojiStatusParams) error
- func (c *Client) SetWebhook(ctx context.Context, params SetWebhookParams) error
- func (c *Client) StopMessageLiveLocation(ctx context.Context, params StopMessageLiveLocationParams) (*models.Message, error)
- func (c *Client) StopPoll(ctx context.Context, params StopPollParams) (*models.Poll, error)
- func (c *Client) TransferBusinessAccountStars(ctx context.Context, params TransferBusinessAccountStarsParams) error
- func (c *Client) TransferGift(ctx context.Context, params TransferGiftParams) error
- func (c *Client) UnbanChatMember(ctx context.Context, params UnbanChatMemberParams) error
- func (c *Client) UnbanChatSenderChat(ctx context.Context, params UnbanChatSenderChatParams) error
- func (c *Client) UnhideGeneralForumTopic(ctx context.Context, params UnhideGeneralForumTopicParams) error
- func (c *Client) UnpinAllChatMessages(ctx context.Context, params UnpinAllChatMessagesParams) error
- func (c *Client) UnpinAllForumTopicMessages(ctx context.Context, params UnpinAllForumTopicMessagesParams) error
- func (c *Client) UnpinAllGeneralForumTopicMessages(ctx context.Context, params UnpinAllGeneralForumTopicMessagesParams) error
- func (c *Client) UnpinChatMessage(ctx context.Context, params UnpinChatMessageParams) error
- func (c *Client) UpgradeGift(ctx context.Context, params UpgradeGiftParams) error
- func (c *Client) UploadStickerFile(ctx context.Context, params UploadStickerFileParams) (*models.File, error)
- func (c *Client) VerifyChat(ctx context.Context, params VerifyChatParams) error
- func (c *Client) VerifyUser(ctx context.Context, params VerifyUserParams) error
- type CloseForumTopicParams
- type CloseGeneralForumTopicParams
- type ConvertGiftToStarsParams
- type CopyMessageParams
- type CopyMessagesParams
- type CreateChatInviteLinkParams
- type CreateChatSubscriptionInviteLinkParams
- type CreateForumTopicParams
- type CreateInvoiceLinkParams
- type CreateNewStickerSetParams
- type DeclineChatJoinRequestParams
- type DeclineSuggestedPostParams
- type Defaults
- type DeleteAllMessageReactionsParams
- type DeleteBusinessMessagesParams
- type DeleteChatPhotoParams
- type DeleteChatStickerSetParams
- type DeleteEphemeralMessageParams
- type DeleteForumTopicParams
- type DeleteMessageParams
- type DeleteMessageReactionParams
- type DeleteMessagesParams
- type DeleteMyCommandsParams
- type DeleteStickerFromSetParams
- type DeleteStickerSetParams
- type DeleteStoryParams
- type DeleteWebhookParams
- type EditChatInviteLinkParams
- type EditChatSubscriptionInviteLinkParams
- type EditEphemeralMessageCaptionParams
- type EditEphemeralMessageMediaParams
- type EditEphemeralMessageReplyMarkupParams
- type EditEphemeralMessageTextParams
- type EditForumTopicParams
- type EditGeneralForumTopicParams
- type EditMessageCaptionParams
- type EditMessageChecklistParams
- type EditMessageLiveLocationParams
- type EditMessageMediaParams
- type EditMessageReplyMarkupParams
- type EditMessageTextParams
- type EditStoryParams
- type EditUserStarSubscriptionParams
- type Error
- type ExportChatInviteLinkParams
- type ForwardMessageParams
- type ForwardMessagesParams
- type GetBusinessAccountGiftsParams
- type GetBusinessAccountStarBalanceParams
- type GetBusinessConnectionParams
- type GetChatAdministratorsParams
- type GetChatGiftsParams
- type GetChatMemberCountParams
- type GetChatMemberParams
- type GetChatMenuButtonParams
- type GetChatParams
- type GetCustomEmojiStickersParams
- type GetFileParams
- type GetGameHighScoresParams
- type GetManagedBotAccessSettingsParams
- type GetManagedBotTokenParams
- type GetMyCommandsParams
- type GetMyDefaultAdministratorRightsParams
- type GetMyDescriptionParams
- type GetMyNameParams
- type GetMyShortDescriptionParams
- type GetStarTransactionsParams
- type GetStickerSetParams
- type GetUpdatesParams
- type GetUserChatBoostsParams
- type GetUserGiftsParams
- type GetUserPersonalChatMessagesParams
- type GetUserProfileAudiosParams
- type GetUserProfilePhotosParams
- type GiftPremiumSubscriptionParams
- type HideGeneralForumTopicParams
- type LeaveChatParams
- type Option
- func WithBaseURL(rawURL string) Option
- func WithDefaultTimeout(d time.Duration) Option
- func WithDefaults(d Defaults) Option
- func WithHTTPClient(c *http.Client) Option
- func WithLogger(l *slog.Logger) Option
- func WithRateLimiter(l RateLimiter) Option
- func WithRetryPolicy(p RetryPolicy) Option
- func WithTransport(t Transport) Option
- type PinChatMessageParams
- type PostStoryParams
- type PromoteChatMemberParams
- type RateLimiter
- type ReadBusinessMessageParams
- type RefundStarPaymentParams
- type RemoveBusinessAccountProfilePhotoParams
- type RemoveChatVerificationParams
- type RemoveUserVerificationParams
- type ReopenForumTopicParams
- type ReopenGeneralForumTopicParams
- type ReplaceManagedBotTokenParams
- type ReplaceStickerInSetParams
- type RepostStoryParams
- type Request
- type Response
- type RestrictChatMemberParams
- type RetryPolicy
- type RevokeChatInviteLinkParams
- type SavePreparedInlineMessageParams
- type SavePreparedKeyboardButtonParams
- type SendAnimationParams
- type SendAudioParams
- type SendChatActionParams
- type SendChatJoinRequestWebAppParams
- type SendChecklistParams
- type SendContactParams
- type SendDiceParams
- type SendDocumentParams
- type SendGameParams
- type SendGiftParams
- type SendInvoiceParams
- type SendLivePhotoParams
- type SendLocationParams
- type SendMediaGroupParams
- type SendMessageDraftParams
- type SendMessageParams
- type SendPaidMediaParams
- type SendPhotoParams
- type SendPollParams
- type SendRichMessageDraftParams
- type SendRichMessageParams
- type SendStickerParams
- type SendVenueParams
- type SendVideoNoteParams
- type SendVideoParams
- type SendVoiceParams
- type SetBusinessAccountBioParams
- type SetBusinessAccountGiftSettingsParams
- type SetBusinessAccountNameParams
- type SetBusinessAccountProfilePhotoParams
- type SetBusinessAccountUsernameParams
- type SetChatAdministratorCustomTitleParams
- type SetChatDescriptionParams
- type SetChatMemberTagParams
- type SetChatMenuButtonParams
- type SetChatPermissionsParams
- type SetChatPhotoParams
- type SetChatStickerSetParams
- type SetChatTitleParams
- type SetCustomEmojiStickerSetThumbnailParams
- type SetGameScoreParams
- type SetManagedBotAccessSettingsParams
- type SetMessageReactionParams
- type SetMyCommandsParams
- type SetMyDefaultAdministratorRightsParams
- type SetMyDescriptionParams
- type SetMyNameParams
- type SetMyProfilePhotoParams
- type SetMyShortDescriptionParams
- type SetPassportDataErrorsParams
- type SetStickerEmojiListParams
- type SetStickerKeywordsParams
- type SetStickerMaskPositionParams
- type SetStickerPositionInSetParams
- type SetStickerSetThumbnailParams
- type SetStickerSetTitleParams
- type SetUserEmojiStatusParams
- type SetWebhookParams
- type StopMessageLiveLocationParams
- type StopPollParams
- type TransferBusinessAccountStarsParams
- type TransferGiftParams
- type Transport
- type TransportFunc
- type UnbanChatMemberParams
- type UnbanChatSenderChatParams
- type UnhideGeneralForumTopicParams
- type UnpinAllChatMessagesParams
- type UnpinAllForumTopicMessagesParams
- type UnpinAllGeneralForumTopicMessagesParams
- type UnpinChatMessageParams
- type UpgradeGiftParams
- type UploadStickerFileParams
- type VerifyChatParams
- type VerifyUserParams
Examples ¶
Constants ¶
const ( ParseModeHTML = "HTML" ParseModeMarkdown = "MarkdownV2" )
Parse modes for the ParseMode fields: HTML and Telegram's MarkdownV2.
const SupportedBotAPIVersion = "10.3"
SupportedBotAPIVersion is the Telegram Bot API version that this package implements.
Variables ¶
var ( // ErrInvalidToken reports a bot token that is clearly malformed. ErrInvalidToken = errors.New("teleiq: invalid bot token") ErrUnauthorized = errors.New("teleiq: unauthorized") // ErrForbidden matches an *Error for an action the bot may not take (403). ErrForbidden = errors.New("teleiq: forbidden") // ErrConflict matches an *Error for a competing getUpdates call or webhook (409). ErrConflict = errors.New("teleiq: conflict") // ErrTooManyRequests matches an *Error for flood control (429). ErrTooManyRequests = errors.New("teleiq: too many requests") // ErrMethodNotFound matches an *Error for a method the server does not know (404). ErrMethodNotFound = errors.New("teleiq: method not found") )
var ( // ErrBotBlocked matches an *Error for a user who blocked the bot (403). ErrBotBlocked = errors.New("teleiq: bot blocked by the user") // ErrUserDeactivated matches an *Error for a user whose account was deleted (403). ErrUserDeactivated = errors.New("teleiq: user deactivated") // ErrNotStarted matches an *Error for a user who never started the bot (403). ErrNotStarted = errors.New("teleiq: user has not started the bot") // ErrBotKicked matches an *Error for a chat that removed the bot (403). ErrBotKicked = errors.New("teleiq: bot kicked from the chat") // ErrNotMember matches an *Error for a chat that the bot is not a member of (403). ErrNotMember = errors.New("teleiq: bot is not a member of the chat") // ErrBotToBot matches an *Error for a message from the bot to another bot (403). ErrBotToBot = errors.New("teleiq: bots cannot message bots") // ErrNotEnoughRights matches an *Error for an action that needs rights the bot lacks. ErrNotEnoughRights = errors.New("teleiq: not enough rights") // ErrMemberIsAdmin matches an *Error for acting on a chat administrator (400). ErrMemberIsAdmin = errors.New("teleiq: member is an administrator") // ErrWrongChatType matches an *Error for a method the chat type does not allow (400). ErrWrongChatType = errors.New("teleiq: method not available in this chat") // ErrChatNotFound matches an *Error for an unknown chat (400). ErrChatNotFound = errors.New("teleiq: chat not found") // ErrUserNotFound matches an *Error for an unknown user (400). ErrUserNotFound = errors.New("teleiq: user not found") // ErrGroupMigrated matches an *Error for a group that became a supergroup (400). ErrGroupMigrated = errors.New("teleiq: group migrated to a supergroup") // ErrMessageNotFound matches an *Error for a missing or inaccessible message (400). ErrMessageNotFound = errors.New("teleiq: message not found") // ErrMessageNotModified matches an *Error for an edit that changes nothing (400). ErrMessageNotModified = errors.New("teleiq: message is not modified") // ErrMessageCantBeEdited matches an *Error for a message the bot may not edit (400). ErrMessageCantBeEdited = errors.New("teleiq: message can't be edited") // ErrMessageCantBeDeleted matches an *Error for a message the bot can't delete (400). ErrMessageCantBeDeleted = errors.New("teleiq: message can't be deleted") // ErrEmptyText matches an *Error for a message without text (400). ErrEmptyText = errors.New("teleiq: message text is empty") // ErrMessageTooLong matches an *Error for a text or caption that is too long (400). ErrMessageTooLong = errors.New("teleiq: message is too long") // ErrCantParseEntities matches an *Error for malformed HTML or Markdown (400). ErrCantParseEntities = errors.New("teleiq: can't parse entities") // ErrButtonDataInvalid matches an *Error for invalid button callback data (400). ErrButtonDataInvalid = errors.New("teleiq: button data invalid") // ErrReplyMarkupTooLong matches an *Error for a keyboard that is too large (400). ErrReplyMarkupTooLong = errors.New("teleiq: reply markup is too long") // ErrQueryTooOld matches an *Error for a query answered too late (400). ErrQueryTooOld = errors.New("teleiq: query is too old") // ErrInvalidFileID matches an *Error for a malformed or unknown file_id (400). ErrInvalidFileID = errors.New("teleiq: invalid file_id") // ErrFileTooBig matches an *Error for a file too big for a bot to download (400). ErrFileTooBig = errors.New("teleiq: file is too big") // ErrAnotherInstance matches an *Error for a second poller using the token (409). ErrAnotherInstance = errors.New("teleiq: another instance polls with the token") // ErrWebhookActive matches an *Error for getUpdates while a webhook is set (409). ErrWebhookActive = errors.New("teleiq: webhook is active") )
The errors below match an *Error by its code and the text of its description.
Functions ¶
func EscapeMarkdown ¶
EscapeMarkdown escapes every character that Markdown reserves in plain text s.
Example ¶
Text sent with ParseModeMarkdown is escaped with EscapeMarkdown, except the markup itself.
package main
import (
"fmt"
"github.com/DhurghamAhmed/teleiq"
)
func main() {
fmt.Println("*Welcome,* " + teleiq.EscapeMarkdown("Ann_Lee (admin)") + "\\!")
}
Output: *Welcome,* Ann\_Lee \(admin\)\!
Types ¶
type AddStickerToSetParams ¶
type AddStickerToSetParams struct {
// User identifier of sticker set owner
UserID int64 `json:"user_id"`
// Sticker set name
Name string `json:"name"`
// A JSON-serialized object with information about the added sticker.
Sticker models.InputSticker `json:"sticker"`
}
AddStickerToSetParams holds the parameters of AddStickerToSet.
type AnswerCallbackQueryParams ¶
type AnswerCallbackQueryParams struct {
// Unique identifier for the query to be answered
CallbackQueryID string `json:"callback_query_id"`
// Text of the notification.
Text *string `json:"text,omitempty"`
// If True, an alert will be shown by the client instead of a notification at the top of the chat
// screen.
ShowAlert *bool `json:"show_alert,omitempty"`
// URL that will be opened by the user's client.
URL *string `json:"url,omitempty"`
// The maximum amount of time in seconds that the result of the callback query may be cached
// client-side.
CacheTime *int `json:"cache_time,omitempty"`
}
AnswerCallbackQueryParams holds the parameters of AnswerCallbackQuery.
type AnswerChatJoinRequestQueryParams ¶
type AnswerChatJoinRequestQueryParams struct {
// Unique identifier of the join request query
ChatJoinRequestQueryID string `json:"chat_join_request_query_id"`
// Result of the query.
Result string `json:"result"`
}
AnswerChatJoinRequestQueryParams holds the parameters of AnswerChatJoinRequestQuery.
type AnswerGuestQueryParams ¶
type AnswerGuestQueryParams struct {
// Unique identifier for the query to be answered
GuestQueryID string `json:"guest_query_id"`
// A JSON-serialized object describing the message to be sent
Result models.InlineQueryResult `json:"result"`
}
AnswerGuestQueryParams holds the parameters of AnswerGuestQuery.
type AnswerInlineQueryParams ¶
type AnswerInlineQueryParams struct {
// Unique identifier for the answered query
InlineQueryID string `json:"inline_query_id"`
// A JSON-serialized Array of results for the inline query
Results []models.InlineQueryResult `json:"results"`
// The maximum amount of time in seconds that the result of the inline query may be cached on the
// server.
CacheTime *int `json:"cache_time,omitempty"`
// Pass True if results may be cached on the server side only for the user that sent the query.
IsPersonal *bool `json:"is_personal,omitempty"`
// Pass the offset that a client should send in the next query with the same text to receive more
// results.
NextOffset *string `json:"next_offset,omitempty"`
// A JSON-serialized object describing a button to be shown above inline query results
Button *models.InlineQueryResultsButton `json:"button,omitempty"`
}
AnswerInlineQueryParams holds the parameters of AnswerInlineQuery.
type AnswerPreCheckoutQueryParams ¶
type AnswerPreCheckoutQueryParams struct {
// Unique identifier for the query to be answered
PreCheckoutQueryID string `json:"pre_checkout_query_id"`
// Specify True if everything is alright (goods are available, etc.) and the bot is ready to
// proceed with the order.
Ok bool `json:"ok"`
// Required if ok is False.
ErrorMessage *string `json:"error_message,omitempty"`
}
AnswerPreCheckoutQueryParams holds the parameters of AnswerPreCheckoutQuery.
type AnswerShippingQueryParams ¶
type AnswerShippingQueryParams struct {
// Unique identifier for the query to be answered
ShippingQueryID string `json:"shipping_query_id"`
// Pass True if delivery to the specified address is possible and False if there are any problems
// (for example, if delivery to the specified address is not possible)
Ok bool `json:"ok"`
// Required if ok is True.
ShippingOptions []models.ShippingOption `json:"shipping_options,omitzero"`
// Required if ok is False.
ErrorMessage *string `json:"error_message,omitempty"`
}
AnswerShippingQueryParams holds the parameters of AnswerShippingQuery.
type AnswerWebAppQueryParams ¶
type AnswerWebAppQueryParams struct {
// Unique identifier for the query to be answered
WebAppQueryID string `json:"web_app_query_id"`
// A JSON-serialized object describing the message to be sent
Result models.InlineQueryResult `json:"result"`
}
AnswerWebAppQueryParams holds the parameters of AnswerWebAppQuery.
type ApproveChatJoinRequestParams ¶
type ApproveChatJoinRequestParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
}
ApproveChatJoinRequestParams holds the parameters of ApproveChatJoinRequest.
type ApproveSuggestedPostParams ¶
type ApproveSuggestedPostParams struct {
// Unique identifier for the target direct messages chat
ChatID int64 `json:"chat_id"`
// Identifier of a suggested post message to approve
MessageID int64 `json:"message_id"`
// Point in time (Unix timestamp) when the post is expected to be published; omit if the date has
// already been specified when the suggested post was created.
SendDate *int64 `json:"send_date,omitempty"`
}
ApproveSuggestedPostParams holds the parameters of ApproveSuggestedPost.
type Backoff ¶
type Backoff struct {
MaxAttempts int // attempts in total, the first one included; default 3
BaseDelay time.Duration // the delay before the second attempt; default 500ms
MaxDelay time.Duration // the longest delay; default 10s
}
Backoff is a RetryPolicy with exponential backoff and jitter.
type BanChatMemberParams ¶
type BanChatMemberParams struct {
// Unique identifier for the target group or username of the target supergroup or channel in the
// format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// Date when the user will be unbanned; Unix time.
UntilDate *int64 `json:"until_date,omitempty"`
// Pass True to delete all messages from the chat for the user that is being removed.
RevokeMessages *bool `json:"revoke_messages,omitempty"`
}
BanChatMemberParams holds the parameters of BanChatMember.
type BanChatSenderChatParams ¶
type BanChatSenderChatParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target sender chat
SenderChatID int64 `json:"sender_chat_id"`
}
BanChatSenderChatParams holds the parameters of BanChatSenderChat.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls the Telegram Bot API; it is safe for concurrent use.
func NewClient ¶
NewClient returns a Client for the bot with the given token.
Example ¶
A bot is created with the token that @BotFather gave it, as in teleiq.NewClient(os.Getenv("BOT_TOKEN")). Here WithBaseURL points the client at a fake Bot API server from package teleiqtest, as a test does.
package main
import (
"context"
"fmt"
"log"
"github.com/DhurghamAhmed/teleiq"
"github.com/DhurghamAhmed/teleiq/models"
"github.com/DhurghamAhmed/teleiq/teleiqtest"
)
func main() {
srv := teleiqtest.NewServer()
defer srv.Close()
client, err := teleiq.NewClient(teleiqtest.Token, teleiq.WithBaseURL(srv.URL))
if err != nil {
log.Fatal(err)
}
msg, err := client.SendMessage(context.Background(), teleiq.SendMessageParams{
ChatID: models.ID(123456789),
Text: "Hello",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(msg.Chat.ID, *msg.Text)
}
Output: 123456789 Hello
func (*Client) AddStickerToSet ¶
func (c *Client) AddStickerToSet(ctx context.Context, params AddStickerToSetParams) error
Use this method to add a new sticker to a set created by the bot.
func (*Client) AnswerCallbackQuery ¶
func (c *Client) AnswerCallbackQuery(ctx context.Context, params AnswerCallbackQueryParams) error
Use this method to send answers to callback queries sent from inline keyboards.
func (*Client) AnswerChatJoinRequestQuery ¶
func (c *Client) AnswerChatJoinRequestQuery(ctx context.Context, params AnswerChatJoinRequestQueryParams) error
Use this method to process a received chat join request query.
func (*Client) AnswerGuestQuery ¶
func (c *Client) AnswerGuestQuery(ctx context.Context, params AnswerGuestQueryParams) (*models.SentGuestMessage, error)
Use this method to reply to a received guest message.
func (*Client) AnswerInlineQuery ¶
func (c *Client) AnswerInlineQuery(ctx context.Context, params AnswerInlineQueryParams) error
Use this method to send answers to an inline query.
func (*Client) AnswerPreCheckoutQuery ¶
func (c *Client) AnswerPreCheckoutQuery(ctx context.Context, params AnswerPreCheckoutQueryParams) 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.
func (*Client) AnswerShippingQuery ¶
func (c *Client) AnswerShippingQuery(ctx context.Context, params AnswerShippingQueryParams) 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.
func (*Client) AnswerWebAppQuery ¶
func (c *Client) AnswerWebAppQuery(ctx context.Context, params AnswerWebAppQueryParams) (*models.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.
func (*Client) ApproveChatJoinRequest ¶
func (c *Client) ApproveChatJoinRequest(ctx context.Context, params ApproveChatJoinRequestParams) error
Use this method to approve a chat join request.
func (*Client) ApproveSuggestedPost ¶
func (c *Client) ApproveSuggestedPost(ctx context.Context, params ApproveSuggestedPostParams) error
Use this method to approve a suggested post in a direct messages chat.
func (*Client) BanChatMember ¶
func (c *Client) BanChatMember(ctx context.Context, params BanChatMemberParams) error
Use this method to ban a user in a group, a supergroup or a channel.
func (*Client) BanChatSenderChat ¶
func (c *Client) BanChatSenderChat(ctx context.Context, params BanChatSenderChatParams) error
Use this method to ban a channel chat in a supergroup or a channel.
func (*Client) Close ¶
Use this method to close the bot instance before moving it from one local server to another.
func (*Client) CloseForumTopic ¶
func (c *Client) CloseForumTopic(ctx context.Context, params CloseForumTopicParams) error
Use this method to close an open topic in a forum supergroup chat.
func (*Client) CloseGeneralForumTopic ¶
func (c *Client) CloseGeneralForumTopic(ctx context.Context, params CloseGeneralForumTopicParams) error
Use this method to close an open 'General' topic in a forum supergroup chat.
func (*Client) ConvertGiftToStars ¶
func (c *Client) ConvertGiftToStars(ctx context.Context, params ConvertGiftToStarsParams) error
Converts a given regular gift to Telegram Stars.
func (*Client) CopyMessage ¶
func (c *Client) CopyMessage(ctx context.Context, params CopyMessageParams) (*models.MessageId, error)
Use this method to copy messages of any kind.
func (*Client) CopyMessages ¶
func (c *Client) CopyMessages(ctx context.Context, params CopyMessagesParams) ([]models.MessageId, error)
Use this method to copy messages of any kind.
func (*Client) CreateChatInviteLink ¶
func (c *Client) CreateChatInviteLink(ctx context.Context, params CreateChatInviteLinkParams) (*models.ChatInviteLink, error)
Use this method to create an additional invite link for a chat.
func (*Client) CreateChatSubscriptionInviteLink ¶
func (c *Client) CreateChatSubscriptionInviteLink(ctx context.Context, params CreateChatSubscriptionInviteLinkParams) (*models.ChatInviteLink, error)
Use this method to create a subscription invite link for a channel chat.
func (*Client) CreateForumTopic ¶
func (c *Client) CreateForumTopic(ctx context.Context, params CreateForumTopicParams) (*models.ForumTopic, error)
Use this method to create a topic in a forum supergroup chat or a private chat with a user.
func (*Client) CreateInvoiceLink ¶
func (c *Client) CreateInvoiceLink(ctx context.Context, params CreateInvoiceLinkParams) (string, error)
Use this method to create a link for an invoice.
func (*Client) CreateNewStickerSet ¶
func (c *Client) CreateNewStickerSet(ctx context.Context, params CreateNewStickerSetParams) error
Use this method to create a new sticker set owned by a user.
func (*Client) DeclineChatJoinRequest ¶
func (c *Client) DeclineChatJoinRequest(ctx context.Context, params DeclineChatJoinRequestParams) error
Use this method to decline a chat join request.
func (*Client) DeclineSuggestedPost ¶
func (c *Client) DeclineSuggestedPost(ctx context.Context, params DeclineSuggestedPostParams) error
Use this method to decline a suggested post in a direct messages chat.
func (*Client) DeleteAllMessageReactions ¶
func (c *Client) DeleteAllMessageReactions(ctx context.Context, params DeleteAllMessageReactionsParams) error
Use this method to remove up to 10000 recent reactions in a group or a supergroup chat added by a given user or chat.
func (*Client) DeleteBusinessMessages ¶
func (c *Client) DeleteBusinessMessages(ctx context.Context, params DeleteBusinessMessagesParams) error
Delete messages on behalf of a business account.
func (*Client) DeleteChatPhoto ¶
func (c *Client) DeleteChatPhoto(ctx context.Context, params DeleteChatPhotoParams) error
Use this method to delete a chat photo.
func (*Client) DeleteChatStickerSet ¶
func (c *Client) DeleteChatStickerSet(ctx context.Context, params DeleteChatStickerSetParams) error
Use this method to delete a group sticker set from a supergroup.
func (*Client) DeleteEphemeralMessage ¶
func (c *Client) DeleteEphemeralMessage(ctx context.Context, params DeleteEphemeralMessageParams) error
Use this method to delete an ephemeral message.
func (*Client) DeleteForumTopic ¶
func (c *Client) DeleteForumTopic(ctx context.Context, params DeleteForumTopicParams) error
Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user.
func (*Client) DeleteMessage ¶
func (c *Client) DeleteMessage(ctx context.Context, params DeleteMessageParams) 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.
func (*Client) DeleteMessageReaction ¶
func (c *Client) DeleteMessageReaction(ctx context.Context, params DeleteMessageReactionParams) error
Use this method to remove a reaction from a message in a group or a supergroup chat.
func (*Client) DeleteMessages ¶
func (c *Client) DeleteMessages(ctx context.Context, params DeleteMessagesParams) error
Use this method to delete multiple messages simultaneously.
func (*Client) DeleteMyCommands ¶
func (c *Client) DeleteMyCommands(ctx context.Context, params DeleteMyCommandsParams) error
Use this method to delete the list of the bot's commands for the given scope and user language.
func (*Client) DeleteStickerFromSet ¶
func (c *Client) DeleteStickerFromSet(ctx context.Context, params DeleteStickerFromSetParams) error
Use this method to delete a sticker from a set created by the bot.
func (*Client) DeleteStickerSet ¶
func (c *Client) DeleteStickerSet(ctx context.Context, params DeleteStickerSetParams) error
Use this method to delete a sticker set that was created by the bot.
func (*Client) DeleteStory ¶
func (c *Client) DeleteStory(ctx context.Context, params DeleteStoryParams) error
Deletes a story previously posted by the bot on behalf of a managed business account.
func (*Client) DeleteWebhook ¶
func (c *Client) DeleteWebhook(ctx context.Context, params DeleteWebhookParams) error
Use this method to remove webhook integration if you decide to switch back to getUpdates.
func (*Client) EditChatInviteLink ¶
func (c *Client) EditChatInviteLink(ctx context.Context, params EditChatInviteLinkParams) (*models.ChatInviteLink, error)
Use this method to edit a non-primary invite link created by the bot.
func (*Client) EditChatSubscriptionInviteLink ¶
func (c *Client) EditChatSubscriptionInviteLink(ctx context.Context, params EditChatSubscriptionInviteLinkParams) (*models.ChatInviteLink, error)
Use this method to edit a subscription invite link created by the bot.
func (*Client) EditEphemeralMessageCaption ¶
func (c *Client) EditEphemeralMessageCaption(ctx context.Context, params EditEphemeralMessageCaptionParams) error
Use this method to edit the caption of an ephemeral message.
func (*Client) EditEphemeralMessageMedia ¶
func (c *Client) EditEphemeralMessageMedia(ctx context.Context, params EditEphemeralMessageMediaParams) error
Use this method to edit the media of an ephemeral message.
func (*Client) EditEphemeralMessageReplyMarkup ¶
func (c *Client) EditEphemeralMessageReplyMarkup(ctx context.Context, params EditEphemeralMessageReplyMarkupParams) error
Use this method to edit only the reply markup of an ephemeral message.
func (*Client) EditEphemeralMessageText ¶
func (c *Client) EditEphemeralMessageText(ctx context.Context, params EditEphemeralMessageTextParams) error
Use this method to edit an ephemeral text or rich message.
func (*Client) EditForumTopic ¶
func (c *Client) EditForumTopic(ctx context.Context, params EditForumTopicParams) error
Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user.
func (*Client) EditGeneralForumTopic ¶
func (c *Client) EditGeneralForumTopic(ctx context.Context, params EditGeneralForumTopicParams) error
Use this method to edit the name of the 'General' topic in a forum supergroup chat.
func (*Client) EditMessageCaption ¶
func (c *Client) EditMessageCaption(ctx context.Context, params EditMessageCaptionParams) (*models.Message, error)
Use this method to edit captions of messages. The Message is nil when the Bot API returns True, as it does for inline messages.
func (*Client) EditMessageChecklist ¶
func (c *Client) EditMessageChecklist(ctx context.Context, params EditMessageChecklistParams) (*models.Message, error)
Use this method to edit a checklist on behalf of a connected business account.
func (*Client) EditMessageLiveLocation ¶
func (c *Client) EditMessageLiveLocation(ctx context.Context, params EditMessageLiveLocationParams) (*models.Message, error)
Use this method to edit live location messages. The Message is nil when the Bot API returns True, as it does for inline messages.
func (*Client) EditMessageMedia ¶
func (c *Client) EditMessageMedia(ctx context.Context, params EditMessageMediaParams) (*models.Message, error)
Use this method to edit animation, audio, document, live photo, photo, or video messages, or to replace a text or a rich message with a media. The Message is nil when the Bot API returns True, as it does for inline messages.
func (*Client) EditMessageReplyMarkup ¶
func (c *Client) EditMessageReplyMarkup(ctx context.Context, params EditMessageReplyMarkupParams) (*models.Message, error)
Use this method to edit only the reply markup of messages. The Message is nil when the Bot API returns True, as it does for inline messages.
func (*Client) EditMessageText ¶
func (c *Client) EditMessageText(ctx context.Context, params EditMessageTextParams) (*models.Message, error)
Use this method to edit text, rich and game messages. The Message is nil when the Bot API returns True, as it does for inline messages.
func (*Client) EditStory ¶
Edits a story previously posted by the bot on behalf of a managed business account.
func (*Client) EditUserStarSubscription ¶
func (c *Client) EditUserStarSubscription(ctx context.Context, params EditUserStarSubscriptionParams) error
Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars.
func (*Client) ExportChatInviteLink ¶
func (c *Client) ExportChatInviteLink(ctx context.Context, params ExportChatInviteLinkParams) (string, error)
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked.
func (*Client) ForwardMessage ¶
func (c *Client) ForwardMessage(ctx context.Context, params ForwardMessageParams) (*models.Message, error)
Use this method to forward messages of any kind.
func (*Client) ForwardMessages ¶
func (c *Client) ForwardMessages(ctx context.Context, params ForwardMessagesParams) ([]models.MessageId, error)
Use this method to forward multiple messages of any kind.
func (*Client) GetAvailableGifts ¶
Returns the list of gifts that can be sent by the bot to users and channel chats.
func (*Client) GetBusinessAccountGifts ¶
func (c *Client) GetBusinessAccountGifts(ctx context.Context, params GetBusinessAccountGiftsParams) (*models.OwnedGifts, error)
Returns the gifts received and owned by a managed business account.
func (*Client) GetBusinessAccountStarBalance ¶
func (c *Client) GetBusinessAccountStarBalance(ctx context.Context, params GetBusinessAccountStarBalanceParams) (*models.StarAmount, error)
Returns the amount of Telegram Stars owned by a managed business account.
func (*Client) GetBusinessConnection ¶
func (c *Client) GetBusinessConnection(ctx context.Context, params GetBusinessConnectionParams) (*models.BusinessConnection, error)
Use this method to get information about the connection of the bot with a business account.
func (*Client) GetChat ¶
func (c *Client) GetChat(ctx context.Context, params GetChatParams) (*models.ChatFullInfo, error)
Use this method to get up-to-date information about the chat.
func (*Client) GetChatAdministrators ¶
func (c *Client) GetChatAdministrators(ctx context.Context, params GetChatAdministratorsParams) ([]models.ChatMember, error)
Use this method to get a list of administrators in a chat.
func (*Client) GetChatGifts ¶
func (c *Client) GetChatGifts(ctx context.Context, params GetChatGiftsParams) (*models.OwnedGifts, error)
Returns the gifts owned by a chat.
func (*Client) GetChatMember ¶
func (c *Client) GetChatMember(ctx context.Context, params GetChatMemberParams) (models.ChatMember, error)
Use this method to get information about a member of a chat.
func (*Client) GetChatMemberCount ¶
func (c *Client) GetChatMemberCount(ctx context.Context, params GetChatMemberCountParams) (int, error)
Use this method to get the number of members in a chat.
func (*Client) GetChatMenuButton ¶
func (c *Client) GetChatMenuButton(ctx context.Context, params GetChatMenuButtonParams) (models.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.
func (*Client) GetCustomEmojiStickers ¶
func (c *Client) GetCustomEmojiStickers(ctx context.Context, params GetCustomEmojiStickersParams) ([]models.Sticker, error)
Use this method to get information about custom emoji stickers by their identifiers.
func (*Client) GetFile ¶
Use this method to get basic information about a file and prepare it for downloading.
func (*Client) GetForumTopicIconStickers ¶
Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.
func (*Client) GetGameHighScores ¶
func (c *Client) GetGameHighScores(ctx context.Context, params GetGameHighScoresParams) ([]models.GameHighScore, error)
Use this method to get data for high score tables.
func (*Client) GetManagedBotAccessSettings ¶
func (c *Client) GetManagedBotAccessSettings(ctx context.Context, params GetManagedBotAccessSettingsParams) (*models.BotAccessSettings, error)
Use this method to get the access settings of a managed bot.
func (*Client) GetManagedBotToken ¶
func (c *Client) GetManagedBotToken(ctx context.Context, params GetManagedBotTokenParams) (string, error)
Use this method to get the token of a managed bot.
func (*Client) GetMyCommands ¶
func (c *Client) GetMyCommands(ctx context.Context, params GetMyCommandsParams) ([]models.BotCommand, error)
Use this method to get the current list of the bot's commands for the given scope and user language.
func (*Client) GetMyDefaultAdministratorRights ¶
func (c *Client) GetMyDefaultAdministratorRights(ctx context.Context, params GetMyDefaultAdministratorRightsParams) (*models.ChatAdministratorRights, error)
Use this method to get the current default administrator rights of the bot.
func (*Client) GetMyDescription ¶
func (c *Client) GetMyDescription(ctx context.Context, params GetMyDescriptionParams) (*models.BotDescription, error)
Use this method to get the current bot description for the given user language.
func (*Client) GetMyShortDescription ¶
func (c *Client) GetMyShortDescription(ctx context.Context, params GetMyShortDescriptionParams) (*models.BotShortDescription, error)
Use this method to get the current bot short description for the given user language.
func (*Client) GetMyStarBalance ¶
A method to get the current Telegram Stars balance of the bot.
func (*Client) GetStarTransactions ¶
func (c *Client) GetStarTransactions(ctx context.Context, params GetStarTransactionsParams) (*models.StarTransactions, error)
Returns the bot's Telegram Star transactions in chronological order.
func (*Client) GetStickerSet ¶
func (c *Client) GetStickerSet(ctx context.Context, params GetStickerSetParams) (*models.StickerSet, error)
Use this method to get a sticker set.
func (*Client) GetUpdates ¶
Use this method to receive incoming updates using long polling (wiki).
func (*Client) GetUserChatBoosts ¶
func (c *Client) GetUserChatBoosts(ctx context.Context, params GetUserChatBoostsParams) (*models.UserChatBoosts, error)
Use this method to get the list of boosts added to a chat by a user.
func (*Client) GetUserGifts ¶
func (c *Client) GetUserGifts(ctx context.Context, params GetUserGiftsParams) (*models.OwnedGifts, error)
Returns the gifts owned and hosted by a user.
func (*Client) GetUserPersonalChatMessages ¶
func (c *Client) GetUserPersonalChatMessages(ctx context.Context, params GetUserPersonalChatMessagesParams) ([]models.Message, error)
Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user.
func (*Client) GetUserProfileAudios ¶
func (c *Client) GetUserProfileAudios(ctx context.Context, params GetUserProfileAudiosParams) (*models.UserProfileAudios, error)
Use this method to get a list of profile audios for a user.
func (*Client) GetUserProfilePhotos ¶
func (c *Client) GetUserProfilePhotos(ctx context.Context, params GetUserProfilePhotosParams) (*models.UserProfilePhotos, error)
Use this method to get a list of profile pictures for a user.
func (*Client) GetWebhookInfo ¶
Use this method to get current webhook status.
func (*Client) GiftPremiumSubscription ¶
func (c *Client) GiftPremiumSubscription(ctx context.Context, params GiftPremiumSubscriptionParams) error
Gifts a Telegram Premium subscription to the given user.
func (*Client) HideGeneralForumTopic ¶
func (c *Client) HideGeneralForumTopic(ctx context.Context, params HideGeneralForumTopicParams) error
Use this method to hide the 'General' topic in a forum supergroup chat.
func (*Client) LeaveChat ¶
func (c *Client) LeaveChat(ctx context.Context, params LeaveChatParams) error
Use this method for your bot to leave a group, supergroup or channel.
func (*Client) LogOut ¶
Use this method to log out from the cloud Bot API server before launching the bot locally.
func (*Client) PinChatMessage ¶
func (c *Client) PinChatMessage(ctx context.Context, params PinChatMessageParams) error
Use this method to add a message to the list of pinned messages in a chat.
func (*Client) PromoteChatMember ¶
func (c *Client) PromoteChatMember(ctx context.Context, params PromoteChatMemberParams) error
Use this method to promote or demote a user in a supergroup or a channel.
func (*Client) ReadBusinessMessage ¶
func (c *Client) ReadBusinessMessage(ctx context.Context, params ReadBusinessMessageParams) error
Marks incoming message as read on behalf of a business account.
func (*Client) RefundStarPayment ¶
func (c *Client) RefundStarPayment(ctx context.Context, params RefundStarPaymentParams) error
Refunds a successful payment in Telegram Stars.
func (*Client) RemoveBusinessAccountProfilePhoto ¶
func (c *Client) RemoveBusinessAccountProfilePhoto(ctx context.Context, params RemoveBusinessAccountProfilePhotoParams) error
Removes the current profile photo of a managed business account.
func (*Client) RemoveChatVerification ¶
func (c *Client) RemoveChatVerification(ctx context.Context, params RemoveChatVerificationParams) error
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
func (*Client) RemoveMyProfilePhoto ¶
Removes the profile photo of the bot.
func (*Client) RemoveUserVerification ¶
func (c *Client) RemoveUserVerification(ctx context.Context, params RemoveUserVerificationParams) error
Removes verification from a user who is currently verified on behalf of the organization represented by the bot.
func (*Client) ReopenForumTopic ¶
func (c *Client) ReopenForumTopic(ctx context.Context, params ReopenForumTopicParams) error
Use this method to reopen a closed topic in a forum supergroup chat.
func (*Client) ReopenGeneralForumTopic ¶
func (c *Client) ReopenGeneralForumTopic(ctx context.Context, params ReopenGeneralForumTopicParams) error
Use this method to reopen a closed 'General' topic in a forum supergroup chat.
func (*Client) ReplaceManagedBotToken ¶
func (c *Client) ReplaceManagedBotToken(ctx context.Context, params ReplaceManagedBotTokenParams) (string, error)
Use this method to revoke the current token of a managed bot and generate a new one.
func (*Client) ReplaceStickerInSet ¶
func (c *Client) ReplaceStickerInSet(ctx context.Context, params ReplaceStickerInSetParams) error
Use this method to replace an existing sticker in a sticker set with a new one.
func (*Client) RepostStory ¶
Reposts a story on behalf of a business account from another business account.
func (*Client) RestrictChatMember ¶
func (c *Client) RestrictChatMember(ctx context.Context, params RestrictChatMemberParams) error
Use this method to restrict a user in a supergroup.
func (*Client) RevokeChatInviteLink ¶
func (c *Client) RevokeChatInviteLink(ctx context.Context, params RevokeChatInviteLinkParams) (*models.ChatInviteLink, error)
Use this method to revoke an invite link created by the bot.
func (*Client) SavePreparedInlineMessage ¶
func (c *Client) SavePreparedInlineMessage(ctx context.Context, params SavePreparedInlineMessageParams) (*models.PreparedInlineMessage, error)
Stores a message that can be sent by a user of a Mini App.
func (*Client) SavePreparedKeyboardButton ¶
func (c *Client) SavePreparedKeyboardButton(ctx context.Context, params SavePreparedKeyboardButtonParams) (*models.PreparedKeyboardButton, error)
Stores a keyboard button that can be used by a user within a Mini App.
func (*Client) SendAnimation ¶
func (c *Client) SendAnimation(ctx context.Context, params SendAnimationParams) (*models.Message, error)
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
func (*Client) SendAudio ¶
Use this method to send audio files, if you want Telegram clients to display them in the music player.
func (*Client) SendChatAction ¶
func (c *Client) SendChatAction(ctx context.Context, params SendChatActionParams) error
Use this method when you need to tell the user that something is happening on the bot's side.
func (*Client) SendChatJoinRequestWebApp ¶
func (c *Client) SendChatJoinRequestWebApp(ctx context.Context, params SendChatJoinRequestWebAppParams) error
Use this method to process a received chat join request query by showing a Mini App to the user before deciding the outcome.
func (*Client) SendChecklist ¶
func (c *Client) SendChecklist(ctx context.Context, params SendChecklistParams) (*models.Message, error)
Use this method to send a checklist on behalf of a connected business account.
func (*Client) SendContact ¶
func (c *Client) SendContact(ctx context.Context, params SendContactParams) (*models.Message, error)
Use this method to send phone contacts.
func (*Client) SendDice ¶
Use this method to send an animated emoji that will display a random value.
func (*Client) SendDocument ¶
func (c *Client) SendDocument(ctx context.Context, params SendDocumentParams) (*models.Message, error)
Use this method to send general files.
func (*Client) SendGift ¶
func (c *Client) SendGift(ctx context.Context, params SendGiftParams) error
Sends a gift to the given user or channel chat.
func (*Client) SendInvoice ¶
func (c *Client) SendInvoice(ctx context.Context, params SendInvoiceParams) (*models.Message, error)
Use this method to send invoices.
func (*Client) SendLivePhoto ¶
func (c *Client) SendLivePhoto(ctx context.Context, params SendLivePhotoParams) (*models.Message, error)
Use this method to send live photos.
func (*Client) SendLocation ¶
func (c *Client) SendLocation(ctx context.Context, params SendLocationParams) (*models.Message, error)
Use this method to send point on the map.
func (*Client) SendMediaGroup ¶
func (c *Client) SendMediaGroup(ctx context.Context, params SendMediaGroupParams) ([]models.Message, error)
Use this method to send a group of photos, live photos, videos, documents or audios as an album.
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, params SendMessageParams) (*models.Message, error)
Use this method to send text messages.
func (*Client) SendMessageDraft ¶
func (c *Client) SendMessageDraft(ctx context.Context, params SendMessageDraftParams) error
Use this method to stream a partial message to a user while the message is being generated.
func (*Client) SendPaidMedia ¶
func (c *Client) SendPaidMedia(ctx context.Context, params SendPaidMediaParams) (*models.Message, error)
Use this method to send paid media.
func (*Client) SendRichMessage ¶
func (c *Client) SendRichMessage(ctx context.Context, params SendRichMessageParams) (*models.Message, error)
Use this method to send rich messages.
func (*Client) SendRichMessageDraft ¶
func (c *Client) SendRichMessageDraft(ctx context.Context, params SendRichMessageDraftParams) error
Use this method to stream a partial rich message to a user while the message is being generated.
func (*Client) SendSticker ¶
func (c *Client) SendSticker(ctx context.Context, params SendStickerParams) (*models.Message, error)
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
func (*Client) SendVideo ¶
Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document).
func (*Client) SendVideoNote ¶
func (c *Client) SendVideoNote(ctx context.Context, params SendVideoNoteParams) (*models.Message, error)
Use this method to send a rounded square MPEG4 video of up to 1 minute long.
func (*Client) SendVoice ¶
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
func (*Client) SetBusinessAccountBio ¶
func (c *Client) SetBusinessAccountBio(ctx context.Context, params SetBusinessAccountBioParams) error
Changes the bio of a managed business account.
func (*Client) SetBusinessAccountGiftSettings ¶
func (c *Client) SetBusinessAccountGiftSettings(ctx context.Context, params SetBusinessAccountGiftSettingsParams) error
Changes the privacy settings pertaining to incoming gifts in a managed business account.
func (*Client) SetBusinessAccountName ¶
func (c *Client) SetBusinessAccountName(ctx context.Context, params SetBusinessAccountNameParams) error
Changes the first and last name of a managed business account.
func (*Client) SetBusinessAccountProfilePhoto ¶
func (c *Client) SetBusinessAccountProfilePhoto(ctx context.Context, params SetBusinessAccountProfilePhotoParams) error
Changes the profile photo of a managed business account.
func (*Client) SetBusinessAccountUsername ¶
func (c *Client) SetBusinessAccountUsername(ctx context.Context, params SetBusinessAccountUsernameParams) error
Changes the username of a managed business account.
func (*Client) SetChatAdministratorCustomTitle ¶
func (c *Client) SetChatAdministratorCustomTitle(ctx context.Context, params SetChatAdministratorCustomTitleParams) error
Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
func (*Client) SetChatDescription ¶
func (c *Client) SetChatDescription(ctx context.Context, params SetChatDescriptionParams) error
Use this method to change the description of a group, a supergroup or a channel.
func (*Client) SetChatMemberTag ¶
func (c *Client) SetChatMemberTag(ctx context.Context, params SetChatMemberTagParams) error
Use this method to set a tag for a regular member in a group or a supergroup.
func (*Client) SetChatMenuButton ¶
func (c *Client) SetChatMenuButton(ctx context.Context, params SetChatMenuButtonParams) error
Use this method to change the bot's menu button in a private chat, or the default menu button.
func (*Client) SetChatPermissions ¶
func (c *Client) SetChatPermissions(ctx context.Context, params SetChatPermissionsParams) error
Use this method to set default chat permissions for all members.
func (*Client) SetChatPhoto ¶
func (c *Client) SetChatPhoto(ctx context.Context, params SetChatPhotoParams) error
Use this method to set a new profile photo for the chat.
func (*Client) SetChatStickerSet ¶
func (c *Client) SetChatStickerSet(ctx context.Context, params SetChatStickerSetParams) error
Use this method to set a new group sticker set for a supergroup.
func (*Client) SetChatTitle ¶
func (c *Client) SetChatTitle(ctx context.Context, params SetChatTitleParams) error
Use this method to change the title of a chat.
func (*Client) SetCustomEmojiStickerSetThumbnail ¶
func (c *Client) SetCustomEmojiStickerSetThumbnail(ctx context.Context, params SetCustomEmojiStickerSetThumbnailParams) error
Use this method to set the thumbnail of a custom emoji sticker set.
func (*Client) SetGameScore ¶
func (c *Client) SetGameScore(ctx context.Context, params SetGameScoreParams) (*models.Message, error)
Use this method to set the score of the specified user in a game message. The Message is nil when the Bot API returns True, as it does for inline messages.
func (*Client) SetManagedBotAccessSettings ¶
func (c *Client) SetManagedBotAccessSettings(ctx context.Context, params SetManagedBotAccessSettingsParams) error
Use this method to change the access settings of a managed bot.
func (*Client) SetMessageReaction ¶
func (c *Client) SetMessageReaction(ctx context.Context, params SetMessageReactionParams) error
Use this method to change the chosen reactions on a message.
func (*Client) SetMyCommands ¶
func (c *Client) SetMyCommands(ctx context.Context, params SetMyCommandsParams) error
Use this method to change the list of the bot's commands.
func (*Client) SetMyDefaultAdministratorRights ¶
func (c *Client) SetMyDefaultAdministratorRights(ctx context.Context, params SetMyDefaultAdministratorRightsParams) 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.
func (*Client) SetMyDescription ¶
func (c *Client) SetMyDescription(ctx context.Context, params SetMyDescriptionParams) error
Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
func (*Client) SetMyName ¶
func (c *Client) SetMyName(ctx context.Context, params SetMyNameParams) error
Use this method to change the bot's name.
func (*Client) SetMyProfilePhoto ¶
func (c *Client) SetMyProfilePhoto(ctx context.Context, params SetMyProfilePhotoParams) error
Changes the profile photo of the bot.
func (*Client) SetMyShortDescription ¶
func (c *Client) SetMyShortDescription(ctx context.Context, params SetMyShortDescriptionParams) 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.
func (*Client) SetPassportDataErrors ¶
func (c *Client) SetPassportDataErrors(ctx context.Context, params SetPassportDataErrorsParams) error
Informs a user that some of the Telegram Passport elements they provided contains errors.
func (*Client) SetStickerEmojiList ¶
func (c *Client) SetStickerEmojiList(ctx context.Context, params SetStickerEmojiListParams) error
Use this method to change the list of emoji assigned to a regular or custom emoji sticker.
func (*Client) SetStickerKeywords ¶
func (c *Client) SetStickerKeywords(ctx context.Context, params SetStickerKeywordsParams) error
Use this method to change search keywords assigned to a regular or custom emoji sticker.
func (*Client) SetStickerMaskPosition ¶
func (c *Client) SetStickerMaskPosition(ctx context.Context, params SetStickerMaskPositionParams) error
Use this method to change the mask position of a mask sticker.
func (*Client) SetStickerPositionInSet ¶
func (c *Client) SetStickerPositionInSet(ctx context.Context, params SetStickerPositionInSetParams) error
Use this method to move a sticker in a set created by the bot to a specific position.
func (*Client) SetStickerSetThumbnail ¶
func (c *Client) SetStickerSetThumbnail(ctx context.Context, params SetStickerSetThumbnailParams) error
Use this method to set the thumbnail of a regular or mask sticker set.
func (*Client) SetStickerSetTitle ¶
func (c *Client) SetStickerSetTitle(ctx context.Context, params SetStickerSetTitleParams) error
Use this method to set the title of a created sticker set.
func (*Client) SetUserEmojiStatus ¶
func (c *Client) SetUserEmojiStatus(ctx context.Context, params SetUserEmojiStatusParams) error
Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess.
func (*Client) SetWebhook ¶
func (c *Client) SetWebhook(ctx context.Context, params SetWebhookParams) error
Use this method to specify a URL and receive incoming updates via an outgoing webhook.
func (*Client) StopMessageLiveLocation ¶
func (c *Client) StopMessageLiveLocation(ctx context.Context, params StopMessageLiveLocationParams) (*models.Message, error)
Use this method to stop updating a live location message before live_period expires. The Message is nil when the Bot API returns True, as it does for inline messages.
func (*Client) TransferBusinessAccountStars ¶
func (c *Client) TransferBusinessAccountStars(ctx context.Context, params TransferBusinessAccountStarsParams) error
Transfers Telegram Stars from the business account balance to the bot's balance.
func (*Client) TransferGift ¶
func (c *Client) TransferGift(ctx context.Context, params TransferGiftParams) error
Transfers an owned unique gift to another user.
func (*Client) UnbanChatMember ¶
func (c *Client) UnbanChatMember(ctx context.Context, params UnbanChatMemberParams) error
Use this method to unban a previously banned user in a supergroup or channel.
func (*Client) UnbanChatSenderChat ¶
func (c *Client) UnbanChatSenderChat(ctx context.Context, params UnbanChatSenderChatParams) error
Use this method to unban a previously banned channel chat in a supergroup or channel.
func (*Client) UnhideGeneralForumTopic ¶
func (c *Client) UnhideGeneralForumTopic(ctx context.Context, params UnhideGeneralForumTopicParams) error
Use this method to unhide the 'General' topic in a forum supergroup chat.
func (*Client) UnpinAllChatMessages ¶
func (c *Client) UnpinAllChatMessages(ctx context.Context, params UnpinAllChatMessagesParams) error
Use this method to clear the list of pinned messages in a chat.
func (*Client) UnpinAllForumTopicMessages ¶
func (c *Client) UnpinAllForumTopicMessages(ctx context.Context, params UnpinAllForumTopicMessagesParams) error
Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user.
func (*Client) UnpinAllGeneralForumTopicMessages ¶
func (c *Client) UnpinAllGeneralForumTopicMessages(ctx context.Context, params UnpinAllGeneralForumTopicMessagesParams) error
Use this method to clear the list of pinned messages in a General forum topic.
func (*Client) UnpinChatMessage ¶
func (c *Client) UnpinChatMessage(ctx context.Context, params UnpinChatMessageParams) error
Use this method to remove a message from the list of pinned messages in a chat.
func (*Client) UpgradeGift ¶
func (c *Client) UpgradeGift(ctx context.Context, params UpgradeGiftParams) error
Upgrades a given regular gift to a unique gift.
func (*Client) UploadStickerFile ¶
func (c *Client) UploadStickerFile(ctx context.Context, params UploadStickerFileParams) (*models.File, error)
Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times).
func (*Client) VerifyChat ¶
func (c *Client) VerifyChat(ctx context.Context, params VerifyChatParams) error
Verifies a chat on behalf of the organization which is represented by the bot.
func (*Client) VerifyUser ¶
func (c *Client) VerifyUser(ctx context.Context, params VerifyUserParams) error
Verifies a user on behalf of the organization which is represented by the bot.
type CloseForumTopicParams ¶
type CloseForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread of the forum topic
MessageThreadID int64 `json:"message_thread_id"`
}
CloseForumTopicParams holds the parameters of CloseForumTopic.
type CloseGeneralForumTopicParams ¶
type CloseGeneralForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
}
CloseGeneralForumTopicParams holds the parameters of CloseGeneralForumTopic.
type ConvertGiftToStarsParams ¶
type ConvertGiftToStarsParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier of the regular gift that should be converted to Telegram Stars
OwnedGiftID string `json:"owned_gift_id"`
}
ConvertGiftToStarsParams holds the parameters of ConvertGiftToStars.
type CopyMessageParams ¶
type CopyMessageParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// Unique identifier for the chat where the original message was sent (or username of the target
// bot, supergroup or channel in the format @username)
FromChatID models.ChatID `json:"from_chat_id"`
// Message identifier in the chat specified in from_chat_id
MessageID int64 `json:"message_id"`
// New start timestamp for the copied video in the message
VideoStartTimestamp *int `json:"video_start_timestamp,omitempty"`
// New caption for media, 0-1024 characters after entities parsing.
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the new caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the new caption, which can be
// specified instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Pass True if the caption must be shown above the message media.
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; only available when copying
// to private chats
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
CopyMessageParams holds the parameters of CopyMessage.
type CopyMessagesParams ¶
type CopyMessagesParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the messages will be sent; required if the
// messages are sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// Unique identifier for the chat where the original messages were sent (or username of the target
// bot, supergroup or channel in the format @username)
FromChatID models.ChatID `json:"from_chat_id"`
// A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy.
MessageIDs []int64 `json:"message_ids"`
// Sends the messages silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent messages from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to copy the messages without their captions
RemoveCaption *bool `json:"remove_caption,omitempty"`
}
CopyMessagesParams holds the parameters of CopyMessages.
type CreateChatInviteLinkParams ¶
type CreateChatInviteLinkParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Invite link name; 0-32 characters
Name *string `json:"name,omitempty"`
// Point in time (Unix timestamp) when the link will expire
ExpireDate *int64 `json:"expire_date,omitempty"`
// The maximum number of users that can be members of the chat simultaneously after joining the
// chat via this invite link; 1-99999
MemberLimit *int `json:"member_limit,omitempty"`
// True, if users joining the chat via the link need to be approved by chat administrators.
CreatesJoinRequest *bool `json:"creates_join_request,omitempty"`
}
CreateChatInviteLinkParams holds the parameters of CreateChatInviteLink.
type CreateChatSubscriptionInviteLinkParams ¶
type CreateChatSubscriptionInviteLinkParams struct {
// Unique identifier for the target channel chat or username of the target channel in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Invite link name; 0-32 characters
Name *string `json:"name,omitempty"`
// The number of seconds the subscription will be active for before the next payment.
SubscriptionPeriod int `json:"subscription_period"`
// The amount of Telegram Stars a user must pay initially and after each subsequent subscription
// period to be a member of the chat; 1-10000
SubscriptionPrice int `json:"subscription_price"`
}
CreateChatSubscriptionInviteLinkParams holds the parameters of CreateChatSubscriptionInviteLink.
type CreateForumTopicParams ¶
type CreateForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Topic name, 1-128 characters
Name string `json:"name"`
// Color of the topic icon in RGB format.
IconColor *int `json:"icon_color,omitempty"`
// Unique identifier of the custom emoji shown as the topic icon.
IconCustomEmojiID *string `json:"icon_custom_emoji_id,omitempty"`
}
CreateForumTopicParams holds the parameters of CreateForumTopic.
type CreateInvoiceLinkParams ¶
type CreateInvoiceLinkParams struct {
// Unique identifier of the business connection on behalf of which the link will be created.
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Product name, 1-32 characters
Title string `json:"title"`
// Product description, 1-255 characters
Description string `json:"description"`
// Bot-defined invoice payload, 1-128 bytes.
Payload string `json:"payload"`
// Payment provider token, obtained via @BotFather.
ProviderToken *string `json:"provider_token,omitempty"`
// Three-letter ISO 4217 currency code, see more on currencies.
Currency string `json:"currency"`
// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount,
// delivery cost, delivery tax, bonus, etc.).
Prices []models.LabeledPrice `json:"prices"`
// The number of seconds the subscription will be active for before the next payment.
SubscriptionPeriod *int `json:"subscription_period,omitempty"`
// The maximum accepted amount for tips in the smallest units of the currency (integer, not
// float/double).
MaxTipAmount *int `json:"max_tip_amount,omitempty"`
// A JSON-serialized Array of suggested amounts of tips in the smallest units of the currency
// (integer, not float/double).
SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitzero"`
// JSON-serialized data about the invoice, which will be shared with the payment provider.
ProviderData *string `json:"provider_data,omitempty"`
// URL of the product photo for the invoice.
PhotoURL *string `json:"photo_url,omitempty"`
// Photo size in bytes
PhotoSize *int `json:"photo_size,omitempty"`
// Photo width
PhotoWidth *int `json:"photo_width,omitempty"`
// Photo height
PhotoHeight *int `json:"photo_height,omitempty"`
// Pass True if you require the user's full name to complete the order.
NeedName *bool `json:"need_name,omitempty"`
// Pass True if you require the user's phone number to complete the order.
NeedPhoneNumber *bool `json:"need_phone_number,omitempty"`
// Pass True if you require the user's email address to complete the order.
NeedEmail *bool `json:"need_email,omitempty"`
// Pass True if you require the user's shipping address to complete the order.
NeedShippingAddress *bool `json:"need_shipping_address,omitempty"`
// Pass True if the user's phone number should be sent to the provider.
SendPhoneNumberToProvider *bool `json:"send_phone_number_to_provider,omitempty"`
// Pass True if the user's email address should be sent to the provider.
SendEmailToProvider *bool `json:"send_email_to_provider,omitempty"`
// Pass True if the final price depends on the shipping method.
IsFlexible *bool `json:"is_flexible,omitempty"`
}
CreateInvoiceLinkParams holds the parameters of CreateInvoiceLink.
type CreateNewStickerSetParams ¶
type CreateNewStickerSetParams struct {
// User identifier of created sticker set owner
UserID int64 `json:"user_id"`
// Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals).
Name string `json:"name"`
// Sticker set title, 1-64 characters
Title string `json:"title"`
// A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
Stickers []models.InputSticker `json:"stickers"`
// Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”.
StickerType *string `json:"sticker_type,omitempty"`
// Pass True if stickers in the sticker set must be repainted to the color of text when used in
// messages, the accent color if used as emoji status, white on chat photos, or another appropriate
// color based on context; for custom emoji sticker sets only
NeedsRepainting *bool `json:"needs_repainting,omitempty"`
}
CreateNewStickerSetParams holds the parameters of CreateNewStickerSet.
type DeclineChatJoinRequestParams ¶
type DeclineChatJoinRequestParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
}
DeclineChatJoinRequestParams holds the parameters of DeclineChatJoinRequest.
type DeclineSuggestedPostParams ¶
type DeclineSuggestedPostParams struct {
// Unique identifier for the target direct messages chat
ChatID int64 `json:"chat_id"`
// Identifier of a suggested post message to decline
MessageID int64 `json:"message_id"`
// Comment for the creator of the suggested post; 0-128 characters
Comment *string `json:"comment,omitempty"`
}
DeclineSuggestedPostParams holds the parameters of DeclineSuggestedPost.
type Defaults ¶
type Defaults struct {
// ParseMode is the default parse_mode of the methods that have one.
ParseMode string
// LinkPreviewOptions are the default link_preview_options of text messages.
LinkPreviewOptions *models.LinkPreviewOptions
// DisableNotification sends silently; ProtectContent blocks forwarding and saving.
DisableNotification bool
ProtectContent bool
}
Defaults are values a Client sends for the parameters that a call leaves unset.
type DeleteAllMessageReactionsParams ¶
type DeleteAllMessageReactionsParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the user whose reactions will be removed, if the reactions were added by a user
UserID *int64 `json:"user_id,omitempty"`
// Identifier of the chat whose reactions will be removed, if the reactions were added by a chat
ActorChatID *int64 `json:"actor_chat_id,omitempty"`
}
DeleteAllMessageReactionsParams holds the parameters of DeleteAllMessageReactions.
type DeleteBusinessMessagesParams ¶
type DeleteBusinessMessagesParams struct {
// Unique identifier of the business connection on behalf of which to delete the messages
BusinessConnectionID string `json:"business_connection_id"`
// A JSON-serialized list of 1-100 identifiers of messages to delete.
MessageIDs []int64 `json:"message_ids"`
}
DeleteBusinessMessagesParams holds the parameters of DeleteBusinessMessages.
type DeleteChatPhotoParams ¶
type DeleteChatPhotoParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
}
DeleteChatPhotoParams holds the parameters of DeleteChatPhoto.
type DeleteChatStickerSetParams ¶
type DeleteChatStickerSetParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
}
DeleteChatStickerSetParams holds the parameters of DeleteChatStickerSet.
type DeleteEphemeralMessageParams ¶
type DeleteEphemeralMessageParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the user who received the message
ReceiverUserID int64 `json:"receiver_user_id"`
// Identifier of the ephemeral message to delete
EphemeralMessageID int64 `json:"ephemeral_message_id"`
}
DeleteEphemeralMessageParams holds the parameters of DeleteEphemeralMessage.
type DeleteForumTopicParams ¶
type DeleteForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread of the forum topic
MessageThreadID int64 `json:"message_thread_id"`
}
DeleteForumTopicParams holds the parameters of DeleteForumTopic.
type DeleteMessageParams ¶
type DeleteMessageParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the message to delete
MessageID int64 `json:"message_id"`
}
DeleteMessageParams holds the parameters of DeleteMessage.
type DeleteMessageReactionParams ¶
type DeleteMessageReactionParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the target message
MessageID int64 `json:"message_id"`
// Identifier of the user whose reaction will be removed, if the reaction was added by a user
UserID *int64 `json:"user_id,omitempty"`
// Identifier of the chat whose reaction will be removed, if the reaction was added by a chat
ActorChatID *int64 `json:"actor_chat_id,omitempty"`
}
DeleteMessageReactionParams holds the parameters of DeleteMessageReaction.
type DeleteMessagesParams ¶
type DeleteMessagesParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// A JSON-serialized list of 1-100 identifiers of messages to delete.
MessageIDs []int64 `json:"message_ids"`
}
DeleteMessagesParams holds the parameters of DeleteMessages.
type DeleteMyCommandsParams ¶
type DeleteMyCommandsParams struct {
// A JSON-serialized object, describing scope of users for which the commands are relevant.
Scope models.BotCommandScope `json:"scope,omitempty"`
// A two-letter ISO 639-1 language code.
LanguageCode *string `json:"language_code,omitempty"`
}
DeleteMyCommandsParams holds the parameters of DeleteMyCommands.
type DeleteStickerFromSetParams ¶
type DeleteStickerFromSetParams struct {
// File identifier of the sticker
Sticker string `json:"sticker"`
}
DeleteStickerFromSetParams holds the parameters of DeleteStickerFromSet.
type DeleteStickerSetParams ¶
type DeleteStickerSetParams struct {
// Sticker set name
Name string `json:"name"`
}
DeleteStickerSetParams holds the parameters of DeleteStickerSet.
type DeleteStoryParams ¶
type DeleteStoryParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier of the story to delete
StoryID int64 `json:"story_id"`
}
DeleteStoryParams holds the parameters of DeleteStory.
type DeleteWebhookParams ¶
type DeleteWebhookParams struct {
// Pass True to drop all pending updates
DropPendingUpdates *bool `json:"drop_pending_updates,omitempty"`
}
DeleteWebhookParams holds the parameters of DeleteWebhook.
type EditChatInviteLinkParams ¶
type EditChatInviteLinkParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// The invite link to edit
InviteLink string `json:"invite_link"`
// Invite link name; 0-32 characters
Name *string `json:"name,omitempty"`
// Point in time (Unix timestamp) when the link will expire
ExpireDate *int64 `json:"expire_date,omitempty"`
// The maximum number of users that can be members of the chat simultaneously after joining the
// chat via this invite link; 1-99999
MemberLimit *int `json:"member_limit,omitempty"`
// True, if users joining the chat via the link need to be approved by chat administrators.
CreatesJoinRequest *bool `json:"creates_join_request,omitempty"`
}
EditChatInviteLinkParams holds the parameters of EditChatInviteLink.
type EditChatSubscriptionInviteLinkParams ¶
type EditChatSubscriptionInviteLinkParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// The invite link to edit
InviteLink string `json:"invite_link"`
// Invite link name; 0-32 characters
Name *string `json:"name,omitempty"`
}
EditChatSubscriptionInviteLinkParams holds the parameters of EditChatSubscriptionInviteLink.
type EditEphemeralMessageCaptionParams ¶
type EditEphemeralMessageCaptionParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the user who received the message
ReceiverUserID int64 `json:"receiver_user_id"`
// Identifier of the ephemeral message to edit
EphemeralMessageID int64 `json:"ephemeral_message_id"`
// New caption of the message, 0-1024 characters after entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the message caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Pass True if the caption must be shown above the message media.
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditEphemeralMessageCaptionParams holds the parameters of EditEphemeralMessageCaption.
type EditEphemeralMessageMediaParams ¶
type EditEphemeralMessageMediaParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the user who received the message
ReceiverUserID int64 `json:"receiver_user_id"`
// Identifier of the ephemeral message to edit
EphemeralMessageID int64 `json:"ephemeral_message_id"`
// A JSON-serialized object for the new media content of the message
Media models.InputMedia `json:"media"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditEphemeralMessageMediaParams holds the parameters of EditEphemeralMessageMedia.
type EditEphemeralMessageReplyMarkupParams ¶
type EditEphemeralMessageReplyMarkupParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the user who received the message
ReceiverUserID int64 `json:"receiver_user_id"`
// Identifier of the ephemeral message to edit
EphemeralMessageID int64 `json:"ephemeral_message_id"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditEphemeralMessageReplyMarkupParams holds the parameters of EditEphemeralMessageReplyMarkup.
type EditEphemeralMessageTextParams ¶
type EditEphemeralMessageTextParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the user who received the message
ReceiverUserID int64 `json:"receiver_user_id"`
// Identifier of the ephemeral message to edit
EphemeralMessageID int64 `json:"ephemeral_message_id"`
// New text of the message, 1-4096 characters after entity parsing; required if rich_message isn't
// specified
Text *string `json:"text,omitempty"`
// Mode for parsing entities in the message text.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in message text, which can be specified
// instead of parse_mode
Entities []models.MessageEntity `json:"entities,omitzero"`
// New rich content of the message; required if text isn't specified
RichMessage *models.InputRichMessage `json:"rich_message,omitempty"`
// Link preview generation options for the message
LinkPreviewOptions *models.LinkPreviewOptions `json:"link_preview_options,omitempty"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditEphemeralMessageTextParams holds the parameters of EditEphemeralMessageText.
type EditForumTopicParams ¶
type EditForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread of the forum topic
MessageThreadID int64 `json:"message_thread_id"`
// New topic name, 0-128 characters.
Name *string `json:"name,omitempty"`
// New unique identifier of the custom emoji shown as the topic icon.
IconCustomEmojiID *string `json:"icon_custom_emoji_id,omitempty"`
}
EditForumTopicParams holds the parameters of EditForumTopic.
type EditGeneralForumTopicParams ¶
type EditGeneralForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// New topic name, 1-128 characters
Name string `json:"name"`
}
EditGeneralForumTopicParams holds the parameters of EditGeneralForumTopic.
type EditMessageCaptionParams ¶
type EditMessageCaptionParams struct {
// Unique identifier of the business connection on behalf of which the message to be edited was
// sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Required if inline_message_id is not specified.
ChatID models.ChatID `json:"chat_id,omitzero"`
// Required if inline_message_id is not specified.
MessageID *int64 `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified.
InlineMessageID *string `json:"inline_message_id,omitempty"`
// New caption of the message, 0-1024 characters after entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the message caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Pass True if the caption must be shown above the message media.
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditMessageCaptionParams holds the parameters of EditMessageCaption.
type EditMessageChecklistParams ¶
type EditMessageChecklistParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier for the target chat or username of the target bot in the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message
MessageID int64 `json:"message_id"`
// A JSON-serialized object for the new checklist
Checklist models.InputChecklist `json:"checklist"`
// A JSON-serialized object for the new inline keyboard for the message
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditMessageChecklistParams holds the parameters of EditMessageChecklist.
type EditMessageLiveLocationParams ¶
type EditMessageLiveLocationParams struct {
// Unique identifier of the business connection on behalf of which the message to be edited was
// sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Required if inline_message_id is not specified.
ChatID models.ChatID `json:"chat_id,omitzero"`
// Required if inline_message_id is not specified.
MessageID *int64 `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified.
InlineMessageID *string `json:"inline_message_id,omitempty"`
// Latitude of new location
Latitude float64 `json:"latitude"`
// Longitude of new location
Longitude float64 `json:"longitude"`
// New period in seconds during which the location can be updated, starting from the message send
// date.
LivePeriod *int `json:"live_period,omitempty"`
// The radius of uncertainty for the location, measured in meters; 0-1500
HorizontalAccuracy *float64 `json:"horizontal_accuracy,omitempty"`
// Direction in which the user is moving, in degrees.
Heading *int `json:"heading,omitempty"`
// The maximum distance for proximity alerts about approaching another chat member, in meters.
ProximityAlertRadius *int `json:"proximity_alert_radius,omitempty"`
// A JSON-serialized object for a new inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditMessageLiveLocationParams holds the parameters of EditMessageLiveLocation.
type EditMessageMediaParams ¶
type EditMessageMediaParams struct {
// Unique identifier of the business connection on behalf of which the message to be edited was
// sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Required if inline_message_id is not specified.
ChatID models.ChatID `json:"chat_id,omitzero"`
// Required if inline_message_id is not specified.
MessageID *int64 `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified.
InlineMessageID *string `json:"inline_message_id,omitempty"`
// A JSON-serialized object for the new media content of the message
Media models.InputMedia `json:"media"`
// A JSON-serialized object for a new inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditMessageMediaParams holds the parameters of EditMessageMedia.
type EditMessageReplyMarkupParams ¶
type EditMessageReplyMarkupParams struct {
// Unique identifier of the business connection on behalf of which the message to be edited was
// sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Required if inline_message_id is not specified.
ChatID models.ChatID `json:"chat_id,omitzero"`
// Required if inline_message_id is not specified.
MessageID *int64 `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified.
InlineMessageID *string `json:"inline_message_id,omitempty"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditMessageReplyMarkupParams holds the parameters of EditMessageReplyMarkup.
type EditMessageTextParams ¶
type EditMessageTextParams struct {
// Unique identifier of the business connection on behalf of which the message to be edited was
// sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Required if inline_message_id is not specified.
ChatID models.ChatID `json:"chat_id,omitzero"`
// Required if inline_message_id is not specified.
MessageID *int64 `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified.
InlineMessageID *string `json:"inline_message_id,omitempty"`
// New text of the message, 1-4096 characters after entity parsing; required if rich_message isn't
// specified
Text *string `json:"text,omitempty"`
// Mode for parsing entities in the message text.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in message text, which can be specified
// instead of parse_mode
Entities []models.MessageEntity `json:"entities,omitzero"`
// Link preview generation options for the message
LinkPreviewOptions *models.LinkPreviewOptions `json:"link_preview_options,omitempty"`
// New rich content of the message; required if text isn't specified.
RichMessage *models.InputRichMessage `json:"rich_message,omitempty"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
EditMessageTextParams holds the parameters of EditMessageText.
type EditStoryParams ¶
type EditStoryParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier of the story to edit
StoryID int64 `json:"story_id"`
// Content of the story
Content models.InputStoryContent `json:"content"`
// Caption of the story, 0-2048 characters after entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the story caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// A JSON-serialized list of clickable areas to be shown on the story
Areas []models.StoryArea `json:"areas,omitzero"`
}
EditStoryParams holds the parameters of EditStory.
type EditUserStarSubscriptionParams ¶
type EditUserStarSubscriptionParams struct {
// Identifier of the user whose subscription will be edited
UserID int64 `json:"user_id"`
// Telegram payment identifier for the subscription
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
// Pass True to cancel extension of the user subscription; the subscription must be active up to
// the end of the current subscription period.
IsCanceled bool `json:"is_canceled"`
}
EditUserStarSubscriptionParams holds the parameters of EditUserStarSubscription.
type Error ¶
type Error struct {
ErrorCode int
Description string
Parameters *models.ResponseParameters
Method string
}
Error is an error returned by the Bot API.
func (*Error) Is ¶
Is reports whether e matches target, one of the errors of this package.
Example ¶
errors.Is tells the failures of the Bot API apart by name, here while sending news to users who may have blocked the bot or deleted their account since they subscribed.
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/DhurghamAhmed/teleiq"
"github.com/DhurghamAhmed/teleiq/models"
"github.com/DhurghamAhmed/teleiq/teleiqtest"
)
func main() {
srv := teleiqtest.NewServer()
defer srv.Close()
client, err := teleiq.NewClient(teleiqtest.Token, teleiq.WithBaseURL(srv.URL), teleiq.WithRetryPolicy(teleiq.Backoff{MaxAttempts: 1}))
if err != nil {
log.Fatal(err)
}
srv.Fail("sendMessage", &teleiq.Error{ErrorCode: 403, Description: "Forbidden: bot was blocked by the user"})
_, err = client.SendMessage(context.Background(), teleiq.SendMessageParams{ChatID: models.ID(7), Text: "News"})
switch {
case errors.Is(err, teleiq.ErrBotBlocked), errors.Is(err, teleiq.ErrUserDeactivated):
fmt.Println("unsubscribe user 7")
case errors.Is(err, teleiq.ErrTooManyRequests):
fmt.Println("send later")
case err != nil:
fmt.Println("failed:", err)
}
}
Output: unsubscribe user 7
type ExportChatInviteLinkParams ¶
type ExportChatInviteLinkParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
}
ExportChatInviteLinkParams holds the parameters of ExportChatInviteLink.
type ForwardMessageParams ¶
type ForwardMessageParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be forwarded; required if the
// message is forwarded to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// Unique identifier for the chat where the original message was sent (or username of the target
// bot, supergroup or channel in the format @username)
FromChatID models.ChatID `json:"from_chat_id"`
// New start timestamp for the forwarded video in the message
VideoStartTimestamp *int `json:"video_start_timestamp,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the forwarded message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Unique identifier of the message effect to be added to the message; only available when
// forwarding to private chats
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Message identifier in the chat specified in from_chat_id
MessageID int64 `json:"message_id"`
}
ForwardMessageParams holds the parameters of ForwardMessage.
type ForwardMessagesParams ¶
type ForwardMessagesParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the messages will be forwarded; required if the
// messages are forwarded to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// Unique identifier for the chat where the original messages were sent (or username of the target
// bot, supergroup or channel in the format @username)
FromChatID models.ChatID `json:"from_chat_id"`
// A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward.
MessageIDs []int64 `json:"message_ids"`
// Sends the messages silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the forwarded messages from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
}
ForwardMessagesParams holds the parameters of ForwardMessages.
type GetBusinessAccountGiftsParams ¶
type GetBusinessAccountGiftsParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Pass True to exclude gifts that aren't saved to the account's profile page
ExcludeUnsaved *bool `json:"exclude_unsaved,omitempty"`
// Pass True to exclude gifts that are saved to the account's profile page
ExcludeSaved *bool `json:"exclude_saved,omitempty"`
// Pass True to exclude gifts that can be purchased an unlimited number of times
ExcludeUnlimited *bool `json:"exclude_unlimited,omitempty"`
// Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded
// to unique
ExcludeLimitedUpgradable *bool `json:"exclude_limited_upgradable,omitempty"`
// Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded
// to unique
ExcludeLimitedNonUpgradable *bool `json:"exclude_limited_non_upgradable,omitempty"`
// Pass True to exclude unique gifts
ExcludeUnique *bool `json:"exclude_unique,omitempty"`
// Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or
// transferred in Telegram
ExcludeFromBlockchain *bool `json:"exclude_from_blockchain,omitempty"`
// Pass True to sort results by gift price instead of send date.
SortByPrice *bool `json:"sort_by_price,omitempty"`
// Offset of the first entry to return as received from the previous request; use empty string to
// get the first chunk of results
Offset *string `json:"offset,omitempty"`
// The maximum number of gifts to be returned; 1-100.
Limit *int `json:"limit,omitempty"`
}
GetBusinessAccountGiftsParams holds the parameters of GetBusinessAccountGifts.
type GetBusinessAccountStarBalanceParams ¶
type GetBusinessAccountStarBalanceParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
}
GetBusinessAccountStarBalanceParams holds the parameters of GetBusinessAccountStarBalance.
type GetBusinessConnectionParams ¶
type GetBusinessConnectionParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
}
GetBusinessConnectionParams holds the parameters of GetBusinessConnection.
type GetChatAdministratorsParams ¶
type GetChatAdministratorsParams struct {
// Unique identifier for the target chat or username of the target supergroup or channel in the
// format @username
ChatID models.ChatID `json:"chat_id"`
// Pass True to additionally receive all bots that are administrators of the chat.
ReturnBots *bool `json:"return_bots,omitempty"`
}
GetChatAdministratorsParams holds the parameters of GetChatAdministrators.
type GetChatGiftsParams ¶
type GetChatGiftsParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Pass True to exclude gifts that aren't saved to the chat's profile page.
ExcludeUnsaved *bool `json:"exclude_unsaved,omitempty"`
// Pass True to exclude gifts that are saved to the chat's profile page.
ExcludeSaved *bool `json:"exclude_saved,omitempty"`
// Pass True to exclude gifts that can be purchased an unlimited number of times
ExcludeUnlimited *bool `json:"exclude_unlimited,omitempty"`
// Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded
// to unique
ExcludeLimitedUpgradable *bool `json:"exclude_limited_upgradable,omitempty"`
// Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded
// to unique
ExcludeLimitedNonUpgradable *bool `json:"exclude_limited_non_upgradable,omitempty"`
// Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or
// transferred in Telegram
ExcludeFromBlockchain *bool `json:"exclude_from_blockchain,omitempty"`
// Pass True to exclude unique gifts
ExcludeUnique *bool `json:"exclude_unique,omitempty"`
// Pass True to sort results by gift price instead of send date.
SortByPrice *bool `json:"sort_by_price,omitempty"`
// Offset of the first entry to return as received from the previous request; use an empty string
// to get the first chunk of results
Offset *string `json:"offset,omitempty"`
// The maximum number of gifts to be returned; 1-100.
Limit *int `json:"limit,omitempty"`
}
GetChatGiftsParams holds the parameters of GetChatGifts.
type GetChatMemberCountParams ¶
type GetChatMemberCountParams struct {
// Unique identifier for the target chat or username of the target supergroup or channel in the
// format @username
ChatID models.ChatID `json:"chat_id"`
}
GetChatMemberCountParams holds the parameters of GetChatMemberCount.
type GetChatMemberParams ¶
type GetChatMemberParams struct {
// Unique identifier for the target chat or username of the target supergroup or channel in the
// format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
}
GetChatMemberParams holds the parameters of GetChatMember.
type GetChatMenuButtonParams ¶
type GetChatMenuButtonParams struct {
// Unique identifier for the target private chat.
ChatID *int64 `json:"chat_id,omitempty"`
}
GetChatMenuButtonParams holds the parameters of GetChatMenuButton.
type GetChatParams ¶
type GetChatParams struct {
// Unique identifier for the target chat or username of the target supergroup or channel in the
// format @username
ChatID models.ChatID `json:"chat_id"`
}
GetChatParams holds the parameters of GetChat.
type GetCustomEmojiStickersParams ¶
type GetCustomEmojiStickersParams struct {
// A JSON-serialized list of custom emoji identifiers.
CustomEmojiIDs []string `json:"custom_emoji_ids"`
}
GetCustomEmojiStickersParams holds the parameters of GetCustomEmojiStickers.
type GetFileParams ¶
type GetFileParams struct {
// File identifier to get information about
FileID string `json:"file_id"`
}
GetFileParams holds the parameters of GetFile.
type GetGameHighScoresParams ¶
type GetGameHighScoresParams struct {
// Target user id
UserID int64 `json:"user_id"`
// Required if inline_message_id is not specified.
ChatID *int64 `json:"chat_id,omitempty"`
// Required if inline_message_id is not specified.
MessageID *int64 `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified.
InlineMessageID *string `json:"inline_message_id,omitempty"`
}
GetGameHighScoresParams holds the parameters of GetGameHighScores.
type GetManagedBotAccessSettingsParams ¶
type GetManagedBotAccessSettingsParams struct {
// User identifier of the managed bot whose access settings will be returned
UserID int64 `json:"user_id"`
}
GetManagedBotAccessSettingsParams holds the parameters of GetManagedBotAccessSettings.
type GetManagedBotTokenParams ¶
type GetManagedBotTokenParams struct {
// User identifier of the managed bot whose token will be returned
UserID int64 `json:"user_id"`
}
GetManagedBotTokenParams holds the parameters of GetManagedBotToken.
type GetMyCommandsParams ¶
type GetMyCommandsParams struct {
// A JSON-serialized object, describing scope of users.
Scope models.BotCommandScope `json:"scope,omitempty"`
// A two-letter ISO 639-1 language code or an empty string
LanguageCode *string `json:"language_code,omitempty"`
}
GetMyCommandsParams holds the parameters of GetMyCommands.
type GetMyDefaultAdministratorRightsParams ¶
type GetMyDefaultAdministratorRightsParams struct {
// Pass True to get default administrator rights of the bot in channels.
ForChannels *bool `json:"for_channels,omitempty"`
}
GetMyDefaultAdministratorRightsParams holds the parameters of GetMyDefaultAdministratorRights.
type GetMyDescriptionParams ¶
type GetMyDescriptionParams struct {
// A two-letter ISO 639-1 language code or an empty string
LanguageCode *string `json:"language_code,omitempty"`
}
GetMyDescriptionParams holds the parameters of GetMyDescription.
type GetMyNameParams ¶
type GetMyNameParams struct {
// A two-letter ISO 639-1 language code or an empty string
LanguageCode *string `json:"language_code,omitempty"`
}
GetMyNameParams holds the parameters of GetMyName.
type GetMyShortDescriptionParams ¶
type GetMyShortDescriptionParams struct {
// A two-letter ISO 639-1 language code or an empty string
LanguageCode *string `json:"language_code,omitempty"`
}
GetMyShortDescriptionParams holds the parameters of GetMyShortDescription.
type GetStarTransactionsParams ¶
type GetStarTransactionsParams struct {
// Number of transactions to skip in the response
Offset *int `json:"offset,omitempty"`
// The maximum number of transactions to be retrieved.
Limit *int `json:"limit,omitempty"`
}
GetStarTransactionsParams holds the parameters of GetStarTransactions.
type GetStickerSetParams ¶
type GetStickerSetParams struct {
// Name of the sticker set
Name string `json:"name"`
}
GetStickerSetParams holds the parameters of GetStickerSet.
type GetUpdatesParams ¶
type GetUpdatesParams struct {
// Identifier of the first update to be returned.
Offset *int64 `json:"offset,omitempty"`
// Limits the number of updates to be retrieved.
Limit *int `json:"limit,omitempty"`
// Timeout in seconds for long polling.
Timeout *int `json:"timeout,omitempty"`
// A JSON-serialized list of the update types you want your bot to receive.
AllowedUpdates []string `json:"allowed_updates,omitzero"`
}
GetUpdatesParams holds the parameters of GetUpdates.
type GetUserChatBoostsParams ¶
type GetUserChatBoostsParams struct {
// Unique identifier for the chat or username of the channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
}
GetUserChatBoostsParams holds the parameters of GetUserChatBoosts.
type GetUserGiftsParams ¶
type GetUserGiftsParams struct {
// Unique identifier of the user
UserID int64 `json:"user_id"`
// Pass True to exclude gifts that can be purchased an unlimited number of times
ExcludeUnlimited *bool `json:"exclude_unlimited,omitempty"`
// Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded
// to unique
ExcludeLimitedUpgradable *bool `json:"exclude_limited_upgradable,omitempty"`
// Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded
// to unique
ExcludeLimitedNonUpgradable *bool `json:"exclude_limited_non_upgradable,omitempty"`
// Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or
// transferred in Telegram
ExcludeFromBlockchain *bool `json:"exclude_from_blockchain,omitempty"`
// Pass True to exclude unique gifts
ExcludeUnique *bool `json:"exclude_unique,omitempty"`
// Pass True to sort results by gift price instead of send date.
SortByPrice *bool `json:"sort_by_price,omitempty"`
// Offset of the first entry to return as received from the previous request; use an empty string
// to get the first chunk of results
Offset *string `json:"offset,omitempty"`
// The maximum number of gifts to be returned; 1-100.
Limit *int `json:"limit,omitempty"`
}
GetUserGiftsParams holds the parameters of GetUserGifts.
type GetUserPersonalChatMessagesParams ¶
type GetUserPersonalChatMessagesParams struct {
// Unique identifier for the target user
UserID int64 `json:"user_id"`
// The maximum number of messages to return; 1-20
Limit int `json:"limit"`
}
GetUserPersonalChatMessagesParams holds the parameters of GetUserPersonalChatMessages.
type GetUserProfileAudiosParams ¶
type GetUserProfileAudiosParams struct {
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// Sequential number of the first audio to be returned.
Offset *int `json:"offset,omitempty"`
// Limits the number of audios to be retrieved.
Limit *int `json:"limit,omitempty"`
}
GetUserProfileAudiosParams holds the parameters of GetUserProfileAudios.
type GetUserProfilePhotosParams ¶
type GetUserProfilePhotosParams struct {
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// Sequential number of the first photo to be returned.
Offset *int `json:"offset,omitempty"`
// Limits the number of photos to be retrieved.
Limit *int `json:"limit,omitempty"`
}
GetUserProfilePhotosParams holds the parameters of GetUserProfilePhotos.
type GiftPremiumSubscriptionParams ¶
type GiftPremiumSubscriptionParams struct {
// Unique identifier of the target user who will receive a Telegram Premium subscription
UserID int64 `json:"user_id"`
// Number of months the Telegram Premium subscription will be active for the user; must be one of
// 3, 6, or 12
MonthCount int `json:"month_count"`
// Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3
// months, 1500 for 6 months, and 2500 for 12 months
StarCount int `json:"star_count"`
// Text that will be shown along with the service message about the subscription; 0-128 characters
Text *string `json:"text,omitempty"`
// Mode for parsing entities in the text.
TextParseMode *string `json:"text_parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the gift text.
TextEntities []models.MessageEntity `json:"text_entities,omitzero"`
}
GiftPremiumSubscriptionParams holds the parameters of GiftPremiumSubscription.
type HideGeneralForumTopicParams ¶
type HideGeneralForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
}
HideGeneralForumTopicParams holds the parameters of HideGeneralForumTopic.
type LeaveChatParams ¶
type LeaveChatParams struct {
// Unique identifier for the target chat or username of the target supergroup or channel in the
// format @username.
ChatID models.ChatID `json:"chat_id"`
}
LeaveChatParams holds the parameters of LeaveChat.
type Option ¶
type Option func(*options) error
Option configures a Client created by NewClient.
func WithBaseURL ¶
WithBaseURL sends requests to a Bot API server other than api.telegram.org.
func WithDefaultTimeout ¶
WithDefaultTimeout sets the timeout for calls whose context has no deadline.
func WithDefaults ¶
WithDefaults makes the Client send d for the parameters that a call leaves nil.
Example ¶
WithDefaults sets the parse mode once for every message, and a call that sets its own keeps it.
package main
import (
"context"
"fmt"
"log"
"github.com/DhurghamAhmed/teleiq"
"github.com/DhurghamAhmed/teleiq/models"
"github.com/DhurghamAhmed/teleiq/teleiqtest"
)
func main() {
srv := teleiqtest.NewServer()
defer srv.Close()
client, err := teleiq.NewClient(teleiqtest.Token, teleiq.WithBaseURL(srv.URL),
teleiq.WithDefaults(teleiq.Defaults{ParseMode: teleiq.ParseModeHTML}))
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
for _, p := range []teleiq.SendMessageParams{
{ChatID: models.ID(7), Text: "<b>Hello</b>"},
{ChatID: models.ID(7), Text: "2 < 3", ParseMode: teleiq.Ptr("")}, // plain text
} {
if _, err := client.SendMessage(ctx, p); err != nil {
log.Fatal(err)
}
}
for _, r := range srv.Requests("sendMessage") {
fmt.Printf("%q %q\n", r.Params["text"], r.Params["parse_mode"])
}
}
Output: "<b>Hello</b>" "HTML" "2 < 3" ""
func WithHTTPClient ¶
WithHTTPClient sends requests through c, which is used as is.
func WithLogger ¶
WithLogger logs requests, retries, flood waits and downloads to l.
func WithRateLimiter ¶
func WithRateLimiter(l RateLimiter) Option
WithRateLimiter makes every request wait for l before it is sent.
func WithRetryPolicy ¶
func WithRetryPolicy(p RetryPolicy) Option
WithRetryPolicy sets how failed requests are retried; the default is Backoff{}.
func WithTransport ¶
WithTransport replaces how requests reach the Bot API.
type PinChatMessageParams ¶
type PinChatMessageParams struct {
// Unique identifier of the business connection on behalf of which the message will be pinned
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of a message to pin
MessageID int64 `json:"message_id"`
// Pass True if it is not necessary to send a notification to all chat members about the new pinned
// message.
DisableNotification *bool `json:"disable_notification,omitempty"`
}
PinChatMessageParams holds the parameters of PinChatMessage.
type PostStoryParams ¶
type PostStoryParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Content of the story
Content models.InputStoryContent `json:"content"`
// Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 *
// 3600, 86400, or 2 * 86400
ActivePeriod int `json:"active_period"`
// Caption of the story, 0-2048 characters after entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the story caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// A JSON-serialized list of clickable areas to be shown on the story
Areas []models.StoryArea `json:"areas,omitzero"`
// Pass True to keep the story accessible after it expires
PostToChatPage *bool `json:"post_to_chat_page,omitempty"`
// Pass True if the content of the story must be protected from forwarding and screenshotting
ProtectContent *bool `json:"protect_content,omitempty"`
}
PostStoryParams holds the parameters of PostStory.
type PromoteChatMemberParams ¶
type PromoteChatMemberParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// Pass True if the administrator's presence in the chat is hidden
IsAnonymous *bool `json:"is_anonymous,omitempty"`
// Pass True if the administrator can access the chat event log, get boost list, see hidden
// supergroup and channel members, report spam messages, ignore slow mode, and send messages to the
// chat without paying Telegram Stars.
CanManageChat *bool `json:"can_manage_chat,omitempty"`
// Pass True if the administrator can delete messages of other users
CanDeleteMessages *bool `json:"can_delete_messages,omitempty"`
// Pass True if the administrator can manage video chats
CanManageVideoChats *bool `json:"can_manage_video_chats,omitempty"`
// Pass True if the administrator can restrict, ban or unban chat members, or access supergroup
// statistics.
CanRestrictMembers *bool `json:"can_restrict_members,omitempty"`
// Pass True if the administrator can add new administrators with a subset of their own privileges
// or demote administrators that they have promoted, directly or indirectly (promoted by
// administrators that were appointed by him)
CanPromoteMembers *bool `json:"can_promote_members,omitempty"`
// Pass True if the administrator can change chat title, photo and other settings
CanChangeInfo *bool `json:"can_change_info,omitempty"`
// Pass True if the administrator can invite new users to the chat
CanInviteUsers *bool `json:"can_invite_users,omitempty"`
// Pass True if the administrator can post stories to the chat
CanPostStories *bool `json:"can_post_stories,omitempty"`
// Pass True if the administrator can edit stories posted by other users, post stories to the chat
// page, pin chat stories, and access the chat's story archive
CanEditStories *bool `json:"can_edit_stories,omitempty"`
// Pass True if the administrator can delete stories posted by other users
CanDeleteStories *bool `json:"can_delete_stories,omitempty"`
// Pass True if the administrator can post messages in the channel, approve suggested posts, or
// access channel statistics; for channels only
CanPostMessages *bool `json:"can_post_messages,omitempty"`
// Pass True if the administrator can edit messages of other users and can pin messages; for
// channels only
CanEditMessages *bool `json:"can_edit_messages,omitempty"`
// Pass True if the administrator can pin messages; for supergroups only
CanPinMessages *bool `json:"can_pin_messages,omitempty"`
// Pass True if the user is allowed to create, rename, close, and reopen forum topics; for
// supergroups only
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
// Pass True if the administrator can manage direct messages within the channel and decline
// suggested posts; for channels only
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
// Pass True if the administrator can edit the tags of regular members; for groups and supergroups
// only
CanManageTags *bool `json:"can_manage_tags,omitempty"`
// Pass True if the administrator can manage chat welcome messages or directly send them in the
// case of bots
CanSendWelcomeMessages *bool `json:"can_send_welcome_messages,omitempty"`
}
PromoteChatMemberParams holds the parameters of PromoteChatMember.
type RateLimiter ¶
type RateLimiter interface {
// Wait blocks until a request to method for chat may be sent, or returns an error.
Wait(ctx context.Context, method string, chat models.ChatID) error
}
RateLimiter paces requests before they are sent.
func NewRateLimiter ¶
func NewRateLimiter(perSecond int, chatEvery, groupEvery time.Duration) RateLimiter
NewRateLimiter returns a RateLimiter that paces requests overall and per chat.
Example ¶
A bot that broadcasts paces its messages to the free limits of Telegram: about 30 messages a second in all, one a second in a chat and 20 a minute in a group. Chat 7 is sent to twice, so its second message waits a second; the others go at once.
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/DhurghamAhmed/teleiq"
"github.com/DhurghamAhmed/teleiq/models"
"github.com/DhurghamAhmed/teleiq/teleiqtest"
)
func main() {
srv := teleiqtest.NewServer()
defer srv.Close()
client, err := teleiq.NewClient(teleiqtest.Token, teleiq.WithBaseURL(srv.URL),
teleiq.WithRateLimiter(teleiq.NewRateLimiter(30, time.Second, 3*time.Second)))
if err != nil {
log.Fatal(err)
}
start := time.Now()
for _, chat := range []int64{7, 8, 9, 7} {
if _, err := client.SendMessage(context.Background(), teleiq.SendMessageParams{ChatID: models.ID(chat), Text: "News"}); err != nil {
log.Fatal(err)
}
}
fmt.Println(len(srv.Requests("sendMessage")), "messages in", time.Since(start).Round(time.Second))
}
Output: 4 messages in 1s
type ReadBusinessMessageParams ¶
type ReadBusinessMessageParams struct {
// Unique identifier of the business connection on behalf of which to read the message
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier of the chat in which the message was received.
ChatID int64 `json:"chat_id"`
// Unique identifier of the message to mark as read
MessageID int64 `json:"message_id"`
}
ReadBusinessMessageParams holds the parameters of ReadBusinessMessage.
type RefundStarPaymentParams ¶
type RefundStarPaymentParams struct {
// Identifier of the user whose payment will be refunded
UserID int64 `json:"user_id"`
// Telegram payment identifier
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
}
RefundStarPaymentParams holds the parameters of RefundStarPayment.
type RemoveBusinessAccountProfilePhotoParams ¶
type RemoveBusinessAccountProfilePhotoParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Pass True to remove the public photo, which is visible even if the main photo is hidden by the
// business account's privacy settings.
IsPublic *bool `json:"is_public,omitempty"`
}
RemoveBusinessAccountProfilePhotoParams holds the parameters of RemoveBusinessAccountProfilePhoto.
type RemoveChatVerificationParams ¶
type RemoveChatVerificationParams struct {
// Unique identifier for the target chat or username of the target bot or channel in the format
// @username
ChatID models.ChatID `json:"chat_id"`
}
RemoveChatVerificationParams holds the parameters of RemoveChatVerification.
type RemoveUserVerificationParams ¶
type RemoveUserVerificationParams struct {
// Unique identifier of the target user
UserID int64 `json:"user_id"`
}
RemoveUserVerificationParams holds the parameters of RemoveUserVerification.
type ReopenForumTopicParams ¶
type ReopenForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread of the forum topic
MessageThreadID int64 `json:"message_thread_id"`
}
ReopenForumTopicParams holds the parameters of ReopenForumTopic.
type ReopenGeneralForumTopicParams ¶
type ReopenGeneralForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
}
ReopenGeneralForumTopicParams holds the parameters of ReopenGeneralForumTopic.
type ReplaceManagedBotTokenParams ¶
type ReplaceManagedBotTokenParams struct {
// User identifier of the managed bot whose token will be replaced
UserID int64 `json:"user_id"`
}
ReplaceManagedBotTokenParams holds the parameters of ReplaceManagedBotToken.
type ReplaceStickerInSetParams ¶
type ReplaceStickerInSetParams struct {
// User identifier of the sticker set owner
UserID int64 `json:"user_id"`
// Sticker set name
Name string `json:"name"`
// File identifier of the replaced sticker
OldSticker string `json:"old_sticker"`
// A JSON-serialized object with information about the added sticker.
Sticker models.InputSticker `json:"sticker"`
}
ReplaceStickerInSetParams holds the parameters of ReplaceStickerInSet.
type RepostStoryParams ¶
type RepostStoryParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier of the chat which posted the story that should be reposted
FromChatID int64 `json:"from_chat_id"`
// Unique identifier of the story that should be reposted
FromStoryID int64 `json:"from_story_id"`
// Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 *
// 3600, 86400, or 2 * 86400
ActivePeriod int `json:"active_period"`
// Pass True to keep the story accessible after it expires
PostToChatPage *bool `json:"post_to_chat_page,omitempty"`
// Pass True if the content of the story must be protected from forwarding and screenshotting
ProtectContent *bool `json:"protect_content,omitempty"`
}
RepostStoryParams holds the parameters of RepostStory.
type Response ¶
type Response struct {
StatusCode int
Body []byte
RetryAfter time.Duration // the Retry-After header of a 429 reply, if any
}
Response is the HTTP status and raw body of a Bot API reply.
type RestrictChatMemberParams ¶
type RestrictChatMemberParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// A JSON-serialized object for new user permissions
Permissions models.ChatPermissions `json:"permissions"`
// Pass True if chat permissions are set independently.
UseIndependentChatPermissions *bool `json:"use_independent_chat_permissions,omitempty"`
// Date when restrictions will be lifted for the user; Unix time.
UntilDate *int64 `json:"until_date,omitempty"`
}
RestrictChatMemberParams holds the parameters of RestrictChatMember.
type RetryPolicy ¶
type RetryPolicy interface {
// Retry returns the delay before the next attempt, or false to stop.
Retry(attempt int, err error) (time.Duration, bool)
}
RetryPolicy decides whether and when a failed request is sent again.
type RevokeChatInviteLinkParams ¶
type RevokeChatInviteLinkParams struct {
// Unique identifier of the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// The invite link to revoke
InviteLink string `json:"invite_link"`
}
RevokeChatInviteLinkParams holds the parameters of RevokeChatInviteLink.
type SavePreparedInlineMessageParams ¶
type SavePreparedInlineMessageParams struct {
// Unique identifier of the target user that can use the prepared message
UserID int64 `json:"user_id"`
// A JSON-serialized object describing the message to be sent
Result models.InlineQueryResult `json:"result"`
// Pass True if the message can be sent to private chats with users
AllowUserChats *bool `json:"allow_user_chats,omitempty"`
// Pass True if the message can be sent to private chats with bots
AllowBotChats *bool `json:"allow_bot_chats,omitempty"`
// Pass True if the message can be sent to group and supergroup chats
AllowGroupChats *bool `json:"allow_group_chats,omitempty"`
// Pass True if the message can be sent to channel chats
AllowChannelChats *bool `json:"allow_channel_chats,omitempty"`
}
SavePreparedInlineMessageParams holds the parameters of SavePreparedInlineMessage.
type SavePreparedKeyboardButtonParams ¶
type SavePreparedKeyboardButtonParams struct {
// Unique identifier of the target user that can use the button
UserID int64 `json:"user_id"`
// A JSON-serialized object describing the button to be saved.
Button models.KeyboardButton `json:"button"`
}
SavePreparedKeyboardButtonParams holds the parameters of SavePreparedKeyboardButton.
type SendAnimationParams ¶
type SendAnimationParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Animation to send.
Animation models.InputFile `json:"animation"`
// Duration of sent animation in seconds
Duration *int `json:"duration,omitempty"`
// Animation width
Width *int `json:"width,omitempty"`
// Animation height
Height *int `json:"height,omitempty"`
// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
// server-side.
Thumbnail models.InputFile `json:"thumbnail,omitzero"`
// Animation caption (may also be used when resending animation by file_id), 0-1024 characters
// after entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the animation caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// Pass True if the animation needs to be covered with a spoiler animation
HasSpoiler *bool `json:"has_spoiler,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendAnimationParams holds the parameters of SendAnimation.
type SendAudioParams ¶
type SendAudioParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Audio file to send.
Audio models.InputFile `json:"audio"`
// Audio caption, 0-1024 characters after entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the audio caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Duration of the audio in seconds
Duration *int `json:"duration,omitempty"`
// Performer
Performer *string `json:"performer,omitempty"`
// Track name
Title *string `json:"title,omitempty"`
// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
// server-side.
Thumbnail models.InputFile `json:"thumbnail,omitzero"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendAudioParams holds the parameters of SendAudio.
type SendChatActionParams ¶
type SendChatActionParams struct {
// Unique identifier of the business connection on behalf of which the action will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot or supergroup in the format
// @username.
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread or topic of a forum; for supergroups and private
// chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Type of action to broadcast.
Action string `json:"action"`
}
SendChatActionParams holds the parameters of SendChatAction.
type SendChatJoinRequestWebAppParams ¶
type SendChatJoinRequestWebAppParams struct {
// Unique identifier of the join request query
ChatJoinRequestQueryID string `json:"chat_join_request_query_id"`
// An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web
// Apps
WebAppURL string `json:"web_app_url"`
}
SendChatJoinRequestWebAppParams holds the parameters of SendChatJoinRequestWebApp.
type SendChecklistParams ¶
type SendChecklistParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier for the target chat or username of the target bot in the format @username
ChatID models.ChatID `json:"chat_id"`
// A JSON-serialized object for the checklist to send
Checklist models.InputChecklist `json:"checklist"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Unique identifier of the message effect to be added to the message
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object for description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
SendChecklistParams holds the parameters of SendChecklist.
type SendContactParams ¶
type SendContactParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Contact's phone number
PhoneNumber string `json:"phone_number"`
// Contact's first name
FirstName string `json:"first_name"`
// Contact's last name
LastName *string `json:"last_name,omitempty"`
// Additional data about the contact in the form of a vCard, 0-2048 bytes
Vcard *string `json:"vcard,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendContactParams holds the parameters of SendContact.
type SendDiceParams ¶
type SendDiceParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// Emoji on which the dice throw animation is based.
Emoji *string `json:"emoji,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendDiceParams holds the parameters of SendDice.
type SendDocumentParams ¶
type SendDocumentParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// File to send.
Document models.InputFile `json:"document"`
// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
// server-side.
Thumbnail models.InputFile `json:"thumbnail,omitzero"`
// Document caption (may also be used when resending documents by file_id), 0-1024 characters after
// entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the document caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Disables automatic server-side content type detection for files uploaded using
// multipart/form-data
DisableContentTypeDetection *bool `json:"disable_content_type_detection,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendDocumentParams holds the parameters of SendDocument.
type SendGameParams ¶
type SendGameParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot in the format @username.
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Short name of the game, serves as the unique identifier for the game.
GameShortName string `json:"game_short_name"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// A JSON-serialized object for an inline keyboard.
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
SendGameParams holds the parameters of SendGame.
type SendGiftParams ¶
type SendGiftParams struct {
// Required if chat_id is not specified.
UserID *int64 `json:"user_id,omitempty"`
// Required if user_id is not specified.
ChatID models.ChatID `json:"chat_id,omitzero"`
// Identifier of the gift; limited gifts can't be sent to channel chats
GiftID string `json:"gift_id"`
// Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free
// for the receiver
PayForUpgrade *bool `json:"pay_for_upgrade,omitempty"`
// Text that will be shown along with the gift; 0-128 characters
Text *string `json:"text,omitempty"`
// Mode for parsing entities in the text.
TextParseMode *string `json:"text_parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the gift text.
TextEntities []models.MessageEntity `json:"text_entities,omitzero"`
}
SendGiftParams holds the parameters of SendGift.
type SendInvoiceParams ¶
type SendInvoiceParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// Product name, 1-32 characters
Title string `json:"title"`
// Product description, 1-255 characters
Description string `json:"description"`
// Bot-defined invoice payload, 1-128 bytes.
Payload string `json:"payload"`
// Payment provider token, obtained via @BotFather.
ProviderToken *string `json:"provider_token,omitempty"`
// Three-letter ISO 4217 currency code, see more on currencies.
Currency string `json:"currency"`
// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount,
// delivery cost, delivery tax, bonus, etc.).
Prices []models.LabeledPrice `json:"prices"`
// The maximum accepted amount for tips in the smallest units of the currency (integer, not
// float/double).
MaxTipAmount *int `json:"max_tip_amount,omitempty"`
// A JSON-serialized Array of suggested amounts of tips in the smallest units of the currency
// (integer, not float/double).
SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitzero"`
// Unique deep-linking parameter.
StartParameter *string `json:"start_parameter,omitempty"`
// JSON-serialized data about the invoice, which will be shared with the payment provider.
ProviderData *string `json:"provider_data,omitempty"`
// URL of the product photo for the invoice.
PhotoURL *string `json:"photo_url,omitempty"`
// Photo size in bytes
PhotoSize *int `json:"photo_size,omitempty"`
// Photo width
PhotoWidth *int `json:"photo_width,omitempty"`
// Photo height
PhotoHeight *int `json:"photo_height,omitempty"`
// Pass True if you require the user's full name to complete the order.
NeedName *bool `json:"need_name,omitempty"`
// Pass True if you require the user's phone number to complete the order.
NeedPhoneNumber *bool `json:"need_phone_number,omitempty"`
// Pass True if you require the user's email address to complete the order.
NeedEmail *bool `json:"need_email,omitempty"`
// Pass True if you require the user's shipping address to complete the order.
NeedShippingAddress *bool `json:"need_shipping_address,omitempty"`
// Pass True if the user's phone number should be sent to the provider.
SendPhoneNumberToProvider *bool `json:"send_phone_number_to_provider,omitempty"`
// Pass True if the user's email address should be sent to the provider.
SendEmailToProvider *bool `json:"send_email_to_provider,omitempty"`
// Pass True if the final price depends on the shipping method.
IsFlexible *bool `json:"is_flexible,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// A JSON-serialized object for an inline keyboard.
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
SendInvoiceParams holds the parameters of SendInvoice.
type SendLivePhotoParams ¶
type SendLivePhotoParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target channel (in the format
// @channelusername)
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Live photo video to send.
LivePhoto models.InputFile `json:"live_photo"`
// The static photo to send.
Photo models.InputFile `json:"photo"`
// Video caption (may also be used when resending videos by file_id), 0-1024 characters after
// entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the video caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// Pass True if the video needs to be covered with a spoiler animation
HasSpoiler *bool `json:"has_spoiler,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendLivePhotoParams holds the parameters of SendLivePhoto.
type SendLocationParams ¶
type SendLocationParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Latitude of the location
Latitude float64 `json:"latitude"`
// Longitude of the location
Longitude float64 `json:"longitude"`
// The radius of uncertainty for the location, measured in meters; 0-1500
HorizontalAccuracy *float64 `json:"horizontal_accuracy,omitempty"`
// Period in seconds during which the location will be updated (see Live Locations), must be
// between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
LivePeriod *int `json:"live_period,omitempty"`
// For live locations, a direction in which the user is moving, in degrees.
Heading *int `json:"heading,omitempty"`
// For live locations, a maximum distance for proximity alerts about approaching another chat
// member, in meters.
ProximityAlertRadius *int `json:"proximity_alert_radius,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendLocationParams holds the parameters of SendLocation.
type SendMediaGroupParams ¶
type SendMediaGroupParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the messages will be sent; required if the
// messages are sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized Array describing messages to be sent, must include 2-10 items
Media []models.InputMediaGroupItem `json:"media"`
// Sends messages silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent messages from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
}
SendMediaGroupParams holds the parameters of SendMediaGroup.
type SendMessageDraftParams ¶
type SendMessageDraftParams struct {
// Unique identifier for the target private chat
ChatID int64 `json:"chat_id"`
// Unique identifier for the target message thread
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Unique identifier of the message draft; must be non-zero.
DraftID int64 `json:"draft_id"`
// Text of the message to be sent, 0-4096 characters after entities parsing.
Text *string `json:"text,omitempty"`
// Mode for parsing entities in the message text.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in message text, which can be specified
// instead of parse_mode
Entities []models.MessageEntity `json:"entities,omitzero"`
// Pass True to show the user a button to stop further drafts.
CanStop *bool `json:"can_stop,omitempty"`
// Pass True to keep the draft in the chat when the button is pressed.
KeepOnStop *bool `json:"keep_on_stop,omitempty"`
}
SendMessageDraftParams holds the parameters of SendMessageDraft.
type SendMessageParams ¶
type SendMessageParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Text of the message to be sent, 1-4096 characters after entities parsing
Text string `json:"text"`
// Mode for parsing entities in the message text.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in message text, which can be specified
// instead of parse_mode
Entities []models.MessageEntity `json:"entities,omitzero"`
// Link preview generation options for the message
LinkPreviewOptions *models.LinkPreviewOptions `json:"link_preview_options,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendMessageParams holds the parameters of SendMessage.
type SendPaidMediaParams ¶
type SendPaidMediaParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username.
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// The number of Telegram Stars that must be paid to buy access to the media; 1-25000
StarCount int `json:"star_count"`
// A JSON-serialized Array describing the media to be sent; up to 10 items
Media []models.InputPaidMedia `json:"media"`
// Bot-defined paid media payload, 0-128 bytes.
Payload *string `json:"payload,omitempty"`
// Media caption, 0-1024 characters after entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the media caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendPaidMediaParams holds the parameters of SendPaidMedia.
type SendPhotoParams ¶
type SendPhotoParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Photo to send.
Photo models.InputFile `json:"photo"`
// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after
// entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the photo caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// Pass True if the photo needs to be covered with a spoiler animation
HasSpoiler *bool `json:"has_spoiler,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendPhotoParams holds the parameters of SendPhoto.
type SendPollParams ¶
type SendPollParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username.
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Poll question, 1-300 characters
Question string `json:"question"`
// Mode for parsing entities in the question.
QuestionParseMode *string `json:"question_parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the poll question.
QuestionEntities []models.MessageEntity `json:"question_entities,omitzero"`
// A JSON-serialized list of 1-12 answer options
Options []models.InputPollOption `json:"options"`
// True, if the poll needs to be anonymous, defaults to True
IsAnonymous *bool `json:"is_anonymous,omitempty"`
// Poll type, “quiz” or “regular”, defaults to “regular”
Type *string `json:"type,omitempty"`
// Pass True if the poll allows multiple answers, defaults to False
AllowsMultipleAnswers *bool `json:"allows_multiple_answers,omitempty"`
// Pass True if the poll allows to change chosen answer options, defaults to False for quizzes and
// to True for regular polls
AllowsRevoting *bool `json:"allows_revoting,omitempty"`
// Pass True if the poll options must be shown in random order
ShuffleOptions *bool `json:"shuffle_options,omitempty"`
// Pass True if answer options can be added to the poll after creation; not supported for anonymous
// polls and quizzes
AllowAddingOptions *bool `json:"allow_adding_options,omitempty"`
// Pass True if poll results must be shown only after the poll closes
HideResultsUntilCloses *bool `json:"hide_results_until_closes,omitempty"`
// Pass True if voting is limited to users who have been members of the chat where the poll is
// being sent for more than 24 hours; for channel chats only
MembersOnly *bool `json:"members_only,omitempty"`
// A JSON-serialized list of 0-12 two-letter ISO 3166-1 alpha-2 country codes indicating the
// countries from which users can vote in the poll; for channel chats only.
CountryCodes []string `json:"country_codes,omitzero"`
// A JSON-serialized list of monotonically increasing 0-based identifiers of the correct answer
// options, required for polls in quiz mode
CorrectOptionIDs []int64 `json:"correct_option_ids,omitzero"`
// Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a
// quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
Explanation *string `json:"explanation,omitempty"`
// Mode for parsing entities in the explanation.
ExplanationParseMode *string `json:"explanation_parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the poll explanation.
ExplanationEntities []models.MessageEntity `json:"explanation_entities,omitzero"`
// Media added to the quiz explanation
ExplanationMedia models.InputPollMedia `json:"explanation_media,omitempty"`
// Amount of time in seconds the poll will be active after creation, 5-2628000.
OpenPeriod *int `json:"open_period,omitempty"`
// Point in time (Unix timestamp) when the poll will be automatically closed.
CloseDate *int64 `json:"close_date,omitempty"`
// Pass True if the poll needs to be immediately closed.
IsClosed *bool `json:"is_closed,omitempty"`
// Description of the poll to be sent, 0-1024 characters after entities parsing
Description *string `json:"description,omitempty"`
// Mode for parsing entities in the poll description.
DescriptionParseMode *string `json:"description_parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the poll description, which can be
// specified instead of description_parse_mode
DescriptionEntities []models.MessageEntity `json:"description_entities,omitzero"`
// Media added to the poll description
Media models.InputPollMedia `json:"media,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendPollParams holds the parameters of SendPoll.
type SendRichMessageDraftParams ¶
type SendRichMessageDraftParams struct {
// Unique identifier for the target private chat
ChatID int64 `json:"chat_id"`
// Unique identifier for the target message thread
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Unique identifier of the message draft; must be non-zero.
DraftID int64 `json:"draft_id"`
// The partial message to be streamed.
RichMessage models.InputRichMessage `json:"rich_message"`
// Pass True to show the user a button to stop further drafts.
CanStop *bool `json:"can_stop,omitempty"`
// Pass True to keep the draft in the chat when the button is pressed.
KeepOnStop *bool `json:"keep_on_stop,omitempty"`
}
SendRichMessageDraftParams holds the parameters of SendRichMessageDraft.
type SendRichMessageParams ¶
type SendRichMessageParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent.
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// The message to be sent
RichMessage models.InputRichMessage `json:"rich_message"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendRichMessageParams holds the parameters of SendRichMessage.
type SendStickerParams ¶
type SendStickerParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Sticker to send.
Sticker models.InputFile `json:"sticker"`
// Emoji associated with the sticker; only for just uploaded stickers
Emoji *string `json:"emoji,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendStickerParams holds the parameters of SendSticker.
type SendVenueParams ¶
type SendVenueParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Latitude of the venue
Latitude float64 `json:"latitude"`
// Longitude of the venue
Longitude float64 `json:"longitude"`
// Name of the venue
Title string `json:"title"`
// Address of the venue
Address string `json:"address"`
// Foursquare identifier of the venue
FoursquareID *string `json:"foursquare_id,omitempty"`
// Foursquare type of the venue, if known.
FoursquareType *string `json:"foursquare_type,omitempty"`
// Google Places identifier of the venue
GooglePlaceID *string `json:"google_place_id,omitempty"`
// Google Places type of the venue.
GooglePlaceType *string `json:"google_place_type,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendVenueParams holds the parameters of SendVenue.
type SendVideoNoteParams ¶
type SendVideoNoteParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Video note to send.
VideoNote models.InputFile `json:"video_note"`
// Duration of sent video in seconds
Duration *int `json:"duration,omitempty"`
// Video width and height, i.e. diameter of the video message
Length *int `json:"length,omitempty"`
// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
// server-side.
Thumbnail models.InputFile `json:"thumbnail,omitzero"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendVideoNoteParams holds the parameters of SendVideoNote.
type SendVideoParams ¶
type SendVideoParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Video to send.
Video models.InputFile `json:"video"`
// Duration of sent video in seconds
Duration *int `json:"duration,omitempty"`
// Video width
Width *int `json:"width,omitempty"`
// Video height
Height *int `json:"height,omitempty"`
// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
// server-side.
Thumbnail models.InputFile `json:"thumbnail,omitzero"`
// Cover for the video in the message.
Cover models.InputFile `json:"cover,omitzero"`
// Start timestamp for the video in the message
StartTimestamp *int `json:"start_timestamp,omitempty"`
// Video caption (may also be used when resending videos by file_id), 0-1024 characters after
// entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the video caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// Pass True if the video needs to be covered with a spoiler animation
HasSpoiler *bool `json:"has_spoiler,omitempty"`
// Pass True if the uploaded video is suitable for streaming
SupportsStreaming *bool `json:"supports_streaming,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendVideoParams holds the parameters of SendVideo.
type SendVoiceParams ¶
type SendVoiceParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread (topic) of a forum; for forum supergroups and
// private chats of bots with forum topic mode enabled only
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Identifier of the direct messages topic to which the message will be sent; required if the
// message is sent to a direct messages chat
DirectMessagesTopicID *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *models.EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Audio file to send.
Voice models.InputFile `json:"voice"`
// Voice message caption, 0-1024 characters after entities parsing
Caption *string `json:"caption,omitempty"`
// Mode for parsing entities in the voice message caption.
ParseMode *string `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the caption, which can be specified
// instead of parse_mode
CaptionEntities []models.MessageEntity `json:"caption_entities,omitzero"`
// Duration of the voice message in seconds
Duration *int `json:"duration,omitempty"`
// Sends the message silently.
DisableNotification *bool `json:"disable_notification,omitempty"`
// Protects the contents of the sent message from forwarding and saving
ProtectContent *bool `json:"protect_content,omitempty"`
// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1
// Telegram Stars per message.
AllowPaidBroadcast *bool `json:"allow_paid_broadcast,omitempty"`
// Unique identifier of the message effect to be added to the message; for private chats only
MessageEffectID *string `json:"message_effect_id,omitempty"`
// A JSON-serialized object containing the parameters of the suggested post to send; for direct
// messages chats only.
SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
// Description of the message to reply to
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
// Additional interface options.
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
SendVoiceParams holds the parameters of SendVoice.
type SetBusinessAccountBioParams ¶
type SetBusinessAccountBioParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// The new value of the bio for the business account; 0-140 characters
Bio *string `json:"bio,omitempty"`
}
SetBusinessAccountBioParams holds the parameters of SetBusinessAccountBio.
type SetBusinessAccountGiftSettingsParams ¶
type SetBusinessAccountGiftSettingsParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Pass True if a button for sending a gift to the user or by the business account must always be
// shown in the input field
ShowGiftButton bool `json:"show_gift_button"`
// Types of gifts accepted by the business account
AcceptedGiftTypes models.AcceptedGiftTypes `json:"accepted_gift_types"`
}
SetBusinessAccountGiftSettingsParams holds the parameters of SetBusinessAccountGiftSettings.
type SetBusinessAccountNameParams ¶
type SetBusinessAccountNameParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// The new value of the first name for the business account; 1-64 characters
FirstName string `json:"first_name"`
// The new value of the last name for the business account; 0-64 characters
LastName *string `json:"last_name,omitempty"`
}
SetBusinessAccountNameParams holds the parameters of SetBusinessAccountName.
type SetBusinessAccountProfilePhotoParams ¶
type SetBusinessAccountProfilePhotoParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// The new profile photo to set
Photo models.InputProfilePhoto `json:"photo"`
// Pass True to set the public photo, which will be visible even if the main photo is hidden by the
// business account's privacy settings.
IsPublic *bool `json:"is_public,omitempty"`
}
SetBusinessAccountProfilePhotoParams holds the parameters of SetBusinessAccountProfilePhoto.
type SetBusinessAccountUsernameParams ¶
type SetBusinessAccountUsernameParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// The new value of the username for the business account; 0-32 characters
Username *string `json:"username,omitempty"`
}
SetBusinessAccountUsernameParams holds the parameters of SetBusinessAccountUsername.
type SetChatAdministratorCustomTitleParams ¶
type SetChatAdministratorCustomTitleParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// New custom title for the administrator; 0-16 characters, emoji are not allowed
CustomTitle string `json:"custom_title"`
}
SetChatAdministratorCustomTitleParams holds the parameters of SetChatAdministratorCustomTitle.
type SetChatDescriptionParams ¶
type SetChatDescriptionParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// New chat description, 0-255 characters
Description *string `json:"description,omitempty"`
}
SetChatDescriptionParams holds the parameters of SetChatDescription.
type SetChatMemberTagParams ¶
type SetChatMemberTagParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// New tag for the member; 0-16 characters, emoji are not allowed
Tag *string `json:"tag,omitempty"`
}
SetChatMemberTagParams holds the parameters of SetChatMemberTag.
type SetChatMenuButtonParams ¶
type SetChatMenuButtonParams struct {
// Unique identifier for the target private chat.
ChatID *int64 `json:"chat_id,omitempty"`
// A JSON-serialized object for the bot's new menu button.
MenuButton models.MenuButton `json:"menu_button,omitempty"`
}
SetChatMenuButtonParams holds the parameters of SetChatMenuButton.
type SetChatPermissionsParams ¶
type SetChatPermissionsParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// A JSON-serialized object for new default chat permissions
Permissions models.ChatPermissions `json:"permissions"`
// Pass True if chat permissions are set independently.
UseIndependentChatPermissions *bool `json:"use_independent_chat_permissions,omitempty"`
}
SetChatPermissionsParams holds the parameters of SetChatPermissions.
type SetChatPhotoParams ¶
type SetChatPhotoParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// New chat photo, uploaded using multipart/form-data
Photo models.InputFile `json:"photo"`
}
SetChatPhotoParams holds the parameters of SetChatPhoto.
type SetChatStickerSetParams ¶
type SetChatStickerSetParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Name of the sticker set to be set as the group sticker set
StickerSetName string `json:"sticker_set_name"`
}
SetChatStickerSetParams holds the parameters of SetChatStickerSet.
type SetChatTitleParams ¶
type SetChatTitleParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// New chat title, 1-128 characters
Title string `json:"title"`
}
SetChatTitleParams holds the parameters of SetChatTitle.
type SetCustomEmojiStickerSetThumbnailParams ¶
type SetCustomEmojiStickerSetThumbnailParams struct {
// Sticker set name
Name string `json:"name"`
// Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the
// thumbnail and use the first sticker as the thumbnail
CustomEmojiID *string `json:"custom_emoji_id,omitempty"`
}
SetCustomEmojiStickerSetThumbnailParams holds the parameters of SetCustomEmojiStickerSetThumbnail.
type SetGameScoreParams ¶
type SetGameScoreParams struct {
// User identifier
UserID int64 `json:"user_id"`
// New score, must be non-negative
Score int `json:"score"`
// Pass True if the high score is allowed to decrease.
Force *bool `json:"force,omitempty"`
// Pass True if the game message should not be automatically edited to include the current
// scoreboard
DisableEditMessage *bool `json:"disable_edit_message,omitempty"`
// Required if inline_message_id is not specified.
ChatID *int64 `json:"chat_id,omitempty"`
// Required if inline_message_id is not specified.
MessageID *int64 `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified.
InlineMessageID *string `json:"inline_message_id,omitempty"`
}
SetGameScoreParams holds the parameters of SetGameScore.
type SetManagedBotAccessSettingsParams ¶
type SetManagedBotAccessSettingsParams struct {
// User identifier of the managed bot whose access settings will be changed
UserID int64 `json:"user_id"`
// Pass True if only selected users can access the bot.
IsAccessRestricted bool `json:"is_access_restricted"`
// A JSON-serialized list of up to 10 identifiers of users who will have access to the bot in
// addition to its owner.
AddedUserIDs []int64 `json:"added_user_ids,omitzero"`
}
SetManagedBotAccessSettingsParams holds the parameters of SetManagedBotAccessSettings.
type SetMessageReactionParams ¶
type SetMessageReactionParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the target message.
MessageID int64 `json:"message_id"`
// A JSON-serialized list of reaction types to set on the message.
Reaction []models.ReactionType `json:"reaction,omitzero"`
// Pass True to set the reaction with a big animation
IsBig *bool `json:"is_big,omitempty"`
}
SetMessageReactionParams holds the parameters of SetMessageReaction.
type SetMyCommandsParams ¶
type SetMyCommandsParams struct {
// A JSON-serialized list of bot commands to be set as the list of the bot's commands.
Commands []models.BotCommand `json:"commands"`
// A JSON-serialized object, describing scope of users for which the commands are relevant.
Scope models.BotCommandScope `json:"scope,omitempty"`
// A two-letter ISO 639-1 language code.
LanguageCode *string `json:"language_code,omitempty"`
}
SetMyCommandsParams holds the parameters of SetMyCommands.
type SetMyDefaultAdministratorRightsParams ¶
type SetMyDefaultAdministratorRightsParams struct {
// A JSON-serialized object describing new default administrator rights.
Rights *models.ChatAdministratorRights `json:"rights,omitempty"`
// Pass True to change the default administrator rights of the bot in channels.
ForChannels *bool `json:"for_channels,omitempty"`
}
SetMyDefaultAdministratorRightsParams holds the parameters of SetMyDefaultAdministratorRights.
type SetMyDescriptionParams ¶
type SetMyDescriptionParams struct {
// New bot description; 0-512 characters.
Description *string `json:"description,omitempty"`
// A two-letter ISO 639-1 language code.
LanguageCode *string `json:"language_code,omitempty"`
}
SetMyDescriptionParams holds the parameters of SetMyDescription.
type SetMyNameParams ¶
type SetMyNameParams struct {
// New bot name; 0-64 characters.
Name *string `json:"name,omitempty"`
// A two-letter ISO 639-1 language code.
LanguageCode *string `json:"language_code,omitempty"`
}
SetMyNameParams holds the parameters of SetMyName.
type SetMyProfilePhotoParams ¶
type SetMyProfilePhotoParams struct {
// The new profile photo to set
Photo models.InputProfilePhoto `json:"photo"`
}
SetMyProfilePhotoParams holds the parameters of SetMyProfilePhoto.
type SetMyShortDescriptionParams ¶
type SetMyShortDescriptionParams struct {
// New short description for the bot; 0-120 characters.
ShortDescription *string `json:"short_description,omitempty"`
// A two-letter ISO 639-1 language code.
LanguageCode *string `json:"language_code,omitempty"`
}
SetMyShortDescriptionParams holds the parameters of SetMyShortDescription.
type SetPassportDataErrorsParams ¶
type SetPassportDataErrorsParams struct {
// User identifier
UserID int64 `json:"user_id"`
// A JSON-serialized Array describing the errors
Errors []models.PassportElementError `json:"errors"`
}
SetPassportDataErrorsParams holds the parameters of SetPassportDataErrors.
type SetStickerEmojiListParams ¶
type SetStickerEmojiListParams struct {
// File identifier of the sticker
Sticker string `json:"sticker"`
// A JSON-serialized list of 1-20 emoji associated with the sticker
EmojiList []string `json:"emoji_list"`
}
SetStickerEmojiListParams holds the parameters of SetStickerEmojiList.
type SetStickerKeywordsParams ¶
type SetStickerKeywordsParams struct {
// File identifier of the sticker
Sticker string `json:"sticker"`
// A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64
// characters
Keywords []string `json:"keywords,omitzero"`
}
SetStickerKeywordsParams holds the parameters of SetStickerKeywords.
type SetStickerMaskPositionParams ¶
type SetStickerMaskPositionParams struct {
// File identifier of the sticker
Sticker string `json:"sticker"`
// A JSON-serialized object with the position where the mask should be placed on faces.
MaskPosition *models.MaskPosition `json:"mask_position,omitempty"`
}
SetStickerMaskPositionParams holds the parameters of SetStickerMaskPosition.
type SetStickerPositionInSetParams ¶
type SetStickerPositionInSetParams struct {
// File identifier of the sticker
Sticker string `json:"sticker"`
// New sticker position in the set, zero-based
Position int `json:"position"`
}
SetStickerPositionInSetParams holds the parameters of SetStickerPositionInSet.
type SetStickerSetThumbnailParams ¶
type SetStickerSetThumbnailParams struct {
// Sticker set name
Name string `json:"name"`
// User identifier of the sticker set owner
UserID int64 `json:"user_id"`
// A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width
// and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size
// (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical
// requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see
// https://core.telegram.org/stickers#video-requirements for video sticker technical requirements.
Thumbnail models.InputFile `json:"thumbnail,omitzero"`
// Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated”
// for a .TGS animation, or “video” for a .WEBM video
Format string `json:"format"`
}
SetStickerSetThumbnailParams holds the parameters of SetStickerSetThumbnail.
type SetStickerSetTitleParams ¶
type SetStickerSetTitleParams struct {
// Sticker set name
Name string `json:"name"`
// Sticker set title, 1-64 characters
Title string `json:"title"`
}
SetStickerSetTitleParams holds the parameters of SetStickerSetTitle.
type SetUserEmojiStatusParams ¶
type SetUserEmojiStatusParams struct {
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// Custom emoji identifier of the emoji status to set.
EmojiStatusCustomEmojiID *string `json:"emoji_status_custom_emoji_id,omitempty"`
// Expiration date of the emoji status, if any
EmojiStatusExpirationDate *int64 `json:"emoji_status_expiration_date,omitempty"`
}
SetUserEmojiStatusParams holds the parameters of SetUserEmojiStatus.
type SetWebhookParams ¶
type SetWebhookParams struct {
// HTTPS URL to send updates to.
URL string `json:"url"`
// Upload your public key certificate so that the root certificate in use can be checked.
Certificate models.InputFile `json:"certificate,omitzero"`
// The fixed IP address which will be used to send webhook requests instead of the IP address
// resolved through DNS
IPAddress *string `json:"ip_address,omitempty"`
// The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery,
// 1-100.
MaxConnections *int `json:"max_connections,omitempty"`
// A JSON-serialized list of the update types you want your bot to receive.
AllowedUpdates []string `json:"allowed_updates,omitzero"`
// Pass True to drop all pending updates
DropPendingUpdates *bool `json:"drop_pending_updates,omitempty"`
// A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook
// request, 1-256 characters.
SecretToken *string `json:"secret_token,omitempty"`
}
SetWebhookParams holds the parameters of SetWebhook.
type StopMessageLiveLocationParams ¶
type StopMessageLiveLocationParams struct {
// Unique identifier of the business connection on behalf of which the message to be edited was
// sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Required if inline_message_id is not specified.
ChatID models.ChatID `json:"chat_id,omitzero"`
// Required if inline_message_id is not specified.
MessageID *int64 `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified.
InlineMessageID *string `json:"inline_message_id,omitempty"`
// A JSON-serialized object for a new inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
StopMessageLiveLocationParams holds the parameters of StopMessageLiveLocation.
type StopPollParams ¶
type StopPollParams struct {
// Unique identifier of the business connection on behalf of which the message to be edited was
// sent
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the original message with the poll
MessageID int64 `json:"message_id"`
// A JSON-serialized object for a new message inline keyboard
ReplyMarkup *models.InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
StopPollParams holds the parameters of StopPoll.
type TransferBusinessAccountStarsParams ¶
type TransferBusinessAccountStarsParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Number of Telegram Stars to transfer; 1-10000
StarCount int `json:"star_count"`
}
TransferBusinessAccountStarsParams holds the parameters of TransferBusinessAccountStars.
type TransferGiftParams ¶
type TransferGiftParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier of the regular gift that should be transferred
OwnedGiftID string `json:"owned_gift_id"`
// Unique identifier of the chat which will own the gift.
NewOwnerChatID int64 `json:"new_owner_chat_id"`
// The amount of Telegram Stars that will be paid for the transfer from the business account
// balance.
StarCount *int `json:"star_count,omitempty"`
}
TransferGiftParams holds the parameters of TransferGift.
type TransportFunc ¶
TransportFunc adapts a function to the Transport interface.
type UnbanChatMemberParams ¶
type UnbanChatMemberParams struct {
// Unique identifier for the target group or username of the target supergroup or channel in the
// format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// Do nothing if the user is not banned
OnlyIfBanned *bool `json:"only_if_banned,omitempty"`
}
UnbanChatMemberParams holds the parameters of UnbanChatMember.
type UnbanChatSenderChatParams ¶
type UnbanChatSenderChatParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier of the target sender chat
SenderChatID int64 `json:"sender_chat_id"`
}
UnbanChatSenderChatParams holds the parameters of UnbanChatSenderChat.
type UnhideGeneralForumTopicParams ¶
type UnhideGeneralForumTopicParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
}
UnhideGeneralForumTopicParams holds the parameters of UnhideGeneralForumTopic.
type UnpinAllChatMessagesParams ¶
type UnpinAllChatMessagesParams struct {
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
}
UnpinAllChatMessagesParams holds the parameters of UnpinAllChatMessages.
type UnpinAllForumTopicMessagesParams ¶
type UnpinAllForumTopicMessagesParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
// Unique identifier for the target message thread of the forum topic
MessageThreadID int64 `json:"message_thread_id"`
}
UnpinAllForumTopicMessagesParams holds the parameters of UnpinAllForumTopicMessages.
type UnpinAllGeneralForumTopicMessagesParams ¶
type UnpinAllGeneralForumTopicMessagesParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format
// @username
ChatID models.ChatID `json:"chat_id"`
}
UnpinAllGeneralForumTopicMessagesParams holds the parameters of UnpinAllGeneralForumTopicMessages.
type UnpinChatMessageParams ¶
type UnpinChatMessageParams struct {
// Unique identifier of the business connection on behalf of which the message will be unpinned
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
// Unique identifier for the target chat or username of the target channel in the format @username
ChatID models.ChatID `json:"chat_id"`
// Identifier of the message to unpin.
MessageID *int64 `json:"message_id,omitempty"`
}
UnpinChatMessageParams holds the parameters of UnpinChatMessage.
type UpgradeGiftParams ¶
type UpgradeGiftParams struct {
// Unique identifier of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Unique identifier of the regular gift that should be upgraded to a unique one
OwnedGiftID string `json:"owned_gift_id"`
// Pass True to keep the original gift text, sender and receiver in the upgraded gift
KeepOriginalDetails *bool `json:"keep_original_details,omitempty"`
// The amount of Telegram Stars that will be paid for the upgrade from the business account
// balance.
StarCount *int `json:"star_count,omitempty"`
}
UpgradeGiftParams holds the parameters of UpgradeGift.
type UploadStickerFileParams ¶
type UploadStickerFileParams struct {
// User identifier of sticker file owner
UserID int64 `json:"user_id"`
// A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format.
Sticker models.InputFile `json:"sticker"`
// Format of the sticker, must be one of “static”, “animated”, “video”
StickerFormat string `json:"sticker_format"`
}
UploadStickerFileParams holds the parameters of UploadStickerFile.
type VerifyChatParams ¶
type VerifyChatParams struct {
// Unique identifier for the target chat or username of the target bot, supergroup or channel in
// the format @username.
ChatID models.ChatID `json:"chat_id"`
// Custom description for the verification; 0-70 characters.
CustomDescription *string `json:"custom_description,omitempty"`
}
VerifyChatParams holds the parameters of VerifyChat.
type VerifyUserParams ¶
type VerifyUserParams struct {
// Unique identifier of the target user
UserID int64 `json:"user_id"`
// Custom description for the verification; 0-70 characters.
CustomDescription *string `json:"custom_description,omitempty"`
}
VerifyUserParams holds the parameters of VerifyUser.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bot runs Telegram bots on top of package teleiq.
|
Package bot runs Telegram bots on top of package teleiq. |
|
examples
|
|
|
basic
command
Command basic checks BOT_TOKEN with getMe and sends a message to CHAT_ID if it is set.
|
Command basic checks BOT_TOKEN with getMe and sends a message to CHAT_ID if it is set. |
|
callback
command
Command callback shows color buttons on /menu and answers the one pressed.
|
Command callback shows color buttons on /menu and answers the one pressed. |
|
commands
command
Command commands answers /start, /help and /echo, listed in the command menu.
|
Command commands answers /start, /help and /echo, listed in the command menu. |
|
files
command
Command files uploads FILE to CHAT_ID, downloads it back and checks it is unchanged.
|
Command files uploads FILE to CHAT_ID, downloads it back and checks it is unchanged. |
|
filters
command
Command filters answers each kind of message with the filter that matched it.
|
Command filters answers each kind of message with the filter that matched it. |
|
fsm
command
Command fsm asks for a name and an age after /register; /cancel stops it.
|
Command fsm asks for a name and an age after /register; /cancel stops it. |
|
graceful-shutdown
command
Command graceful-shutdown lets a slow /work finish when Ctrl+C stops the bot.
|
Command graceful-shutdown lets a slow /work finish when Ctrl+C stops the bot. |
|
handlers
command
Command handlers shows each way to add a handler and the order in which they match.
|
Command handlers shows each way to add a handler and the order in which they match. |
|
hello
command
Command hello greets /start and repeats the text of every other message.
|
Command hello greets /start and repeats the text of every other message. |
|
inline
command
Command inline answers "@bot text" in any chat with the text in bold, italic or code.
|
Command inline answers "@bot text" in any chat with the text in bold, italic or code. |
|
middleware
command
Command middleware shows Recovery, Logging and a middleware that keeps to private chats.
|
Command middleware shows Recovery, Logging and a middleware that keeps to private chats. |
|
moderation
command
Command moderation bans with /ban, mutes with /mute and keeps a group tidy.
|
Command moderation bans with /ban, mutes with /mute and keeps a group tidy. |
|
shop
command
Command shop shows products as buttons on /start and takes the order pressed.
|
Command shop shows products as buttons on /start and takes the order pressed. |
|
webapp
command
Command webapp opens a pizza Mini App from /start and sends the order to the chat.
|
Command webapp opens a pizza Mini App from /start and sends the order to the chat. |
|
webhook
command
Command webhook receives updates through a webhook at WEBHOOK_URL instead of polling.
|
Command webhook receives updates through a webhook at WEBHOOK_URL instead of polling. |
|
Package filter provides filters for package bot and ways to combine them.
|
Package filter provides filters for package bot and ways to combine them. |
|
Package fsm keeps the state of conversations with users.
|
Package fsm keeps the state of conversations with users. |
|
internal
|
|
|
gen
command
Command gen generates the Bot API types and methods of package teleiq.
|
Command gen generates the Bot API types and methods of package teleiq. |
|
gen/schema
Package schema is TeleIQ's machine-readable description of the Telegram Bot API.
|
Package schema is TeleIQ's machine-readable description of the Telegram Bot API. |
|
gen/update
command
Command update brings TeleIQ to the latest release of the Bot API.
|
Command update brings TeleIQ to the latest release of the Bot API. |
|
sanitize
Package sanitize removes Telegram bot tokens from text and errors.
|
Package sanitize removes Telegram bot tokens from text and errors. |
|
upload
Package upload holds the files to send and encodes requests that upload them.
|
Package upload holds the files to send and encodes requests that upload them. |
|
Package models holds the types of the Telegram Bot API.
|
Package models holds the types of the Telegram Bot API. |
|
Package teleiqtest is a fake Bot API server for testing bots.
|
Package teleiqtest is a fake Bot API server for testing bots. |
|
Package webapp validates the data that Telegram gives a Mini App.
|
Package webapp validates the data that Telegram gives a Mini App. |