Types Reference ​
This page documents all types from the telegram/types and telegram/params packages. These are the high-level, user-friendly wrappers around the raw tg generated types.
Message & Media ​
Message ​
The core message type representing a Telegram message.
type Message struct {
ID int32
ChatID int64
SenderID int64
Date int32
Text string
Media *Media
ReplyTo *Message
Forward *ForwardHeader
Entities []MessageEntity
ReplyMarkup *ReplyMarkup
GroupedID int64
Views int32
Forwards int32
Reactions *MessageReactions
// ...
}Media ​
Union type for all media attachments on a message.
type Media struct {
Type MessageMediaType
// Type-specific fields...
}Photo ​
type Photo struct {
ID int64
Sizes []PhotoSize
Date int32
}PhotoSize ​
type PhotoSize struct {
Type string
Width int32
Height int32
Size int32
}Animation ​
type Animation struct {
ID string
Width int32
Height int32
Duration int32
MimeType string
FileSize int64
Thumb *PhotoSize
FileName string
}Audio ​
type Audio struct {
ID string
Duration int32
Title string
Performer string
MimeType string
FileSize int64
Thumb *PhotoSize
FileName string
}Video ​
type Video struct {
ID string
Width int32
Height int32
Duration int32
MimeType string
FileSize int64
Thumb *PhotoSize
FileName string
}VideoNote ​
type VideoNote struct {
ID string
Length int32
Duration int32
Thumb *PhotoSize
FileSize int64
}Voice ​
type Voice struct {
ID string
Duration int32
MimeType string
FileSize int64
}Sticker ​
type Sticker struct {
ID string
Width int32
Height int32
Emoji string
SetName string
IsAnimated bool
IsVideo bool
Type StickerType
Thumb *PhotoSize
MaskPosition *MaskPosition
FileSize int64
}DocumentMedia ​
type DocumentMedia struct {
ID string
MimeType string
FileName string
FileSize int64
Thumb *PhotoSize
}Contact ​
type Contact struct {
PhoneNumber string
FirstName string
LastName string
UserID int64
}Location ​
type Location struct {
Latitude float64
Longitude float64
}Venue ​
type Venue struct {
Location Location
Title string
Address string
Provider string
VenueID string
VenueType string
}ContactMedia ​
Wraps a Contact as a Media variant.
LocationMedia ​
Wraps a Location as a Media variant.
VenueMedia ​
Wraps a Venue as a Media variant.
PhotoMedia ​
Wraps a Photo as a Media variant.
DiceMedia ​
type DiceMedia struct {
Emoji string
Value int32
}GameMedia ​
type GameMedia struct {
ID int64
Title string
Description string
Photo []PhotoSize
}InvoiceMedia ​
type InvoiceMedia struct {
Title string
Description string
StartParameter string
Currency string
TotalAmount int64
}GiveawayMedia ​
Represents a giveaway message media.
GiveawayResultsMedia ​
Represents giveaway results media.
PollMedia ​
type PollMedia struct {
ID int64
Question string
Options []PollAnswer
Closed bool
Type PollType
}StoryMedia ​
Represents a story forwarded as media.
WebPageMedia ​
type WebPageMedia struct {
ID int64
URL string
Title string
Description string
Photo *Photo
}PaidMedia ​
type PaidMedia struct {
StarsAmount int64
ExtendedMedia []Media
}PaidMediaInfo ​
Contains information about paid media attached to a message.
PurchasedPaidMedia ​
Represents media that was purchased with Telegram Stars.
Thumbnail ​
type Thumbnail struct {
Type string
Width int32
Height int32
Size int32
}Chat & Members ​
Chat ​
type Chat struct {
ID int64
Type ChatType
Title string
Username string
FirstName string
LastName string
Photo *ChatPhoto
MembersCount int32
Description string
// ...
}ChatPreview ​
Preview of a chat shown before joining.
ChatType ​
Enum: ChatTypePrivate, ChatTypePair, ChatTypeGroup, ChatTypeSupergroup, ChatTypeChannel, ChatTypeBroadcast.
ChatPhoto ​
type ChatPhoto struct {
SmallFileID string
BigFileID string
DcID int32
}ChatMember ​
type ChatMember struct {
UserID int64
Status ChatMemberStatus
CustomTitle string
JoinedDate int32
// admin/restriction fields...
}ChatMemberStatus ​
Enum: StatusCreator, StatusAdministrator, StatusMember, StatusRestricted, StatusLeft, StatusBanned.
ChatMemberUpdated ​
type ChatMemberUpdated struct {
Chat *Chat
From *User
Date int32
OldStatus ChatMemberStatus
NewStatus ChatMemberStatus
}ChatMembersFilter ​
Enum for filtering members in GetChatMembers.
ChatPermissions ​
type ChatPermissions struct {
CanSendMessages bool
CanSendMedia bool
CanSendPolls bool
CanSendStickers bool
CanSendGifs bool
CanChangeInfo bool
CanInviteUsers bool
CanPinMessages bool
CanManageTopics bool
}ChatAdminRights ​
Maps to tg.ChatAdminRights. Defines admin capabilities.
ChatBannedRights ​
Maps to tg.ChatBannedRights. Defines what a restricted user cannot do.
ChatEvent ​
type ChatEvent struct {
ID int64
Date int32
UserID int64
Action ChatEventAction
}ChatEventAction ​
Discriminated union of admin log event types.
ChatEventFilter ​
Filter criteria for GetChatEventLog.
ChatInviteLink ​
type ChatInviteLink struct {
Link string
CreatorID int64
Date int32
ExpireDate int32
MemberLimit int32
IsPrimary bool
IsRevoked bool
}ChatInviteLinkJoiner ​
type ChatInviteLinkJoiner struct {
UserID int64
Date int32
ViaFolder bool
}ChatJoinRequest ​
type ChatJoinRequest struct {
Chat *Chat
From *User
Date int32
Bio string
InviteLink *ChatInviteLink
}ChatJoinType ​
Enum for join type classification.
ChatBoostUpdated ​
Represents a boost applied or removed from a chat.
ChatSettings ​
Settings associated with a chat.
ChatShared ​
Data for a chat shared via keyboard button.
ChatAction ​
Enum of chat actions (typing, uploading, recording, etc.).
ChatBackground ​
Represents a chat background/wallpaper.
Dialog ​
type Dialog struct {
ID int64
TopMessage int32
UnreadCount int32
Pinned bool
}Folder ​
Represents a chat folder.
FolderColor ​
Enum of folder color options.
TopChatCategory ​
Enum for top chat category filters.
User & Profile ​
User ​
type User struct {
ID int64
FirstName string
LastName string
Username string
Phone string
Photo *ChatPhoto
Status UserStatus
IsBot bool
IsVerified bool
IsPremium bool
LanguageCode string
}UserStatus ​
Enum: StatusOnline, StatusOffline, StatusRecently, StatusLastWeek, StatusLastMonth.
UserStatusUpdated ​
type UserStatusUpdated struct {
UserID int64
Status UserStatus
Date int32
}UsernameInfo ​
Holds username metadata including editable and active status.
UsersShared ​
Data for users shared via keyboard button.
ProfileColor ​
Represents a profile color/emoji status palette.
ProfileTab ​
Represents a profile tab configuration.
EmojiStatus ​
type EmojiStatus struct {
DocumentID int64
Until int32
}Birthday ​
type Birthday struct {
Day int32
Month int32
Year int32
}BusinessConnection ​
Represents a business bot connection.
BusinessBotRights ​
Rights granted to a business bot.
BusinessIntro ​
type BusinessIntro struct {
Title string
Message string
Sticker *Sticker
}BusinessRecipients ​
Defines who can see business features.
BusinessSchedule ​
Working hours schedule for a business.
BusinessWeeklyOpen ​
Single open interval in a business schedule.
BusinessWorkingHours ​
Full working hours configuration.
ClientPlatform ​
Enum for platform identification.
ActiveSession ​
Information about an active session.
ActiveSessions ​
Collection of active sessions.
Messages & Formatting ​
MessageEntity ​
type MessageEntity struct {
Type MessageEntityType
Offset int32
Length int32
URL string
Language string
User *User
CustomEmojiID int64
}MessageEntityType ​
Enum: EntityMention, EntityHashtag, EntityBotCommand, EntityURL, EntityEmail, EntityBold, EntityItalic, EntityCode, EntityPre, EntityTextLink, EntityTextMention, EntityCashtag, EntityPhoneNumber, EntityCustomEmoji, EntityBlockquote, EntityExpandableBlockquote, EntityStrikethrough, EntityUnderline, EntitySpoiler.
MessageOrigin ​
Discriminated origin of a message (user, channel, hidden, etc.).
MessageOriginType ​
Enum for message origin discriminator.
MessageMediaType ​
Enum: MediaPhoto, MediaVideo, MediaDocument, MediaAudio, MediaVoice, MediaVideoNote, MediaSticker, MediaAnimation, MediaContact, MediaLocation, MediaVenue, MediaPoll, MediaDice, MediaGame, MediaInvoice, MediaGiveaway, MediaGiveawayResults, MediaStory, MediaWebPage, MediaPaid.
MessageServiceType ​
Enum for service message types.
MessageReactions ​
type MessageReactions struct {
Reactions []ReactionCount
Mine bool
}MessageReactionUpdated ​
Fired when a reaction is added/removed.
MessageReactionCountUpdated ​
Fired when reaction counts change.
FormattedText ​
type FormattedText struct {
Text string
Entities []MessageEntity
}ParseMode ​
type ParseMode stringEnum: ParseModeDefault, ParseModeMarkdown, ParseModeHTML, ParseModeDisabled. Shorthands: Markdown, HTML, MarkdownV2, Disabled.
TextQuote ​
type TextQuote struct {
Text string
Entities []MessageEntity
Offset int32
}FactCheck ​
type FactCheck struct {
Country string
Text FormattedText
Hash int64
}LinkPreviewOptions ​
type LinkPreviewOptions struct {
Disabled bool
URL string
ShowAboveText bool
PreferSmallMedia bool
PreferLargeMedia bool
}ForwardHeader ​
type ForwardHeader struct {
Date int32
FromID int64
ChannelID int64
PostAuthor string
}ExternalReplyInfo ​
Contains info about a message replied to in another chat.
ReplyParameters ​
type ReplyParameters struct {
MessageID int32
ChatID int64
Quote string
QuoteOffset int32
}ReplyColor ​
Reply background color configuration.
DeletedMessages ​
type DeletedMessages struct {
ChatID int64
Messages []int32
}MessagesFilter ​
Enum for search/getHistory message filters.
Reactions & Polls ​
Reaction ​
type Reaction struct {
Emoji string
Count int32
}ReactionCount ​
type ReactionCount struct {
Reaction Reaction
Count int32
}BotReactionCount ​
Reaction count variant for bots.
PaidReactionPrivacy ​
Controls visibility of paid reactions.
PaidReactor ​
Information about a user who reacted with paid stars.
PollType ​
Enum: PollTypeRegular, PollTypeQuiz.
PollUpdate ​
Fired when a poll is updated.
PollAnswer ​
type PollAnswer struct {
Text string
Voter int64
Chosen bool
}Keyboards & Buttons ​
ReplyMarkup ​
Discriminated union of keyboard types.
ReplyMarkupType ​
Enum: ReplyMarkupInline, ReplyMarkupKeyboard, ReplyMarkupHide, ReplyMarkupForce.
InlineKeyboardButton ​
type InlineKeyboardButton struct {
Text string
URL string
CallbackData string
SwitchQuery string
// ...
}KeyboardButton ​
type KeyboardButton struct {
Text string
RequestID int64
// ...
}Button ​
Higher-level button abstraction used in MTGo helpers.
ButtonType ​
Enum for button discriminator.
ButtonStyle ​
Visual style for buttons.
ForceReply ​
Forces a reply from the user.
ReplyKeyboardRemove ​
Removes the custom keyboard.
LoginURL ​
type LoginURL struct {
URL string
ForwardText string
BotUsername string
RequestID int32
}KeyboardButtonPollType ​
Specifies the type of poll to create.
KeyboardButtonRequestChat ​
Requests a chat from the user via button.
KeyboardButtonRequestUsers ​
Requests user(s) from the user via button.
Inline & Callbacks ​
CallbackQuery ​
type CallbackQuery struct {
ID string
From *User
Message *Message
ChatInstance string
Data string
GameShortName string
}InlineQuery ​
type InlineQuery struct {
ID int64
From *User
Query string
Offset string
ChatType ChatType
Location *Location
}InlineQueryResult ​
Result item for inline query responses.
ChosenInlineResult ​
type ChosenInlineResult struct {
ID int64
From *User
Query string
ResultID string
Location *Location
}InputMessageContent ​
Content to send as the result of an inline selection.
InputContentType ​
Enum for input content discriminator.
SentWebAppMessage ​
type SentWebAppMessage struct {
InlineMessageID string
}WebAppData ​
type WebAppData struct {
Data string
ButtonText string
}WebAppInfo ​
type WebAppInfo struct {
URL string
}Payments & Shipping ​
Payment ​
Represents payment-related data.
PaymentFormType ​
Enum for payment form types.
PaymentQueries ​
Collection of payment-related query types.
Invoice ​
type Invoice struct {
Title string
Description string
StartParameter string
Currency string
TotalAmount int64
}InvoiceType ​
Enum for invoice type discriminator.
LabeledPrice ​
type LabeledPrice struct {
Label string
Amount int64
}ShippingAddress ​
type ShippingAddress struct {
CountryCode string
State string
City string
StreetLine1 string
StreetLine2 string
PostCode string
}ShippingOption ​
type ShippingOption struct {
ID string
Title string
Prices []LabeledPrice
}ShippingQuery ​
type ShippingQuery struct {
ID string
From *User
InvoicePayload []byte
ShippingAddress ShippingAddress
}OrderInfo ​
type OrderInfo struct {
Name string
PhoneNumber string
Email string
ShippingAddress *ShippingAddress
}PreCheckoutQuery ​
type PreCheckoutQuery struct {
ID string
From *User
Currency string
TotalAmount int64
InvoicePayload []byte
ShippingOptionID string
OrderInfo *OrderInfo
}SuccessfulPayment ​
type SuccessfulPayment struct {
Currency string
TotalAmount int64
InvoicePayload []byte
ShippingOptionID string
OrderInfo *OrderInfo
TelegramPaymentChargeID string
ProviderPaymentChargeID string
}InputCredentials ​
Payment credentials input.
InputInvoice ​
Invoice input for payment flows.
CredentialsType ​
Enum for credential discriminator.
Stories ​
Story ​
type Story struct {
ID int32
From *User
Date int32
Caption string
Media *Media
Views int32
Pinned bool
Privacy StoriesPrivacyRules
}StoryView ​
type StoryView struct {
UserID int64
Date int32
Reaction string
IsForward bool
}StoriesPrivacyRules ​
Privacy configuration for who can see stories.
Gifts & Giveaways ​
GiftType ​
Discriminated gift type (standard, upgraded, etc.).
GiftAttributeType ​
Enum for gift attribute discriminator.
GiftUpgradePreview ​
Preview info for a gift upgrade.
GiftUpgradePrice ​
Price of upgrading a gift.
GiftedPremium ​
Info about gifted premium subscription.
GiftedStars ​
Info about gifted Telegram Stars.
GiftAuction ​
Auction state for a gift.
GiftCollection ​
A collection of gifts.
GiftForResaleOrder ​
Order for gifting a resellable gift.
GiftPurchaseLimit ​
Purchase limit info for gifts.
GiftPurchaseOfferState ​
State of a gift purchase offer.
UpgradedGiftAttribute ​
Attribute of an upgraded gift.
UpgradedGiftOrigin ​
Origin info for an upgraded gift.
UpgradedGiftOriginalDetails ​
Original details of an upgraded gift.
UpgradedGiftPurchaseOffer ​
Purchase offer for an upgraded gift.
UpgradedGiftValueInfo ​
Value information for an upgraded gift.
CheckedGiftCode ​
Result of checking a gift code.
PremiumGiftCode ​
Premium gift code details.
Giveaway ​
type Giveaway struct {
ChatID int64
Quantity int32
Months int32
Prize string
Winners []int64
UntilDate int32
}GiveawayWinners ​
Winners of a giveaway.
BoostInfo ​
Boost status for a chat.
BoostsStatus ​
Full boosts status for a chat.
MyBoost ​
A single boost applied by the current user.
Privacy & Security ​
PrivacyKey ​
Enum: PrivacyStatus, PrivacyProfilePhoto, PrivacyPhone, PrivacyChatInvite, PrivacyForwards, PrivacyVoiceMessages, PrivacyAddedByPhone, PrivacyBirthday.
PrivacyRule ​
A single privacy rule entry.
PrivacyRuleType ​
Enum for rule discriminator (allow users, allow contacts, deny all, etc.).
InputPrivacyRule ​
Input variant for setting privacy rules.
InputPrivacyRuleType ​
Enum for input rule discriminator.
GlobalPrivacySettings ​
type GlobalPrivacySettings struct {
ArchiveAndMuteNonContacts bool
KeepArchivedUnmuted bool
KeepArchivedFolders bool
HideReadMarks bool
}BlockList ​
Represents the blocked users list.
Auth & Sessions ​
SentCodeInfo ​
type SentCodeInfo struct {
Type SentCodeType
PhoneCodeHash string
NextType *NextCodeType
Timeout int32
}SentCodeType ​
Enum: SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall, SentCodeTypeMissedCall, SentCodeTypeFragmentSms, SentCodeTypeEmailCode, SentCodeTypeSetUpEmailRequired.
NextCodeType ​
Enum for the next available code delivery method.
TermsOfService ​
Terms of service shown during sign-up.
PhoneNumberCodeType ​
Enum for phone number code types.
Input Types & Helpers ​
InputMedia ​
Helper for constructing media input objects.
InputMediaType ​
Enum for input media discriminator.
InputChatPhoto ​
Helper for setting chat photos.
InputPhoto ​
Helper for referencing existing photos.
InputPollOption ​
type InputPollOption struct {
Text string
}InputPhoneContact ​
type InputPhoneContact struct {
FirstName string
LastName string
Phone string
}MaskPosition ​
type MaskPosition struct {
Point MaskPointType
XShift float64
YShift float64
Scale float64
}MaskPointType ​
Enum: MaskForehead, MaskEyes, MaskMouth, MaskChin.
StickerType ​
Enum: StickerTypeRegular, StickerTypeMask, StickerTypeCustomEmoji.
MediaArea ​
Represents a media area (used in story reactions and similar).
MediaAreaType ​
Enum for media area discriminator.
PeerInfo ​
Resolved peer information.
PeerMap ​
Map of peers resolved from updates.
Bot & Commands ​
BotCommand ​
type BotCommand struct {
Command string
Description string
}BotCommandScope ​
Scope for bot command registration.
BotCommandScopeType ​
Enum: ScopeDefault, ScopeAllPrivateChats, ScopeAllGroupChats, ScopeAllChatAdministrators, ScopeChat, ScopeChatAdministrators, ScopeChatMember.
MenuButton ​
Represents a bot menu button.
MenuButtonType ​
Enum for menu button discriminator.
ManagedBotUpdated ​
Fired when a managed bot's settings change.
Service & System ​
ServiceMessage ​
Represents a service message.
ServiceActionType ​
Enum for all service action types.
PhoneCallDiscardReason ​
Enum: DiscardMissed, DiscardBusy, DiscardDisconnect, DiscardHangup.
PhoneCallEnded ​
Data for an ended phone call event.
PhoneCallStarted ​
Data for a started phone call event.
ProximityAlertTriggered ​
Fired when a proximity alert is triggered.
VideoChatStarted ​
Fired when a video chat starts.
VideoChatEnded ​
Fired when a video chat ends.
VideoChatScheduled ​
Fired when a video chat is scheduled.
VideoChatMembersInvited ​
Fired when members are invited to a video chat.
GroupCallMember ​
Represents a group call participant.
WriteAccessAllowed ​
Fired when write access is granted to a bot.
GameHighScore ​
type GameHighScore struct {
Position int32
UserID int64
Score int32
}AvailableEffect ​
Represents an available message effect.
ChatColor ​
Represents chat-level color settings.
Restriction ​
Represents a platform restriction on a chat/user.
Settings ​
Account-level settings.
TranslatorFunc ​
Function type for custom message translation.
Forum & Topics ​
ForumTopic ​
type ForumTopic struct {
ID int32
Title string
IconColor int32
IconEmojiID int64
CreatorID int64
IsClosed bool
IsGeneral bool
}ForumTopicCreated ​
Data for a forum topic creation event.
ForumTopicEdited ​
Data for a forum topic edit event.
Checklists & Suggested Posts ​
Checklist ​
Represents a checklist message.
ChecklistTask ​
Single task within a checklist.
SuggestedPostParameters ​
Parameters for a suggested post.
SuggestedPostPrice ​
Pricing for a suggested post.
SuggestedPostState ​
State of a suggested post.
SuggestedPostRefundReason ​
Reason for refunding a suggested post.
Params ​
Parameter structs from the telegram/params package used to configure API calls.
SendMessage ​
type SendMessage struct {
DisableWebPagePreview bool
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
InvertMedia bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
Entities []tl.MessageEntityClass
ParseMode ParseMode
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
RepeatPeriod *int32
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
ShowCaptionAboveMedia bool
MessageThreadID int32
DirectMessagesTopicID int64
ProtectContent bool
}EditMessage ​
type EditMessage struct {
DisableWebPagePreview bool
InvertMedia bool
ReplyMarkup tl.ReplyMarkupClass
ParseMode ParseMode
Entities []tl.MessageEntityClass
ScheduleDate *int32
ShowCaptionAboveMedia bool
BusinessConnectionID string
}CopyMessage ​
type CopyMessage struct {
Caption string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
DisableNotification bool
ReplyToMessageID int32
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
DropAuthor bool
HasSpoiler bool
ShowCaptionAboveMedia bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
ProtectContent bool
NoForwards bool
}ForwardMessages ​
type ForwardMessages struct {
DisableNotification bool
NoForwards bool
DropAuthor bool
DropMediaCaptions bool
ScheduleDate *int32
RepeatPeriod *int32
HideSenderName bool
HideCaptions bool
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
ProtectContent bool
}DeleteMessages ​
type DeleteMessages struct {
Revoke bool
}PinMessage ​
type PinMessage struct {
Silent bool
Unpin bool
}Download ​
type Download struct {
FileName string
ChunkSize int32
Progress ProgressFunc
DCID int32
}InlineQuery ​
type InlineQuery struct {
CacheTime int
Gallery bool
Private bool
NextOffset string
SwitchPM string
SwitchPMText string
}ParseMode ​
type ParseMode stringEnum: ParseModeDefault, ParseModeMarkdown, ParseModeHTML, ParseModeDisabled. Shorthands: Markdown, HTML, MarkdownV2, Disabled.
ProgressFunc ​
type ProgressFunc func(info ProgressInfo)Callback for upload/download progress.
ProgressInfo ​
type ProgressInfo struct {
FileName string
TotalBytes int64
UploadedBytes int64
DownloadedBytes int64
IsUpload bool
}
func (p ProgressInfo) Progress() float64SendPoll ​
type SendPoll struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
PublicVoters bool
MultipleChoice bool
Quiz bool
Closed bool
ShuffleAnswers bool
RevotingDisabled bool
HideResultsUntilClose bool
SubscribersOnly bool
OpenAnswers bool
AllowAddingOptions bool
ClosePeriod *int32
CloseDate *int32
CorrectAnswers [][]byte
Solution *string
SolutionEntities []tl.MessageEntityClass
Description string
DescriptionMedia tl.InputMediaClass
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
}SendVenue ​
type SendVenue struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
Provider string
VenueID string
VenueType string
FoursquareID string
FoursquareType string
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
}SendContact ​
type SendContact struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
Vcard string
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
}SendLocation ​
type SendLocation struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
AccuracyRadius *int32
Heading *int32
ProximityAlertRadius *int32
LivePeriod *int32
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
}SendDice ​
type SendDice struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
Emoticon string
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
}SendGame ​
type SendGame struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
}SendMediaGroup ​
type SendMediaGroup struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
ShowCaptionAboveMedia bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
}SendChecklist ​
type SendChecklist struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
OthersCanAppend bool
OthersCanComplete bool
RepeatPeriod *int32
PaidMessageStars *int64
BusinessConnectionID string
MessageThreadID int32
}SendInlineBotResult ​
type SendInlineBotResult struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
HideVia bool
AllowPaidStars *int64
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
}SendAudio ​
type SendAudio struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
Duration int32
Performer string
Title string
FileName string
Thumb string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
ShowCaptionAboveMedia bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
}SendVideo ​
type SendVideo struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
Duration float64
Width int32
Height int32
SupportsStreaming bool
FileName string
Thumb string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
HasSpoiler bool
TTLSeconds *int32
ViewOnce bool
ShowCaptionAboveMedia bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
NoSound bool
VideoStartTimestamp *int32
VideoCover tl.InputDocumentClass
}SendDocument ​
type SendDocument struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
FileName string
Thumb string
MimeType string
ForceDocument bool
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
ShowCaptionAboveMedia bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
}SendPhoto ​
type SendPhoto struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
FileName string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
HasSpoiler bool
TTLSeconds *int32
ViewOnce bool
ShowCaptionAboveMedia bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
}SendAnimation ​
type SendAnimation struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
FileName string
Thumb string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
HasSpoiler bool
Duration float64
Width int32
Height int32
Unsave bool
ShowCaptionAboveMedia bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
}SendVoice ​
type SendVoice struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
Duration int32
FileName string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
ViewOnce bool
ShowCaptionAboveMedia bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
}SendVideoNote ​
type SendVideoNote struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
Duration float64
FileName string
Thumb string
Length int32
ViewOnce bool
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
}SendSticker ​
type SendSticker struct {
DisableNotification bool
Silent bool
Background bool
ClearDraft bool
NoForwards bool
ProtectContent bool
ReplyToMessageID int32
ReplyTo tl.InputReplyToClass
ReplyMarkup tl.ReplyMarkupClass
ScheduleDate *int32
EffectID *int64
SendAs tl.InputPeerClass
FileName string
Emoji string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
BusinessConnectionID string
AllowPaidBroadcast bool
PaidMessageStarCount *int64
MessageThreadID int32
RepeatPeriod *int32
}AnswerCallback ​
type AnswerCallback struct {
Text string
ShowAlert bool
URL string
CacheTime int32
}AnswerShipping ​
type AnswerShipping struct {
Ok bool
ShippingOptions interface{}
ErrorMsg string
}AnswerPreCheckout ​
type AnswerPreCheckout struct {
Ok bool
ErrorMsg string
}EditCaption ​
type EditCaption struct {
Caption string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
ReplyMarkup tl.ReplyMarkupClass
ShowCaptionAboveMedia bool
BusinessConnectionID string
ScheduleDate *int32
}StoryForward ​
type StoryForward struct {
DisableNotification bool
MessageThreadID int32
ScheduleDate *int32
RepeatPeriod *int32
PaidMessageStarCount *int64
ProtectContent bool
AllowPaidBroadcast bool
ReplyParameters interface{}
ReplyMarkup tl.ReplyMarkupClass
MessageEffectID *int64
}StoryCopy ​
type StoryCopy struct {
Caption string
ParseMode ParseMode
CaptionEntities []tl.MessageEntityClass
Period *int32
MediaAreas interface{}
Privacy string
AllowedUsers []int64
DisallowedUsers []int64
ProtectContent bool
}EditPrivacy ​
type EditPrivacy struct {
Privacy string
AllowedUsers []int64
DisallowedUsers []int64
}React ​
type React struct {
Emoji string
Big bool
}GiftSend ​
type GiftSend struct {
Text string
ParseMode ParseMode
Entities []tl.MessageEntityClass
IsPrivate bool
PayForUpgrade bool
}BuyGift ​
type BuyGift struct {
Ton bool
}GiftPurchaseOffer ​
type GiftPurchaseOffer struct {
Price int64
Duration int32
PaidMessageStarCount *int64
}GetGifts ​
type GetGifts struct {
ExcludeUnsaved bool
ExcludeSaved bool
ExcludeUnlimited bool
ExcludeUnique bool
SortByValue bool
ExcludeUpgradable bool
ExcludeUnupgradable bool
PeerColorAvailable bool
ExcludeHosted bool
CollectionID int32
Offset string
Limit int32
}SendReactionOption ​
type SendReactionOption struct {
Big bool
AddToRecent bool
}SendPaidReactionOption ​
type SendPaidReactionOption struct {
Private bool
}GetStarsTransactionsOption ​
type GetStarsTransactionsOption struct {
Ascending bool
SubscriptionID string
Ton bool
}Keyboard & Entity Helpers ​
Functions from the telegram/params package for building keyboards, reply references, peers, and message entities.
Keyboard Builders ​
| Function | Signature | Description |
|---|---|---|
InlineKeyboard | (rows ...[]KeyboardButton) tl.ReplyMarkupClass | Build an inline keyboard from rows of buttons. |
ReplyKeyboard | (rows ...[]KeyboardButton) tl.ReplyMarkupClass | Build a custom reply keyboard. |
RemoveKeyboard | () tl.ReplyMarkupClass | Remove the current custom keyboard. |
ForceReplyKeyboard | () tl.ReplyMarkupClass | Force the user to reply. |
KeyboardButton ​
type KeyboardButton struct {
Text string
URL string
Data []byte
Switch string
Game bool
Pay bool
}Button constructors:
| Function | Description |
|---|---|
Button(text) | Simple text button. |
ButtonURL(text, url) | Button that opens a URL. |
ButtonCB(text, data) | Callback data button. |
ButtonSwitch(text, query) | Inline switch button. |
ButtonGame(text) | Game launch button. |
ButtonPay(text) | Payment button. |
Reply References ​
| Function | Signature | Description |
|---|---|---|
ReplyToMsg | (msgID int32) tl.InputReplyToClass | Reply to a message by ID. |
ReplyToMsgQuote | (msgID int32, quote string, offset int32) tl.InputReplyToClass | Reply with a quote. |
ReplyToStory | (storyID int32) tl.InputReplyToClass | Reply to a story. |
Peer Constructors ​
| Function | Signature | Description |
|---|---|---|
PeerUser | (id int64) tl.InputPeerClass | Create a user peer. |
PeerChat | (id int64) tl.InputPeerClass | Create a chat peer. |
PeerChannel | (id int64) tl.InputPeerClass | Create a channel peer. |
PeerFromID | (id int64) tl.InputPeerClass | Auto-detect peer type from a bare ID. |
Entity Helpers ​
type EntityType int
type Entity struct { Type EntityType; Offset, Length int32; URL, Language string; CustomEmojiID int64 }Entity constructors:
| Function | Description |
|---|---|
Bold(offset, length) | Bold entity. |
Italic(offset, length) | Italic entity. |
Code(offset, length) | Monospace code entity. |
Pre(offset, length, lang) | Pre-formatted code block. |
Underline(offset, length) | Underlined text. |
Strikethrough(offset, length) | Strikethrough text. |
Spoiler(offset, length) | Spoiler text. |
Blockquote(offset, length) | Block quote. |
CustomEmoji(offset, length, docID) | Custom emoji entity. |
Mention(offset, length) | Mention entity. |
Entities(entities ...Entity) | Collect entities into a slice. |
Generic Helper ​
func GetOptDef[T comparable](def T, opts ...T) TReturns the first valid option from opts, or def when empty. Used internally by the functional-options pattern.
Binder Interfaces ​
Binder ​
Interface injected into Message objects enabling fluent method calls. See Bound Methods (Message).
type Binder interface {
BoundSend(chatID int64, text string, replyTo int32, opts ...*params.SendMessage) (*Message, error)
BoundSendMedia(chatID int64, media tl.InputMediaClass, caption string, replyTo int32, opts ...*params.SendMessage) (*Message, error)
// ... see full interface in types/binder.go
}ChatBinder ​
Interface injected into Chat objects enabling fluent method calls. See Bound Methods (Chat).
type ChatBinder interface {
BoundArchive(chatID int64) error
BoundSetTitle(chatID int64, title string) error
// ... see full interface in types/binder.go
}