telegram

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "telegram"
)

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, conn *Connection) context.Context

Types

type Action

type Action string
const (
	Typing          Action = "typing"
	UploadPhoto     Action = "upload_photo"
	RecordVideo     Action = "record_video"
	UploadVideo     Action = "upload_video"
	RecordVoice     Action = "record_voice"
	UploadVoice     Action = "upload_voice"
	UploadDocument  Action = "upload_document"
	ChooseSticker   Action = "choose_sticker"
	FindLocation    Action = "find_location"
	RecordVideoNote Action = "record_video_note"
	UploadVideoNote Action = "upload_video_note"
)

func (Action) String

func (f Action) String() string

type Animation

type Animation struct {
	FileID       string     `json:"file_id"`        // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string     `json:"file_unique_id"` // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	Width        int        `json:"width"`          // Video width as defined by sender
	Height       int        `json:"height"`         // Video height as defined by sender
	Duration     Duration   `json:"duration"`       // Duration of the video in seconds as defined by sender
	Thumb        *PhotoSize `json:"thumb"`          // Optional. Animation thumbnail as defined by sender
	FileName     string     `json:"file_name"`      // Optional. Original animation filename as defined by sender
	MimeType     string     `json:"mime_type"`      // Optional. MIME type of the file as defined by sender
	FileSize     int        `json:"file_size"`      // Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
}

Animation This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).

type ApproveChatJoinRequest

type ApproveChatJoinRequest struct {
	ChatID int64 `json:"chat_id"` //	Unique identifier for the target chat or username of the target channel (in the format @channelusername)
	UserID int64 `json:"user_id"` //	Unique identifier of the target user
}

type Audio

type Audio struct {
	FileID       string   `json:"file_id"`        // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string   `json:"file_unique_id"` // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	Duration     Duration `json:"duration"`       // Duration of the audio in seconds as defined by sender
	Performer    string   `json:"performer"`      // Optional. Performer of the audio as defined by sender or by audio tags
	Title        string   `json:"title"`          // Optional. Title of the audio as defined by sender or by audio tags
	FileName     string   `json:"file_name"`      // Optional. Original filename as defined by sender
	MimeType     string   `json:"mime_type"`      // Optional. MIME type of the file as defined by sender
	FileSize     int      `json:"file_size"`      // Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
}

Audio This object represents an audio file to be treated as music by the Telegram clients.

type CallbackGame

type CallbackGame struct {
}

CallbackGame A placeholder, currently holds no information. Use BotFather to set up your game.

type CallbackQuery

type CallbackQuery struct {
	ID              string   `json:"id"`                // Unique identifier for this query
	From            *User    `json:"from"`              // Sender
	Message         *Message `json:"message"`           // Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old
	InlineMessageID string   `json:"inline_message_id"` // Optional. Identifier of the message sent via the bot in inline mode, that originated the query.
	ChatInstance    string   `json:"chat_instance"`     // Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.
	Data            string   `json:"data"`              // Optional. Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data.
	GameShortName   string   `json:"game_short_name"`   // Optional. Short name of a Game to be returned, serves as the unique identifier for the game
}

CallbackQuery This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.

type Chat

type Chat struct {
	ID                                 int64            `json:"id"`                                      // Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	Type                               ChatType         `json:"type"`                                    // Type of chat, can be either “private”, “group”, “supergroup” or “channel”
	Title                              string           `json:"title"`                                   // Optional. Title, for supergroups, channels and group chats
	Username                           string           `json:"username"`                                // Optional. Username, for private chats, supergroups and channels if available
	FirstName                          string           `json:"first_name"`                              // Optional. First name of the other party in a private chat
	LastName                           string           `json:"last_name"`                               // Optional. Last name of the other party in a private chat
	Photo                              *ChatPhoto       `json:"ChatPhoto"`                               // Optional. Chat photo. Returned only in getChat.
	Bio                                string           `json:"bio"`                                     // Optional. Bio of the other party in a private chat. Returned only in getChat.
	HasPrivateForwards                 bool             `json:"has_private_forwards"`                    // Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.
	HasRestrictedVoiceAndVideoMessages bool             `json:"has_restricted_voice_and_video_messages"` // Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.
	JoinToSendMessages                 bool             `json:"join_to_send_messages"`                   // Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
	JoinByRequest                      bool             `json:"join_by_request"`                         // Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
	Description                        string           `json:"description"`                             // Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
	InviteLink                         string           `json:"invite_link"`                             // Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
	PinnedMessage                      *Message         `json:"pinned_message"`                          // Optional. The most recent pinned message (by sending date). Returned only in getChat.
	Permissions                        *ChatPermissions `json:"permissions"`                             // Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
	SlowModeDelay                      int              `json:"slow_mode_delay"`                         // Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat.
	MessageAutoDeleteTime              int              `json:"message_auto_delete_time"`                // Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
	HasProtectedContent                bool             `json:"has_protected_content"`                   // Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.
	StickerSetName                     string           `json:"sticker_set_name"`                        // Optional. For supergroups, name of group sticker set. Returned only in getChat.
	CanSetStickerSet                   bool             `json:"can_set_sticker_set"`                     // Optional. True, if the bot can change the group sticker set. Returned only in getChat.
	LinkedChatID                       int64            `json:"linked_chat_id"`                          // Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
	Location                           *ChatLocation    `json:"location"`                                // Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
}

Chat This object represents a chat.

type ChatInviteLink struct {
	InviteLink              string `json:"invite_link"`                // The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”.
	Creator                 *User  `json:"creator"`                    // Creator of the link
	CreatesJoinRequest      bool   `json:"creates_join_request"`       // True, if users joining the chat via the link need to be approved by chat administrators
	IsPrimary               bool   `json:"is_primary"`                 // True, if the link is primary
	IsRevoked               bool   `json:"is_revoked"`                 // True, if the link is revoked
	Name                    string `json:"name"`                       // Optional. Invite link name
	ExpireDate              Date   `json:"expire_date"`                // Optional. Point in time (Unix timestamp) when the link will expire or has been expired
	MemberLimit             int    `json:"member_limit"`               // Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
	PendingJoinRequestCount int    `json:"pending_join_request_count"` // Optional. Number of pending join requests created using this link
}

ChatInviteLink Represents an invite link for a chat.

type ChatJoinRequest

type ChatJoinRequest struct {
	Chat       *Chat           `json:"chat"`        // Chat to which the request was sent
	From       *User           `json:"from"`        // User that sent the join request
	Date       Date            `json:"date"`        // Date the request was sent in Unix time
	Bio        string          `json:"bio"`         // Optional. Bio of the user.
	InviteLink *ChatInviteLink `json:"invite_link"` // Optional. Chat invite link that was used by the user to send the join request
}

ChatJoinRequest Represents a join request sent to a chat.

type ChatLocation

type ChatLocation struct {
	Location Location `json:"location"` // The location to which the supergroup is connected. Can't be a live location.
	Address  string   `json:"address"`  // Location address; 1-64 characters, as defined by the chat owner
}

ChatLocation Represents a location to which a chat is connected.

type ChatMember

type ChatMember struct {
	Owner         *ChatMemberOwner         `json:"-"`
	Administrator *ChatMemberAdministrator `json:"-"`
	Member        *ChatMemberMember        `json:"-"`
	Restricted    *ChatMemberRestricted    `json:"-"`
	Left          *ChatMemberLeft          `json:"-"`
	Banned        *ChatMemberBanned        `json:"-"`
}

ChatMember This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported: ChatMemberOwner ChatMemberAdministrator ChatMemberMember ChatMemberRestricted ChatMemberLeft ChatMemberBanned

func (*ChatMember) UnmarshalJSON

func (c *ChatMember) UnmarshalJSON(b []byte) error

type ChatMemberAdministrator

type ChatMemberAdministrator struct {
	Status              string `json:"status"`                 // The member's status in the chat, always “administrator”
	User                User   `json:"user"`                   // Information about the user
	CanBeEdited         bool   `json:"can_be_edited"`          // True, if the bot is allowed to edit administrator privileges of that user
	IsAnonymous         bool   `json:"is_anonymous"`           // True, if the user's presence in the chat is hidden
	CanManageChat       bool   `json:"can_manage_chat"`        // True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
	CanDeleteMessages   bool   `json:"can_delete_messages"`    // True, if the administrator can delete messages of other users
	CanManageVideoChats bool   `json:"can_manage_video_chats"` // True, if the administrator can manage video chats
	CanRestrictMembers  bool   `json:"can_restrict_members"`   // True, if the administrator can restrict, ban or unban chat members
	CanPromoteMembers   bool   `json:"can_promote_members"`    // True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)
	CanChangeInfo       bool   `json:"can_change_info"`        // True, if the user is allowed to change the chat title, photo and other settings
	CanInviteUsers      bool   `json:"can_invite_users"`       // True, if the user is allowed to invite new users to the chat
	CanPostMessages     bool   `json:"can_post_messages"`      // Optional. True, if the administrator can post in the channel; channels only
	CanEditMessages     bool   `json:"can_edit_messages"`      // Optional. True, if the administrator can edit messages of other users and can pin messages; channels only
	CanPinMessages      bool   `json:"can_pin_messages"`       // Optional. True, if the user is allowed to pin messages; groups and supergroups only
	CustomTitle         string `json:"custom_title"`           // Optional. Custom title for this user
}

ChatMemberAdministrator Represents a chat member that has some additional privileges.

type ChatMemberBanned

type ChatMemberBanned struct {
	Status    string `json:"status"`     // The member's status in the chat, always “kicked”
	User      User   `json:"user"`       // Information about the user
	UntilDate Date   `json:"until_date"` // Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever
}

ChatMemberBanned Represents a chat member that was banned in the chat and can't return to the chat or view chat messages.

type ChatMemberLeft

type ChatMemberLeft struct {
	Status string `json:"status"` // The member's status in the chat, always “left”
	User   User   `json:"user"`   // Information about the user
}

ChatMemberLeft Represents a chat member that isn't currently a member of the chat, but may join it themselves.

type ChatMemberMember

type ChatMemberMember struct {
	Status string `json:"status"` // The member's status in the chat, always “member”
	User   User   `json:"user"`   // Information about the user
}

ChatMemberMember Represents a chat member that has no additional privileges or restrictions.

type ChatMemberOwner

type ChatMemberOwner struct {
	Status      string `json:"status"`       // The member's status in the chat, always “creator”
	User        User   `json:"user"`         // Information about the user
	IsAnonymous bool   `json:"is_anonymous"` // True, if the user's presence in the chat is hidden
	CustomTitle string `json:"custom_title"` // Optional. Custom title for this user
}

ChatMemberOwner Represents a chat member that owns the chat and has all administrator privileges.

type ChatMemberRestricted

type ChatMemberRestricted struct {
	Status                string `json:"status"`                    // The member's status in the chat, always “restricted”
	User                  User   `json:"user"`                      // Information about the user
	IsMember              bool   `json:"is_member"`                 // True, if the user is a member of the chat at the moment of the request
	CanChangeInfo         bool   `json:"can_change_info"`           // True, if the user is allowed to change the chat title, photo and other settings
	CanInviteUsers        bool   `json:"can_invite_users"`          // True, if the user is allowed to invite new users to the chat
	CanPinMessages        bool   `json:"can_pin_messages"`          // True, if the user is allowed to pin messages
	CanSendMessages       bool   `json:"can_send_messages"`         // True, if the user is allowed to send text messages, contacts, locations and venues
	CanSendMediaMessages  bool   `json:"can_send_media_messages"`   // True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes
	CanSendPolls          bool   `json:"can_send_polls"`            // True, if the user is allowed to send polls
	CanSendOtherMessages  bool   `json:"can_send_other_messages"`   // True, if the user is allowed to send animations, games, stickers and use inline bots
	CanAddWebPagePreviews bool   `json:"can_add_web_page_previews"` // True, if the user is allowed to add web page previews to their messages
	UntilDate             Date   `json:"until_date"`                // Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever
}

ChatMemberRestricted Represents a chat member that is under certain restrictions in the chat. Supergroups only.

type ChatMemberUpdated

type ChatMemberUpdated struct {
	Chat          *Chat           `json:"chat"`            // Chat the user belongs to
	From          *User           `json:"from"`            // Performer of the action, which resulted in the change
	Date          Date            `json:"date"`            // Date the change was done in Unix time
	OldChatMember ChatMember      `json:"old_chat_member"` // Previous information about the chat member
	NewChatMember ChatMember      `json:"new_chat_member"` // New information about the chat member
	InviteLink    *ChatInviteLink `json:"invite_link"`     // Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only.
}

ChatMemberUpdated This object represents changes in the status of a chat member.

type ChatPermissions

type ChatPermissions struct {
	CanSendMessages       bool `json:"can_send_messages"`         // Optional. True, if the user is allowed to send text messages, contacts, locations and venues
	CanSendMediaMessages  bool `json:"can_send_media_messages"`   // Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
	CanSendPolls          bool `json:"can_send_polls"`            // Optional. True, if the user is allowed to send polls, implies can_send_messages
	CanSendOtherMessages  bool `json:"can_send_other_messages"`   // Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages
	CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` // Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages
	CanChangeInfo         bool `json:"can_change_info"`           // Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
	CanInviteUsers        bool `json:"can_invite_users"`          // Optional. True, if the user is allowed to invite new users to the chat
	CanPinMessages        bool `json:"can_pin_messages"`          // Optional. True, if the user is allowed to pin messages. Ignored in public supergroups
}

ChatPermissions Describes actions that a non-administrator user is allowed to take in a chat.

type ChatPhoto

type ChatPhoto struct {
	SmallFileID       string `json:"small_file_id"`        // File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
	SmallFileUniqueID string `json:"small_file_unique_id"` // Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	BigFileID         string `json:"big_file_id"`          // File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
	BigFileUniqueID   string `json:"big_file_unique_id"`   // Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
}

ChatPhoto This object represents a chat photo.

type ChatType

type ChatType string
const (
	Private    ChatType = "private"
	Group      ChatType = "group"
	SuperGroup ChatType = "supergroup"
	Channel    ChatType = "channel"
)

type ChosenInlineResult

type ChosenInlineResult struct {
	ResultID        string    `json:"result_id"`         // The unique identifier for the result that was chosen
	From            *User     `json:"from"`              // The user that chose the result
	Location        *Location `json:"location"`          // Optional. Sender location, only for bots that require user location
	InlineMessageID string    `json:"inline_message_id"` // Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.
	Query           string    `json:"query"`             // The query that was used to obtain the result
}

ChosenInlineResult Represents a result of an inline query that was chosen by the user and sent to their chat partner.

type Configs

type Configs struct {
	TelegramToken            string           `env:"TELEGRAM_TOKEN,required"`
	TelegramTimeout          time.Duration    `env:"TELEGRAM_TIMOUT" envDefault:"0"`
	TelegramDefaultParseMode FormattingOption `env:"TELEGRAM_DEFAULT_PARSE_MODE" envDefault:"HTML"`
}

type Connection

type Connection struct {
	Configs
	User
}

func Connect

func Connect(configs Configs) (*Connection, error)

func FromContext

func FromContext(ctx context.Context) *Connection

func (Connection) ApproveChatJoinRequest

func (c Connection) ApproveChatJoinRequest(req ApproveChatJoinRequest) (bool, error)

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

func (c Connection) CreateChatInviteLink(req CreateChatInviteLink) (*ChatInviteLink, error)

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

func (Connection) DeclineChatJoinRequest

func (c Connection) DeclineChatJoinRequest(req DeclineChatJoinRequest) (bool, error)

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

func (Connection) DeleteMessage

func (c Connection) DeleteMessage(req DeleteMessage) (bool, error)

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

func (Connection) EditMessageText

func (c Connection) EditMessageText(req EditMessageText) (*Message, error)

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

func (Connection) GetFile

func (c Connection) GetFile(req GetFile) (*File, io.Reader, error)

GetFile Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.

func (Connection) GetMe

func (c Connection) GetMe() (*User, error)

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

func (Connection) GetUpdates

func (c Connection) GetUpdates(req GetUpdates) ([]Update, error)

GetUpdates Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects. Notes 1. This method will not work if an outgoing webhook is set up. 2. In order to avoid getting duplicate updates, recalculate offset after each server response.

func (Connection) SendAction

func (c Connection) SendAction(req SendAction) (bool, error)

SendAction Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot. We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

func (Connection) SendDocument

func (c Connection) SendDocument(req SendDocument) (*Message, error)

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

func (Connection) SendMessage

func (c Connection) SendMessage(req SendMessage) (*Message, error)

SendMessage Use this method to send text messages. On success, the sent Message is returned. reply_markup InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply

type Contact

type Contact struct {
	PhoneNumber string `json:"phone_number"` // Contact's phone number
	FirstName   string `json:"first_name"`   // Contact's first name
	LastName    string `json:"last_name"`    // Optional. Contact's last name
	UserID      int64  `json:"user_id"`      // Optional. Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	VCard       string `json:"vcard"`        // Optional. Additional data about the contact in the form of a vCard
}

Contact This object represents a phone contact.

type CreateChatInviteLink struct {
	ChatID             int64  `json:"chat_id"`                        //	Unique identifier for the target chat or username of the target channel (in the format @channelusername)
	Name               string `json:"name,omitempty"`                 // Optional. Invite link name; 0-32 characters
	ExpireDate         Date   `json:"expire_date,omitempty"`          // Optional. Point in time (Unix timestamp) when the link will expire
	MemberLimit        int    `json:"member_limit,omitempty"`         // Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
	CreatesJoinRequest bool   `json:"creates_join_request,omitempty"` // Optional. True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
}

type Date

type Date int64

func (Date) Time

func (d Date) Time() time.Time

type DeclineChatJoinRequest

type DeclineChatJoinRequest struct {
	ChatID int64 `json:"chat_id"` //	Unique identifier for the target chat or username of the target channel (in the format @channelusername)
	UserID int64 `json:"user_id"` //	Unique identifier of the target user
}

type DeleteMessage

type DeleteMessage struct {
	ChatID    int64 `json:"chat_id"`    // Unique identifier for the target chat or username of the target channel (in the format @channelusername)
	MessageID int64 `json:"message_id"` // Identifier of the message to delete
}

type Dice

type Dice struct {
	Emoji string `json:"emoji"` // Emoji on which the dice throw animation is based
	Value int    `json:"value"` // Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji
}

Dice This object represents an animated emoji that displays a random value.

type Document

type Document struct {
	FileID       string     `json:"file_id"`        // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string     `json:"file_unique_id"` // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	Thumb        *PhotoSize `json:"thumb"`          // Optional. Document thumbnail as defined by sender
	FileName     string     `json:"file_name"`      // Optional. Original filename as defined by sender
	MimeType     string     `json:"mime_type"`      // Optional. MIME type of the file as defined by sender
	FileSize     int        `json:"file_size"`      // Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
}

Document This object represents a general file (as opposed to photos, voice messages and audio files).

type Duration

type Duration int

func (Duration) Duration

func (d Duration) Duration() time.Duration

type EditMessageText

type EditMessageText struct {
	ChatID                int64            `json:"chat_id,omitempty"`                  // Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
	MessageID             int64            `json:"message_id,omitempty"`               // Optional. Required if inline_message_id is not specified. Identifier of the message to edit
	InlineMessageID       string           `json:"inline_message_id,omitempty"`        // Optional. Required if chat_id and message_id are not specified. Identifier of the inline message
	Text                  string           `json:"text"`                               // Text of the message to be sent, 1-4096 characters after entities parsing
	ParseMode             FormattingOption `json:"parse_mode,omitempty"`               // Optional. Mode for parsing entities in the message text. See formatting options for more details.
	Entities              []MessageEntity  `json:"entities,omitempty"`                 // Optional. A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
	DisableWebPagePreview bool             `json:"disable_web_page_preview,omitempty"` // Optional. Disables link previews for links in this message
	ReplyMarkup           KeyboardMarkup   `json:"reply_markup,omitempty"`             // Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
}

type EncryptedCredentials

type EncryptedCredentials struct {
	Data   string `json:"data"`   // Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication
	Hash   string `json:"hash"`   // Base64-encoded data hash for data authentication
	Secret string `json:"secret"` // Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption
}

EncryptedCredentials Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.

type EncryptedPassportElement

type EncryptedPassportElement struct {
	Type        string         `json:"type"`         // Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
	Data        string         `json:"data"`         // Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials.
	PhoneNumber string         `json:"phone_number"` // Optional. User's verified phone number, available only for “phone_number” type
	Email       string         `json:"email"`        // Optional. User's verified email address, available only for “email” type
	Files       []PassportFile `json:"files"`        // Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
	FrontSide   *PassportFile  `json:"front_side"`   // Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
	ReverseSide *PassportFile  `json:"reverse_side"` // Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
	Selfie      *PassportFile  `json:"selfie"`       // Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
	Translation []PassportFile `json:"translation"`  // Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
	Hash        string         `json:"hash"`         // Base64-encoded element hash for using in PassportElementErrorUnspecified
}

EncryptedPassportElement Describes documents or other Telegram Passport elements shared with the bot by the user.

type EntityType

type EntityType string
const (
	BotCommandEntity EntityType = "bot_command"
)

func (EntityType) String

func (f EntityType) String() string

type Error

type Error struct {
	OK          bool   `json:"ok"`
	ErrorCode   int    `json:"error_code"`
	Description string `json:"description"`
}

type File

type File struct {
	FileID       string `json:"file_id"`        // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string `json:"file_unique_id"` // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileSize     int    `json:"file_size"`      // Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FilePath     string `json:"file_path"`      // Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
}

File This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. The maximum file size to download is 20 MB

type ForceReply

type ForceReply struct {
	ForceReply            bool   `json:"force_reply"`             // Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'
	InputFieldPlaceholder string `json:"input_field_placeholder"` // Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters
	Selective             bool   `json:"selective"`               // Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
}

ForceReply Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.

type FormattingOption

type FormattingOption string
const (
	MarkdownV2 FormattingOption = "MarkdownV2"
	HTML       FormattingOption = "HTML"
	Markdown   FormattingOption = "Markdown"
)

func (FormattingOption) MarshalText

func (f FormattingOption) MarshalText() (text []byte, err error)

func (FormattingOption) String

func (f FormattingOption) String() string

func (*FormattingOption) UnmarshalText

func (f *FormattingOption) UnmarshalText(text []byte) error

type Game

type Game struct {
	Title        string           `json:"title"`         // Title of the game
	Description  string           `json:"description"`   // Description of the game
	Photo        *PhotoSize       `json:"photo"`         // Photo that will be displayed in the game message in chats.
	Text         string           `json:"text"`          // Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
	TextEntities []*MessageEntity `json:"text_entities"` // Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
	Animation    *Animation       `json:"animation"`     // Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
}

Game This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.

type GetFile

type GetFile struct {
	FileID string `json:"file_id"` // Required. File identifier to get information about
}

type GetUpdates

type GetUpdates struct {
	Offset         uint          `json:"offset,omitempty"`          // Optional. Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.
	Limit          uint8         `json:"limit,omitempty"`           // Optional. Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
	Timeout        time.Duration `json:"timeout,omitempty"`         // Optional. Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
	AllowedUpdates []UpdateType  `json:"allowed_updates,omitempty"` // Optional. A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the request to the getUpdates, so unwanted updates may be received for a short period of time.
}

type InlineKeyboardButton

type InlineKeyboardButton struct {
	Text                         string        `json:"text"`                                       // Label text on the button
	URL                          string        `json:"url,omitempty"`                              // Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.
	CallbackData                 string        `json:"callback_data,omitempty"`                    // Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
	WebApp                       *WebAppInfo   `json:"web_app,omitempty"`                          // Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot.
	LoginURL                     *LoginUrl     `json:"login_url,omitempty"`                        // Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
	SwitchInlineQuery            string        `json:"switch_inline_query,omitempty"`              // Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.
	SwitchInlineQueryCurrentChat string        `json:"switch_inline_query_current_chat,omitempty"` // Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted. This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options.
	CallbackGame                 *CallbackGame `json:"callback_game,omitempty"`                    // Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.
	Pay                          bool          `json:"pay,omitempty"`                              // Optional. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
}

InlineKeyboardButton This object represents one button of an inline keyboard. You must use exactly one of the optional fields.

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"` // Array of button rows, each represented by an Array of InlineKeyboardButton objects
}

InlineKeyboardMarkup This object represents an inline keyboard that appears right next to the message it belongs to.

type InlineQuery

type InlineQuery struct {
	ID       string    `json:"id"`        // Unique identifier for this query
	From     *User     `json:"from"`      // Sender
	Query    string    `json:"query"`     // Text of the query (up to 256 characters)
	Offset   string    `json:"offset"`    // Offset of the results to be returned, can be controlled by the bot
	ChatType string    `json:"chat_type"` // Optional. Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat
	Location *Location `json:"location"`  // Optional. Sender location, only for bots that request user location
}

InlineQuery This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.

type InputFile

type InputFile interface {
	// contains filtered or unexported methods
}

type InputFileContent

type InputFileContent struct {
	Name    string
	Content []byte
}

func (InputFileContent) InputFileID

func (i InputFileContent) InputFileID()

type InputFileID

type InputFileID struct {
	ID string
}

type Invoice

type Invoice struct {
	Title          string `json:"title"`           // Product name
	Description    string `json:"description"`     // Product description
	StartParameter string `json:"start_parameter"` // Unique bot deep-linking parameter that can be used to generate this invoice
	Currency       string `json:"currency"`        // Three-letter ISO 4217 currency code
	TotalAmount    int    `json:"total_amount"`    // Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
}

Invoice This object contains basic information about an invoice.

type KeyboardButton

type KeyboardButton struct {
	Text            string                  `json:"text"`                       // Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
	RequestContact  bool                    `json:"request_contact,omitempty"`  // Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
	RequestLocation bool                    `json:"request_location,omitempty"` // Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only.
	RequestPoll     *KeyboardButtonPollType `json:"request_poll,omitempty"`     // Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.
	WebApp          *WebAppInfo             `json:"web_app,omitempty"`          // Optional. If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only.
}

KeyboardButton This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields web_app, request_contact, request_location, and request_poll are mutually exclusive. Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message. Note: request_poll option will only work in Telegram versions released after 23 January, 2020. Older clients will display unsupported message. Note: web_app option will only work in Telegram versions released after 16 April, 2022. Older clients will display unsupported message.

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	Type string `json:"type"` // Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
}

KeyboardButtonPollType This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.

type KeyboardMarkup

type KeyboardMarkup interface {
	// contains filtered or unexported methods
}

type Location

type Location struct {
	Longitude            float32 `json:"longitude"`              // Longitude as defined by sender
	Latitude             float32 `json:"latitude"`               // Latitude as defined by sender
	HorizontalAccuracy   float32 `json:"horizontal_accuracy"`    // Optional. The radius of uncertainty for the location, measured in meters; 0-1500
	LivePeriod           int     `json:"live_period"`            // Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only.
	Heading              int     `json:"heading"`                // Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only.
	ProximityAlertRadius int     `json:"proximity_alert_radius"` // Optional. The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
}

Location This object represents a point on the map.

type LoginUrl

type LoginUrl struct {
	URL                string `json:"url"`                  // An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data. NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
	ForwardText        string `json:"forward_text"`         // Optional. New text of the button in forwarded messages.
	BotUsername        string `json:"bot_username"`         // Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details.
	RequestWriteAccess bool   `json:"request_write_access"` // Optional. Pass True to request the permission for your bot to send messages to the user.
}

LoginUrl This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in: Telegram apps support these buttons as of version 5.7.

type MaskPosition

type MaskPosition struct {
	Point  string  `json:"point"`   // The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
	XShift float32 `json:"x_shift"` // Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
	YShift float32 `json:"y_shift"` // Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
	Scale  float32 `json:"scale"`   // Mask scaling coefficient. For example, 2.0 means double size.
}

MaskPosition This object describes the position on faces where a mask should be placed by default.

type Message

type Message struct {
	MessageID                     int64                          `json:"message_id"`                        // Unique message identifier inside this chat
	From                          *User                          `json:"from"`                              // Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
	SenderChat                    *Chat                          `json:"sender_chat"`                       // Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
	Date                          Date                           `json:"date"`                              // Date the message was sent in Unix time
	Chat                          *Chat                          `json:"chat"`                              // Conversation the message belongs to
	ForwardFrom                   *User                          `json:"forward_from"`                      // Optional. For forwarded messages, sender of the original message
	ForwardFromChat               *Chat                          `json:"forward_from_chat"`                 // Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat
	ForwardFromMessageID          int64                          `json:"forward_from_message_id"`           // Optional. For messages forwarded from channels, identifier of the original message in the channel
	ForwardSignature              string                         `json:"forward_signature"`                 // Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present
	ForwardSenderName             string                         `json:"forward_sender_name"`               // Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages
	ForwardDate                   Date                           `json:"forward_date"`                      // Optional. For forwarded messages, date the original message was sent in Unix time
	IsAutomaticForward            bool                           `json:"is_automatic_forward"`              // Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
	ReplyToMessage                *Message                       `json:"reply_to_message"`                  // Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
	ViaBot                        *User                          `json:"via_bot"`                           // Optional. Bot through which the message was sent
	EditDate                      Date                           `json:"edit_date"`                         // Optional. Date the message was last edited in Unix time
	HasProtectedContent           bool                           `json:"has_protected_content"`             // Optional. True, if the message can't be forwarded
	MediaGroupID                  string                         `json:"media_group_id"`                    // Optional. The unique identifier of a media message group this message belongs to
	AuthorSignature               string                         `json:"author_signature"`                  // Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
	Text                          string                         `json:"text"`                              // Optional. For text messages, the actual UTF-8 text of the message
	Entities                      []MessageEntity                `json:"entities"`                          // Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
	Animation                     *Animation                     `json:"animation"`                         // Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
	Audio                         *Audio                         `json:"audio"`                             // Optional. Message is an audio file, information about the file
	Document                      *Document                      `json:"document"`                          // Optional. Message is a general file, information about the file
	Photo                         []*PhotoSize                   `json:"photo"`                             // Optional. Message is a photo, available sizes of the photo
	Sticker                       *Sticker                       `json:"sticker"`                           // Optional. Message is a sticker, information about the sticker
	Video                         *Video                         `json:"video"`                             // Optional. Message is a video, information about the video
	VideoNote                     *VideoNote                     `json:"video_note"`                        // Optional. Message is a video note, information about the video message
	Voice                         *Voice                         `json:"voice"`                             // Optional. Message is a voice message, information about the file
	Caption                       string                         `json:"caption"`                           // Optional. Caption for the animation, audio, document, photo, video or voice
	CaptionEntities               []*MessageEntity               `json:"caption_entities"`                  // Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
	Contact                       *Contact                       `json:"contact"`                           // Optional. Message is a shared contact, information about the contact
	Dice                          *Dice                          `json:"dice"`                              // Optional. Message is a dice with random value
	Game                          *Game                          `json:"game"`                              // Optional. Message is a game, information about the game. More about games »
	Poll                          *Poll                          `json:"poll"`                              // Optional. Message is a native poll, information about the poll
	Venue                         *Venue                         `json:"venue"`                             // Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set
	Location                      *Location                      `json:"location"`                          // Optional. Message is a shared location, information about the location
	NewChatMembers                []*User                        `json:"new_chat_members"`                  // Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
	LeftChatMember                *User                          `json:"left_chat_member"`                  // Optional. A member was removed from the group, information about them (this member may be the bot itself)
	NewChatTitle                  string                         `json:"new_chat_title"`                    // Optional. A chat title was changed to this value
	NewChatPhoto                  []*PhotoSize                   `json:"new_chat_photo"`                    // Optional. A chat photo was change to this value
	DeleteChatPhoto               bool                           `json:"delete_chat_photo"`                 // Optional. Service message: the chat photo was deleted
	GroupChatCreated              bool                           `json:"group_chat_created"`                // Optional. Service message: the group has been created
	SupergroupChatCreated         bool                           `json:"supergroup_chat_created"`           // Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
	ChannelChatCreated            bool                           `json:"channel_chat_created"`              // Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed"` // Optional. Service message: auto-delete timer settings changed in the chat
	MigrateToChatID               int64                          `json:"migrate_to_chat_id"`                // Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	MigrateFromChatID             int64                          `json:"migrate_from_chat_id"`              // Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	PinnedMessage                 *Message                       `json:"pinned_message"`                    // Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
	Invoice                       *Invoice                       `json:"invoice"`                           // Optional. Message is an invoice for a payment, information about the invoice. More about payments »
	SuccessfulPayment             *SuccessfulPayment             `json:"successful_payment"`                // Optional. Message is a service message about a successful payment, information about the payment. More about payments »
	ConnectedWebsite              string                         `json:"connected_website"`                 // Optional. The domain name of the website on which the user has logged in. More about Telegram Login »
	PassportData                  *PassportData                  `json:"passport_data"`                     // Optional. Telegram Passport data
	ProximityAlertTriggered       *ProximityAlertTriggered       `json:"proximity_alert_triggered"`         // Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
	VideoChatScheduled            *VideoChatScheduled            `json:"video_chat_scheduled"`              // Optional. Service message: video chat scheduled
	VideoChatStarted              *VideoChatStarted              `json:"video_chat_started"`                // Optional. Service message: video chat started
	VideoChatEnded                *VideoChatEnded                `json:"video_chat_ended"`                  // Optional. Service message: video chat ended
	VideoChatParticipantsInvited  *VideoChatParticipantsInvited  `json:"video_chat_participants_invited"`   // Optional. Service message: new participants invited to a video chat
	WebAppData                    *WebAppData                    `json:"web_app_data"`                      // Optional. Service message: data sent by a Web App
	ReplyMarkup                   *InlineKeyboardMarkup          `json:"reply_markup"`                      // Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
}

Message This object represents a message.

type MessageAutoDeleteTimerChanged

type MessageAutoDeleteTimerChanged struct {
	MessageAutoDeleteTime int `json:"message_auto_delete_time"` // New auto-delete time for messages in the chat; in seconds
}

MessageAutoDeleteTimerChanged This object represents a service message about a change in auto-delete timer settings.

type MessageEntity

type MessageEntity struct {
	Type          EntityType `json:"type"`            // Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers)
	Offset        int        `json:"offset"`          // Offset in UTF-16 code units to the start of the entity
	Length        int        `json:"length"`          // Length of the entity in UTF-16 code units
	URL           string     `json:"url"`             // Optional. For “text_link” only, URL that will be opened after user taps on the text
	User          *User      `json:"user"`            // Optional. For “text_mention” only, the mentioned user
	Language      string     `json:"language"`        // Optional. For “pre” only, the programming language of the entity text
	CustomEmojiID string     `json:"custom_emoji_id"` // Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker
}

MessageEntity This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

type OrderInfo

type OrderInfo struct {
	Name            string           `json:"name"`             // Optional. User name
	PhoneNumber     string           `json:"phone_number"`     // Optional. User's phone number
	Email           string           `json:"email"`            // Optional. User email
	ShippingAddress *ShippingAddress `json:"shipping_address"` // Optional. User shipping address
}

type PassportData

type PassportData struct {
	Data        []EncryptedPassportElement `json:"data"`        // Array with information about documents and other Telegram Passport elements that was shared with the bot
	Credentials EncryptedCredentials       `json:"credentials"` // Encrypted credentials required to decrypt the data
}

PassportData Describes Telegram Passport data shared with the bot by the user.

type PassportFile

type PassportFile struct {
	FileID       string `json:"file_id"`        // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string `json:"file_unique_id"` // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileSize     int    `json:"file_size"`      // File size in bytes
	FileDate     Date   `json:"file_date"`      // Unix time when the file was uploaded
}

PassportFile This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.

type PhotoSize

type PhotoSize struct {
	FileID       string `json:"file_id"`        // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string `json:"file_unique_id"` // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	Width        int    `json:"width"`          // Photo width
	Height       int    `json:"height"`         // Photo height
	FileSize     int    `json:"file_size"`      // Optional. File size in bytes
}

PhotoSize This object represents one size of a photo or a file / sticker thumbnail.

type Poll

type Poll struct {
	ID                    string          `json:"id"`                      // Unique poll identifier
	Question              string          `json:"question"`                // Poll question, 1-300 characters
	Options               []PollOption    `json:"options"`                 // List of poll options
	TotalVoterCount       int             `json:"total_voter_count"`       // Total number of users that voted in the poll
	IsClosed              bool            `json:"is_closed"`               // True, if the poll is closed
	IsAnonymous           bool            `json:"is_anonymous"`            // True, if the poll is anonymous
	Type                  string          `json:"type"`                    // type, currently can be “regular” or “quiz”
	AllowsMultipleAnswers bool            `json:"allows_multiple_answers"` // True, if the poll allows multiple answers
	CorrectOptionID       int             `json:"correct_option_id"`       // Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
	Explanation           string          `json:"explanation"`             // Optional. 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
	ExplanationEntities   []MessageEntity `json:"explanation_entities"`    // Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
	OpenPeriod            int             `json:"open_period"`             // Optional. Amount of time in seconds the poll will be active after creation
	CloseDate             Date            `json:"close_date"`              // Optional. Point in time (Unix timestamp) when the poll will be automatically closed
}

Poll This object contains information about a poll.

type PollAnswer

type PollAnswer struct {
	PollID    string `json:"poll_id"`    // Unique poll identifier
	User      User   `json:"user"`       // The user, who changed the answer to the poll
	OptionIDs []int  `json:"option_ids"` // 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.
}

PollAnswer This object represents an answer of a user in a non-anonymous poll.

type PollOption

type PollOption struct {
	Text       string `json:"text"`        // Option text, 1-100 characters
	VoterCount int    `json:"voter_count"` // Number of users that voted for this option
}

PollOption This object contains information about one answer option in a poll.

type PreCheckoutQuery

type PreCheckoutQuery struct {
	ID               string     `json:"id"`                 // Unique query identifier
	From             *User      `json:"from"`               // User who sent the query
	Currency         string     `json:"currency"`           // Three-letter ISO 4217 currency code
	TotalAmount      int        `json:"total_amount"`       // Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	InvoicePayload   string     `json:"invoice_payload"`    // Bot specified invoice payload
	ShippingOptionID string     `json:"shipping_option_id"` // Optional. Identifier of the shipping option chosen by the user
	OrderInfo        *OrderInfo `json:"order_info"`         // Optional. Order information provided by the user
}

PreCheckoutQuery This object contains information about an incoming pre-checkout query.

type ProximityAlertTriggered

type ProximityAlertTriggered struct {
	Traveler User `json:"traveler"` // User that triggered the alert
	Watcher  User `json:"watcher"`  // User that set the alert
	Distance int  `json:"distance"` // The distance between the users
}

ProximityAlertTriggered This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	Keyboard              [][]KeyboardButton `json:"keyboard"`                // Array of button rows, each represented by an Array of KeyboardButton objects
	ResizeKeyboard        bool               `json:"resize_keyboard"`         // Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
	OneTimeKeyboard       bool               `json:"one_time_keyboard"`       // Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
	InputFieldPlaceholder string             `json:"input_field_placeholder"` // Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters
	Selective             bool               `json:"selective"`               // Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard.
}

ReplyKeyboardMarkup This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	RemoveKeyboard bool `json:"remove_keyboard"` // Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)
	Selective      bool `json:"selective"`       // Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet.
}

ReplyKeyboardRemove Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).

type Response

type Response[T any] struct {
	OK     bool `json:"ok"`
	Result T    `json:"result"`
}

type SendAction

type SendAction struct {
	ChatID          int64  `json:"chat_id"`                     // Unique identifier for the target chat or username of the target channel (in the format @channelusername)
	Action          Action `json:"action"`                      // Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.
	MessageThreadID int    `json:"message_thread_id,omitempty"` // Optional. Unique identifier for the target message thread; supergroups only
}

type SendDocument

type SendDocument struct {
	ChatID                      int64            `json:"chat_id"`                                  // Unique identifier for the target chat or username of the target channel (in the format @channelusername)
	MessageThreadID             int              `json:"message_thread_id,omitempty"`              // Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	Document                    InputFile        `json:"document"`                                 // File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data
	Thumbnail                   InputFile        `json:"thumbnail,omitempty"`                      // Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>
	Caption                     string           `json:"caption"`                                  // Text of the message to be sent, 1-4096 characters after entities parsing
	ParseMode                   FormattingOption `json:"parse_mode,omitempty"`                     // Optional. Mode for parsing entities in the message text. See formatting options for more details.
	CaptionEntities             []MessageEntity  `json:"caption_entities,omitempty"`               // Optional. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	DisableContentTypeDetection bool             `json:"disable_content_type_detection,omitempty"` // Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data
	DisableNotification         bool             `json:"disable_notification,omitempty"`           // Optional. Sends the message silently. Users will receive a notification with no sound.
	ProtectContent              bool             `json:"protect_content,omitempty"`                // Optional. Protects the contents of the sent message from forwarding and saving
	ReplyToMessageID            int64            `json:"reply_to_message_id,omitempty"`            // Optional. If the message is a reply, ID of the original message
	AllowSendingWithoutReply    bool             `json:"allow_sending_without_reply,omitempty"`    // Optional. Pass True if the message should be sent even if the specified replied-to message is not found
	ReplyMarkup                 KeyboardMarkup   `json:"reply_markup,omitempty"`                   // Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
}

type SendMessage

type SendMessage struct {
	ChatID                   int64            `json:"chat_id"`                               // Unique identifier for the target chat or username of the target channel (in the format @channelusername)
	Text                     string           `json:"text"`                                  // Text of the message to be sent, 1-4096 characters after entities parsing
	ParseMode                FormattingOption `json:"parse_mode,omitempty"`                  // Optional. Mode for parsing entities in the message text. See formatting options for more details.
	Entities                 []MessageEntity  `json:"entities,omitempty"`                    // Optional. A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
	DisableWebPagePreview    bool             `json:"disable_web_page_preview,omitempty"`    // Optional. Disables link previews for links in this message
	DisableNotification      bool             `json:"disable_notification,omitempty"`        // Optional. Sends the message silently. Users will receive a notification with no sound.
	ProtectContent           bool             `json:"protect_content,omitempty"`             // Optional. Protects the contents of the sent message from forwarding and saving
	ReplyToMessageID         int64            `json:"reply_to_message_id,omitempty"`         // Optional. If the message is a reply, ID of the original message
	AllowSendingWithoutReply bool             `json:"allow_sending_without_reply,omitempty"` // Optional. Pass True if the message should be sent even if the specified replied-to message is not found
	ReplyMarkup              KeyboardMarkup   `json:"reply_markup,omitempty"`                // Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
}

type ShippingAddress

type ShippingAddress struct {
	CountryCode string `json:"country_code"` // Two-letter ISO 3166-1 alpha-2 country code
	State       string `json:"state"`        // State, if applicable
	City        string `json:"city"`         // City
	StreetLine1 string `json:"street_line1"` // First line for the address
	StreetLine2 string `json:"street_line2"` // Second line for the address
	PostCode    string `json:"post_code"`    // Address post code
}

type ShippingQuery

type ShippingQuery struct {
	ID              string           `json:"id"`               // Unique query identifier
	From            *User            `json:"from"`             // User who sent the query
	InvoicePayload  string           `json:"invoice_payload"`  // Bot specified invoice payload
	ShippingAddress *ShippingAddress `json:"shipping_address"` // User specified shipping address
}

type Sticker

type Sticker struct {
	FileID           string        `json:"file_id"`           // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID     string        `json:"file_unique_id"`    // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	Type             string        `json:"type"`              // Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video.
	Width            int           `json:"width"`             // Sticker width
	Height           int           `json:"height"`            // Sticker height
	IsAnimated       bool          `json:"is_animated"`       // True, if the sticker is animated
	IsVideo          bool          `json:"is_video"`          // True, if the sticker is a video sticker
	Thumb            *PhotoSize    `json:"thumb"`             // Optional. Sticker thumbnail in the .WEBP or .JPG format
	Emoji            string        `json:"emoji"`             // Optional. Emoji associated with the sticker
	SetName          string        `json:"set_name"`          // Optional. Name of the sticker set to which the sticker belongs
	PremiumAnimation *File         `json:"premium_animation"` // Optional. For premium regular stickers, premium animation for the sticker
	MaskPosition     *MaskPosition `json:"mask_position"`     // Optional. For mask stickers, the position where the mask should be placed
	CustomEmojiID    string        `json:"custom_emoji_id"`   // Optional. For custom emoji stickers, unique identifier of the custom emoji
	FileSize         int           `json:"file_size"`         // Optional. File size in bytes
}

Sticker This object represents a sticker.

type SuccessfulPayment

type SuccessfulPayment struct {
	Currency                string     `json:"currency"`                   // Three-letter ISO 4217 currency code
	TotalAmount             int        `json:"total_amount"`               // Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	InvoicePayload          string     `json:"invoice_payload"`            // Bot specified invoice payload
	ShippingOptionID        string     `json:"shipping_option_id"`         // Optional. Identifier of the shipping option chosen by the user
	OrderInfo               *OrderInfo `json:"order_info"`                 // Optional. Order information provided by the user
	TelegramPaymentChargeID string     `json:"telegram_payment_charge_id"` // Telegram payment identifier
	ProviderPaymentChargeID string     `json:"provider_payment_charge_id"` // Provider payment identifier
}

SuccessfulPayment This object contains basic information about a successful payment.

type Update

type Update struct {
	UpdateID           uint                `json:"update_id"`            // The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.
	Message            *Message            `json:"message"`              // Optional. New incoming message of any kind - text, photo, sticker, etc.
	EditedMessage      *Message            `json:"edited_message"`       // Optional. New version of a message that is known to the bot and was edited
	ChannelPost        *Message            `json:"channel_post"`         // Optional. New incoming channel post of any kind - text, photo, sticker, etc.
	EditedChannelPost  *Message            `json:"edited_channel_post"`  // Optional. New version of a channel post that is known to the bot and was edited
	InlineQuery        *InlineQuery        `json:"inline_query"`         // Optional. New incoming inline query
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"` // Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.
	CallbackQuery      *CallbackQuery      `json:"callback_query"`       // Optional. New incoming callback query
	ShippingQuery      *ShippingQuery      `json:"shipping_query"`       // Optional. New incoming shipping query. Only for invoices with flexible price
	PreCheckoutQuery   *PreCheckoutQuery   `json:"pre_checkout_query"`   // Optional. New incoming pre-checkout query. Contains full information about checkout
	Poll               *Poll               `json:"poll"`                 // Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot
	PollAnswer         *PollAnswer         `json:"poll_answer"`          // Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
	MyChatMember       *ChatMemberUpdated  `json:"my_chat_member"`       // Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.
	ChatMember         *ChatMemberUpdated  `json:"chat_member"`          // Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates.
	ChatJoinRequest    *ChatJoinRequest    `json:"chat_join_request"`    // Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.
}

Update This object represents an incoming update. At most one of the optional parameters can be present in any given update.

func (Update) Chat

func (u Update) Chat() *Chat

func (Update) From

func (u Update) From() *User

func (Update) IsCommand

func (u Update) IsCommand() bool

func (Update) IsSimilarCommand

func (u Update) IsSimilarCommand(commands []string) bool

func (Update) MessageID

func (u Update) MessageID() int64

func (Update) Type

func (u Update) Type() UpdateType

type UpdateType

type UpdateType string
const (
	MessageUpdate            UpdateType = "message"
	EditedMessageUpdate      UpdateType = "edited_message"
	ChannelPostUpdate        UpdateType = "channel_post"
	EditedChannelPostUpdate  UpdateType = "edited_channel_post"
	InlineQueryUpdate        UpdateType = "inline_query"
	ChosenInlineResultUpdate UpdateType = "chosen_inline_result"
	CallbackQueryUpdate      UpdateType = "callback_query"
	ShippingQueryUpdate      UpdateType = "shipping_query"
	PreCheckoutQueryUpdate   UpdateType = "pre_checkout_query"
	PollUpdate               UpdateType = "poll"
	PollAnswerUpdate         UpdateType = "poll_answer"
	MyChatMemberUpdate       UpdateType = "my_chat_member"
	ChatMemberUpdate         UpdateType = "chat_member"
	ChatJoinRequestUpdate    UpdateType = "chat_join_request"
)

func (UpdateType) String

func (f UpdateType) String() string

type User

type User struct {
	ID                      int64  `json:"id"`                          // Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	IsBot                   bool   `json:"is_bot"`                      // True, if this user is a bot
	FirstName               string `json:"first_name"`                  // User's or bot's first name
	LastName                string `json:"last_name"`                   // Optional. User's or bot's last name
	Username                string `json:"username"`                    // Optional. User's or bot's username
	LanguageCode            string `json:"language_code"`               // Optional. IETF language tag of the user's language
	IsPremium               bool   `json:"is_premium"`                  // Optional. True, if this user is a Telegram Premium user
	AddedToAttachmentMenu   bool   `json:"added_to_attachment_menu"`    // Optional. True, if this user added the bot to the attachment menu
	CanJoinGroups           bool   `json:"can_join_groups"`             // Optional. True, if the bot can be invited to groups. Returned only in getMe.
	CanReadAllGroupMessages bool   `json:"can_read_all_group_messages"` // Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
	SupportsInlineQueries   bool   `json:"supports_inline_queries"`     // Optional. True, if the bot supports inline queries. Returned only in getMe.
}

User This object represents a Telegram user or bot.

type Venue

type Venue struct {
	Location        Location `json:"location"`          // Venue location. Can't be a live location
	Title           string   `json:"title"`             // Name of the venue
	Address         string   `json:"address"`           // Address of the venue
	FoursquareID    string   `json:"foursquare_id"`     // Optional. Foursquare identifier of the venue
	FoursquareType  string   `json:"foursquare_type"`   // Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
	GooglePlaceID   string   `json:"google_place_id"`   // Optional. Google Places identifier of the venue
	GooglePlaceType string   `json:"google_place_type"` // Optional. Google Places type of the venue. (See supported types.)
}

Venue This object represents a venue.

type Video

type Video struct {
	FileID       string     `json:"file_id"`        // file_id			String		Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string     `json:"file_unique_id"` // file_unique_id	String		Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	Width        int        `json:"width"`          // width			Integer		Video width as defined by sender
	Height       int        `json:"height"`         // height			Integer		Video height as defined by sender
	Duration     Duration   `json:"duration"`       // duration			Integer		Duration of the video in seconds as defined by sender
	Thumb        *PhotoSize `json:"thumb"`          // thumb			PhotoSize	Optional. Video thumbnail
	FileName     string     `json:"file_name"`      // file_name		String		Optional. Original filename as defined by sender
	MimeType     string     `json:"mime_type"`      // mime_type		String		Optional. MIME type of the file as defined by sender
	FileSize     int        `json:"file_size"`      // file_size		Integer		Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
}

Video This object represents a video file.

type VideoChatEnded

type VideoChatEnded struct {
	Duration Duration `json:"duration"` // Video chat duration in seconds
}

VideoChatEnded This object represents a service message about a video chat ended in the chat.

type VideoChatParticipantsInvited

type VideoChatParticipantsInvited struct {
	Users []User `json:"users"` // New members that were invited to the video chat
}

VideoChatParticipantsInvited This object represents a service message about new members invited to a video chat.

type VideoChatScheduled

type VideoChatScheduled struct {
	StartDate Date `json:"start_date"` // Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator
}

VideoChatScheduled This object represents a service message about a video chat scheduled in the chat.

type VideoChatStarted

type VideoChatStarted struct {
}

VideoChatStarted This object represents a service message about a video chat started in the chat. Currently holds no information.

type VideoNote

type VideoNote struct {
	FileID       string     `json:"file_id"`        // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string     `json:"file_unique_id"` // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	Length       int        `json:"length"`         // Video width and height (diameter of the video message) as defined by sender
	Duration     Duration   `json:"duration"`       // Duration of the video in seconds as defined by sender
	Thumb        *PhotoSize `json:"thumb"`          // Optional. Video thumbnail
	FileSize     int        `json:"file_size"`      // Optional. File size in bytes
}

VideoNote This object represents a video message (available in Telegram apps as of v.4.0).

type Voice

type Voice struct {
	FileID       string   `json:"file_id"`        // Identifier for this file, which can be used to download or reuse the file
	FileUniqueID string   `json:"file_unique_id"` // Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	Duration     Duration `json:"duration"`       // Duration of the audio in seconds as defined by sender
	MimeType     string   `json:"mime_type"`      // Optional. MIME type of the file as defined by sender
	FileSize     int      `json:"file_size"`      // Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
}

Voice This object represents a voice note.

type WebAppData

type WebAppData struct {
	Data       string `json:"data"`        // The data. Be aware that a bad client can send arbitrary data in this field.
	ButtonText string `json:"button_text"` // Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field.
}

WebAppData Describes data sent from a Web App to the bot.

type WebAppInfo

type WebAppInfo struct {
	URL string `json:"url"` // An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps
}

WebAppInfo Describes a Web App.

Jump to

Keyboard shortcuts

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