Skip to content

GramIO API Reference / @gramio/contexts/dist

@gramio/contexts/dist

Enumerations

EnumerationDescription
ChatTypeEnum of ChatType property
EntityTypeEnum of EntityType property
PollTypeEnum of PollType property

Classes

ClassDescription
AcceptedGiftTypesThis object describes the types of gifts that can be gifted to a user or a chat.
AnimationAttachmentThis object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
AttachmentSimple attachment
AudioAttachmentThis object represents an audio file to be treated as music by the Telegram clients.
BackgroundFillFreeformGradientThe background is a freeform gradient that rotates after every message in the chat.
BackgroundFillGradientThe background is a gradient fill.
BackgroundFillSolidThe background is filled using the selected color.
BackgroundTypeChatThemeThe background is taken directly from a built-in chat theme.
BackgroundTypeFillThe background is automatically filled based on the selected colors.
BackgroundTypePatternThe background is a PNG or TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.
BackgroundTypeWallpaperThe background is a wallpaper in the JPEG format.
BirthdateDescribes the birthdate of a user.
BoostAddedContextThis object represents a service message about a forum topic closed in the chat. Currently holds no information.
BotAccessSettingsDescribes the access settings of a bot.
BotCommandThis object represents a bot command
BotDescriptionThis object represents the bot's description.
BotShortDescriptionThis object represents the bot's short description.
BusinessBotRightsRepresents the rights of a business bot.
BusinessConnectionDescribes the connection of the bot with a business account.
BusinessConnectionContextThis object Describes the connection of the bot with a business account.
BusinessIntroContains information about the start page settings of a Telegram Business account.
BusinessLocationContains information about the location of a Telegram Business account.
BusinessMessagesDeletedDescribes the connection of the bot with a business account.
BusinessMessagesDeletedContextThis object represents a boost added to a chat or changed.
BusinessOpeningHoursDocumentation
BusinessOpeningHoursIntervalDescribes an interval of time during which a business is open.
CallbackGameA placeholder, currently holds no information.
CallbackQueryThis 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.
CallbackQueryContextCalled when callback_query event occurs
ChatThis object represents a chat.
ChatActionMixinMain base context
ChatAdministratorRightsRepresents the rights of an administrator in a chat.
ChatBackgroundThis object represents a chat background.
ChatBackgroundSetContextThis object represents a service message about chat background set.
ChatBoostThis object contains information about a chat boost.
ChatBoostAddedThis object represents a service message about a user boosting a chat.
ChatBoostContextThis object represents a boost added to a chat or changed.
ChatBoostRemovedThis object represents a boost added to a chat or changed.
ChatBoostSourceGiftCodeThe boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
ChatBoostSourceGiveawayThe boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
ChatBoostSourcePremiumThe boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.
ChatBoostUpdatedThis object represents a boost added to a chat or changed.
ChatControlMixinThis object represents a mixin that is responsible for all the chat management methods
ChatFullInfoThis object contains full information about a chat.
ChatInviteControlMixinThis object represents a mixin that works with all *ChatInviteLink methods
ChatInviteLinkRepresents an invite link for a chat.
ChatJoinRequestRepresents a join request sent to a chat.
ChatJoinRequestContextRepresents a join request sent to a chat.
ChatLocationRepresents a location to which a chat is connected.
ChatMemberThis 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
ChatMemberContextThis object represents changes in the status of a chat member.
ChatMemberControlMixinThis object represents a mixin that is able to control member's rights
ChatMemberUpdatedThis object represents changes in the status of a chat member.
ChatOwnerChangedDescribes a service message about an ownership change in the chat.
ChatOwnerChangedContextThis object represents a service message about an ownership change in the chat.
ChatOwnerLeftDescribes a service message about the chat owner leaving the chat.
ChatOwnerLeftContextThis object represents a service message about the chat owner leaving the chat.
ChatPermissionsDescribes actions that a non-administrator user is allowed to take in a chat.
ChatPhotoThis object represents a chat photo.
ChatSenderControlMixinThis object is a mixin that does all the chat-sender stuff, right?
ChatSharedThis object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button.
ChatSharedContextThis object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button.
ChecklistDescribes a checklist.
ChecklistTaskDescribes a task in a checklist.
ChecklistTasksAddedDescribes a service message about tasks added to a checklist.
ChecklistTasksAddedContextThis object represents a service message about checklist tasks added.
ChecklistTasksDoneDescribes a service message about checklist tasks marked as done or not done.
ChecklistTasksDoneContextThis object represents a service message about checklist tasks done.
ChosenInlineResultRepresents a result of an inline query that was chosen by the user and sent to their chat partner.
ChosenInlineResultContextThe result of an inline query that was chosen by a user and sent to their chat partner
CloneMixinThis object represents a mixin which has clone(options?) method
CommunityThis object represents a community — several supergroups, channels, and bots linked together around a shared topic or audience.
CommunityChatAddedThis object represents a service message about a chat being added to a community.
CommunityChatAddedContextThis object represents a service message about a chat being added to a community.
CommunityChatJoinedA service event describing a chat joining an existing community.
CommunityChatJoinedContextA service message about a chat joining a community.
CommunityChatRemovedThis object represents a service message about a chat being removed from a community. Currently holds no information.
CommunityChatRemovedContextThis object represents a service message about a chat being removed from a community. Currently holds no information.
ContactThis object represents a phone contact.
ContactAttachmentThis object represents a phone contact.
ContextMain base context
DeleteChatPhotoContextService message: the chat photo was deleted
DiceThis object represents an animated emoji that displays a random value.
DirectMessagePriceChangedDescribes a service message about a change in the price of direct messages sent to a channel chat.
DirectMessagePriceChangedContextThis object represents a service message about direct message price changed.
DirectMessagesTopicDescribes a topic of a direct messages chat.
DocumentAttachmentThis object represents a general file (as opposed to photos, voice messages and audio files).
DownloadMixinThis object represents a mixin that can be used to download media files
EncryptedCredentialsContains data required for decrypting and authenticatin EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
EncryptedPassportElementContains information about documents or other Telegram Passport elements shared with the bot by the user.
ExternalReplyInfoThis object contains information about a message that is being replied to, which may come from another chat or forum topic.
FileThis 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.
FileAttachmentAttachment with fileId and fileUniqueId properties
ForumMixinThis object represents a mixin that's used in all topic-related updates
ForumTopicClosedThis object represents a service message about a forum topic closed in the chat. Currently holds no information.
ForumTopicClosedContextThis object represents a service message about a forum topic closed in the chat. Currently holds no information.
ForumTopicCreatedThis object represents a service message about a new forum topic created in the chat.
ForumTopicCreatedContextThis object represents a service message about a new forum topic created in the chat.
ForumTopicEditedThis object represents a service message about an edited forum topic.
ForumTopicEditedContextThis object represents a service message about an edited forum topic.
ForumTopicReopenedThis object represents a service message about an edited forum topic.
ForumTopicReopenedContextThis object represents a service message about a forum topic reopened in the chat. Currently holds no information.
GameThis object represents a game.
GeneralForumTopicHiddenThis object represents a service message about General forum topic hidden in the chat. Currently holds no information.
GeneralForumTopicHiddenContextThis object represents a service message about General forum topic hidden in the chat. Currently holds no information.
GeneralForumTopicUnhiddenThis object represents a service message about General forum topic unhidden in the chat. Currently holds no information.
GeneralForumTopicUnhiddenContextThis object represents a service message about General forum topic unhidden in the chat. Currently holds no information.
GiftDescribes a service message about a regular gift that was sent or received.
GiftBackgroundThis object describes the background of a gift.
GiftContextThis object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button.
GiftInfoDescribes a service message about a regular gift that was sent or received.
GiftUpgradeSentContextThis object represents a service message about an upgrade of a gift that was purchased after the gift was sent.
GiveawayThis object represents a message about a scheduled giveaway.
GiveawayCompletedThis object represents a service message about the completion of a giveaway without public winners.
GiveawayCompletedContextThis object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
GiveawayCreatedThis object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
GiveawayCreatedContextThis object represents a service message about the creation of a scheduled giveaway.
GiveawayWinnersThis object represents a message about the completion of a giveaway with public winners.
GiveawayWinnersContextThis object represents a message about the completion of a giveaway with public winners.
GroupChatCreatedContextservice message: the group has been created
InaccessibleMessageThis object describes a message that was deleted or is otherwise inaccessible to the bot.
InlineKeyboardButtonThis object represents one button of an inline keyboard. You must use exactly one of the optional fields.
InlineKeyboardMarkupThis object represents an inline keyboard that appears right next to the message it belongs to.
InlineQueryThis object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
InlineQueryContextThis object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
InlineQueryResultLocationRepresents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
InputChecklistDescribes a checklist to create.
InputChecklistTaskDescribes a task to add to a checklist.
InputLocationMessageContentRepresents the content of a location message to be sent as the result of an inline query.
InputPollOptionThis object contains information about one answer option in a poll to send.
InvoiceThis object contains basic information about an invoice.
InvoiceContextMessage is an invoice for a payment, information about the invoice. More about payments »
LeftChatMemberContextA member was removed from the group, information about them (this member may be the bot itself)
LinkRepresents an HTTP link.
LinkPreviewOptionsDescribes the options used for link preview generation.
LivePhotoAttachmentThis object represents a live photo.
LocationThis object represents a point on the map.
LocationAttachmentThis object represents a point on the map.
LocationContextThis object represents a point on the map.
LoginUrlThis object represents a parameter of the inline keyboard button used to automatically authorize a user.
ManagedBotContextThis object represents a new bot created to be managed by the current bot, or a bot whose token was changed.
ManagedBotCreatedThis object contains information about the bot that was created to be managed by the current bot.
ManagedBotCreatedContextThis object represents a service message about a user creating a bot that will be managed by the current bot.
ManagedBotUpdatedThis object contains information about the creation or token update of a bot that is managed by the current bot.
MaskPositionThis object describes the position on faces where a mask should be placed by default.
MenuButtonThis object describes the bot's menu button in a private chat.
MessageThis object represents a message.
MessageAutoDeleteTimerChangedThis object represents a service message about a change in auto-delete timer settings
MessageAutoDeleteTimerChangedContextThis object represents a service message about a change in auto-delete timer settings.
MessageContextCalled when message event occurs
MessageDraftA handle to a streaming plain-text message draft — the await using companion to SendMixin.streamMessage's iterable form, mirroring RichMessageDraft.
MessageEntityThis object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
MessageGenerationStoppedInformation about a message draft whose generation was stopped by the user.
MessageGenerationStoppedContextCalled when a user stops an in-progress message draft.
MessageIdThis object represents a unique message identifier.
MessageOriginChannelThe message was originally sent to a channel chat.
MessageOriginChatThe message was originally sent on behalf of a chat to a group chat.
MessageOriginHiddenUserThe message was originally sent by an unknown user.
MessageOriginUserThe message was originally sent by a known user.
MessageReactionContextThis object represents a change of a reaction on a message performed by a user.
MessageReactionCountContextThis object represents reaction changes on a message with anonymous reactions.
MessageReactionCountUpdatedThis object represents reaction changes on a message with anonymous reactions.
MessageReactionUpdatedThis object represents a change of a reaction on a message performed by a user.
MigrateFromChatIdContextThe 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.
MigrateToChatIdContextThe 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.
NewChatMembersContextNew members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
NewChatPhotoContextA chat photo was change to this value
NewChatTitleContextA chat title was changed to this value
NodeMixinThis object represents a mixin which has id field and can invoke id-dependent methods
OrderInfoThis object represents information about an order.
PaidMediaInfoDescribes the paid media added to a message.
PaidMediaLivePhotoThe paid media is a live photo.
PaidMediaPhotoThe paid media is a photo.
PaidMediaPreviewThe paid media isn't available before the payment.
PaidMediaPurchasedContextThis object contains information about a paid media purchase.
PaidMediaVideoThe paid media is a video.
PaidMessagePriceChangedContextDescribes a service message about a change in the price of paid messages within a chat.
PassportDataContains information about Telegram Passport data shared with the bot by the user.
PassportDataContextDescribes Telegram Passport data shared with the bot by the user.
PassportFileThis object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
PhotoAttachmentThis object represents a photo file with it's sizes
PhotoSizeThis object represents one size of a photo or a file / sticker thumbnail
PinnedMessageContextSpecified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
PinsMixinThis object represents a mixin that ensures you have methods to pin/unpin messages in the chat
PollThis object contains information about a poll.
PollAnswerThis object represents an answer of a user in a non-anonymous poll.
PollAnswerContextThis object represents an answer of a user in a non-anonymous poll.
PollAttachmentThis object contains information about a poll.
PollContextThis object contains information about a poll.
PollMediaDescribes media attached to a poll, poll option, or quiz explanation.
PollOptionThis object contains information about one answer option in a poll.
PollOptionAddedDescribes a service message about an option added to a poll.
PollOptionAddedContextThis object represents a service message about an option added to a poll.
PollOptionDeletedDescribes a service message about an option deleted from a poll.
PollOptionDeletedContextThis object represents a service message about an option deleted from a poll.
PreCheckoutQueryThis object contains information about an incoming pre-checkout query.
PreCheckoutQueryContextThis object contains information about an incoming pre-checkout query.
ProximityAlertTriggeredThis object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
ProximityAlertTriggeredContextThis object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
ReactionCountRepresents a reaction added to a message along with the number of times it was added.
ReactionTypeCustomEmojiThe reaction is based on a custom emoji.
ReactionTypeEmojiThe reaction is based on an emoji.
ReactionTypePaidThe reaction is paid.
RefundedPaymentThis object contains basic information about a refunded payment.
RefundedPaymentContextThis object contains basic information about a successful payment.
RemovedChatBoostContextThis object represents a boost removed from a chat.
RichMessageRich formatted message.
RichMessageDraftA handle to a streaming rich-message draft.
SendMixinThis object represents a mixin which can invoke chatId/senderId-dependent methods
SentGuestMessageDescribes an inline message sent by a guest bot.
SentWebAppMessageContains information about an inline message sent by a Web App on behalf of a user.
SharedUserThis object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button.
ShippingAddressThis object represents a shipping address.
ShippingQueryThis object contains information about an incoming shipping query.
ShippingQueryContextThis object contains information about an incoming shipping query.
StickerAttachmentThis object represents a sticker.
StickerSetThis object represents a sticker set.
StoryThis object represents a story.
StoryAttachmentThis object represents a story.
SubscriptionContextThis object contains information about changes to a user payment subscription toward the current bot.
SuccessfulPaymentThis object contains basic information about a successful payment.
SuccessfulPaymentContextThis object contains basic information about a successful payment.
SuggestedPostApprovalFailedDescribes a service message about the failed approval of a suggested post.
SuggestedPostApprovalFailedContextThis object represents a service message about the failed approval of a suggested post.
SuggestedPostApprovedDescribes a service message about the approval of a suggested post.
SuggestedPostApprovedContextThis object represents a service message about the approval of a suggested post.
SuggestedPostDeclinedDescribes a service message about the rejection of a suggested post.
SuggestedPostDeclinedContextThis object represents a service message about the rejection of a suggested post.
SuggestedPostInfoContains information about a suggested post.
SuggestedPostPaidDescribes a service message about a successful payment for a suggested post.
SuggestedPostPaidContextThis object represents a service message about a successful payment for a suggested post.
SuggestedPostPriceDescribes price of a suggested post.
SuggestedPostRefundedDescribes a service message about a payment refund for a suggested post.
SuggestedPostRefundedContextThis object represents a service message about a payment refund for a suggested post.
TargetMixinThis object represents a mixin which has sender data (e.g. senderId, from etc.)
TextQuoteThis object contains information about the quoted part of a message that is replied to by the given message.
UniqueGiftThis object describes a unique gift that was upgraded from a regular gift.
UniqueGiftBackdropThis object describes the colors of the backdrop of a unique gift.
UniqueGiftBackdropColorsDescribes a service message about a regular gift that was sent or received.
UniqueGiftColorsThis object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift.
UniqueGiftContextThis object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button.
UniqueGiftInfoDescribes a service message about a unique gift that was sent or received.
UniqueGiftModelDescribes a service message about a regular gift that was sent or received.
UniqueGiftSymbolDescribes a service message about a regular gift that was sent or received.
UpdateThis object represents an incoming update.
UserThis object represents a Telegram user or bot.
UserProfileAudiosThis object represents the audios displayed on a user's profile.
UserProfilePhotosThis object represent a user's profile pictures.
UserRatingThis object describes the rating of a user based on their Telegram Star spendings.
UsersSharedThis object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button.
UsersSharedContextThis object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.
VenueThis object represents a venue.
VenueAttachmentThis object represents a venue.
VideoAttachmentThis object represents a video file.
VideoChatEndedThis object represents a service message about a video chat ended in the chat.
VideoChatEndedContextThis object represents a service message about a video chat ended in the chat.
VideoChatParticipantsInvitedThis object represents a service message about new members invited to a video chat.
VideoChatParticipantsInvitedContextThis object represents a service message about new members invited to a video chat.
VideoChatScheduledThis object represents a service message about a video chat scheduled in the chat
VideoChatScheduledContextThis object represents a service message about a video chat scheduled in the chat.
VideoChatStartedThis object represents a service message about a video chat started in the chat. Currently holds no information.
VideoChatStartedContextThis object represents a service message about a video chat started in the chat.
VideoNoteAttachmentThis object represents a video message.
VideoQualityThis object represents a video file of a specific quality.
VoiceAttachmentThis object represents a voice note.
WebAppDataContains data sent from a Web App to the bot.
WebAppDataContextDescribes data sent from a Web App to the bot.
WebAppInfoContains information about a Web App.
WriteAccessAllowedThis object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.
WriteAccessAllowedContextThis object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.

Interfaces

InterfaceDescription
AttachmentsMappingMapping attachments type to their structures
BotLikeThe required object that the contexts are based on
DefaultAttachmentBase interface for attachment
FileDownloadA lazy, Response-like handle for a file download (returned by bot.downloadFile / context.download). It is a PromiseLike<ArrayBuffer> — so awaiting it yields the bytes — plus readers mirroring the web Response.
RichStringLikeA branded value carrying a @gramio/format rich message (Markdown or structured blocks).
StreamMessageOptionsOptions for SendMixin.streamMessage
StreamRichMessageOptionsOptions for Contexts.MessageContext.streamRichMessage | streamRichMessage

Type Aliases

Type AliasDescription
AttachmentTypeUnion type of attachments type
ConstructorType helper constructor
ContextsMappingMapping events to their contexts
ContextTypeType util to get type of Context
CustomEventNameCustom Event Name
GetDerives-
IsAnyHelper to detect if a type is 'any'
JoinUnionType helper to join union type
MaybeArrayType helper to add array and non-array type
MessageContextWithRequiredFrom-
MessageDraftAppendA piece appendable to a Contexts.MessageContext.streamMessage | message draft handle — text + optional entities (a FormattableString fits).
MessageDraftPieceA chunk of text for streaming via sendMessageDraft
MessageEventNameUnion type of MessageEvent names
OptionalMake some keys optional
RequireLike Required<T> but for specified keys of T
RequireValueLike Require<O, K> but it sets V as the value for K values
RichChunkA chunk appendable to a Markdown rich-message draft — a @gramio/format RichString or raw rich-markdown.
SoftStringPermits string but gives hints
tSendAnimationThis type represent SendAnimationParams and used by Contexts.MessageContext.sendMedia
tSendAudioThis type represent SendAudioParams and used by Contexts.MessageContext.sendMedia
tSendDocumentThis type represent SendDocumentParams and used by Contexts.MessageContext.sendMedia
tSendMethodsThis Union type represent a media that can be sended and used by Contexts.MessageContext.sendMedia
tSendPhotoThis type represent SendPhotoParams and used by Contexts.MessageContext.sendMedia
tSendStickerThis type represent SendStickerParams and used by Contexts.MessageContext.sendMedia
tSendVideoThis type represent SendVideoParams and used by Contexts.MessageContext.sendMedia
tSendVideoNoteThis type represent SendVideoNoteParams and used by Contexts.MessageContext.sendMedia
tSendVoiceThis type represent SendVoiceParams and used by Contexts.MessageContext.sendMedia
UpdateNameUnion type of Update names

Variables

applyMixins

const applyMixins: (derivedCtor, baseCtors) => void

Defined in: contexts/index.d.ts:49

Helper for construct mixins

Parameters

ParameterType
derivedCtorany
baseCtorsany[]

Returns

void


backgroundFillMap

const backgroundFillMap: object

Defined in: contexts/index.d.ts:1235

This object describes the way a background is filled based on the selected colors. Currently, it can be one of

Documentation

Type Declaration

NameTypeDefined in
freeform_gradienttypeof BackgroundFillFreeformGradientcontexts/index.d.ts:1238
gradienttypeof BackgroundFillGradientcontexts/index.d.ts:1237
solidtypeof BackgroundFillSolidcontexts/index.d.ts:1236

backgroundTypeMap

const backgroundTypeMap: object

Defined in: contexts/index.d.ts:1363

This object describes the type of a background. Currently, it can be one of

Documentation

Type Declaration

NameTypeDefined in
chat_themetypeof BackgroundTypeChatThemecontexts/index.d.ts:1367
filltypeof BackgroundTypeFillcontexts/index.d.ts:1364
patterntypeof BackgroundTypePatterncontexts/index.d.ts:1366
wallpapertypeof BackgroundTypeWallpapercontexts/index.d.ts:1365

contextsMappings

const contextsMappings: object

Defined in: contexts/index.d.ts:7619

Mapping UpdateNames to their contexts

Type Declaration

NameTypeDefined in
boost_addedtypeof BoostAddedContextcontexts/index.d.ts:7661
business_connectiontypeof BusinessConnectionContextcontexts/index.d.ts:7646
business_messagetypeof MessageContextcontexts/index.d.ts:7642
callback_querytypeof CallbackQueryContextcontexts/index.d.ts:7620
channel_posttypeof MessageContextcontexts/index.d.ts:7639
chat_background_settypeof ChatBackgroundSetContextcontexts/index.d.ts:7662
chat_boosttypeof ChatBoostContextcontexts/index.d.ts:7698
chat_join_requesttypeof ChatJoinRequestContextcontexts/index.d.ts:7621
chat_membertypeof ChatMemberContextcontexts/index.d.ts:7622
chat_owner_changedtypeof ChatOwnerChangedContextcontexts/index.d.ts:7687
chat_owner_lefttypeof ChatOwnerLeftContextcontexts/index.d.ts:7686
chat_sharedtypeof ChatSharedContextcontexts/index.d.ts:7682
checklist_tasks_addedtypeof ChecklistTasksAddedContextcontexts/index.d.ts:7664
checklist_tasks_donetypeof ChecklistTasksDoneContextcontexts/index.d.ts:7663
chosen_inline_resulttypeof ChosenInlineResultContextcontexts/index.d.ts:7624
community_chat_addedtypeof CommunityChatAddedContextcontexts/index.d.ts:7633
community_chat_joinedtypeof CommunityChatJoinedContextcontexts/index.d.ts:7634
community_chat_removedtypeof CommunityChatRemovedContextcontexts/index.d.ts:7635
delete_chat_phototypeof DeleteChatPhotoContextcontexts/index.d.ts:7625
deleted_business_messagestypeof BusinessMessagesDeletedContextcontexts/index.d.ts:7645
direct_message_price_changedtypeof DirectMessagePriceChangedContextcontexts/index.d.ts:7665
edited_business_messagetypeof MessageContextcontexts/index.d.ts:7643
edited_channel_posttypeof MessageContextcontexts/index.d.ts:7641
edited_messagetypeof MessageContextcontexts/index.d.ts:7640
forum_topic_closedtypeof ForumTopicClosedContextcontexts/index.d.ts:7673
forum_topic_createdtypeof ForumTopicCreatedContextcontexts/index.d.ts:7671
forum_topic_editedtypeof ForumTopicEditedContextcontexts/index.d.ts:7672
forum_topic_reopenedtypeof ForumTopicReopenedContextcontexts/index.d.ts:7674
general_forum_topic_hiddentypeof GeneralForumTopicHiddenContextcontexts/index.d.ts:7675
general_forum_topic_unhiddentypeof GeneralForumTopicUnhiddenContextcontexts/index.d.ts:7676
gifttypeof GiftContextcontexts/index.d.ts:7683
gift_upgrade_senttypeof GiftUpgradeSentContextcontexts/index.d.ts:7684
giveaway_completedtypeof GiveawayCompletedContextcontexts/index.d.ts:7701
giveaway_createdtypeof GiveawayCreatedContextcontexts/index.d.ts:7700
giveaway_winnerstypeof GiveawayWinnersContextcontexts/index.d.ts:7702
group_chat_createdtypeof GroupChatCreatedContextcontexts/index.d.ts:7626
guest_messagetypeof MessageContextcontexts/index.d.ts:7644
inline_querytypeof InlineQueryContextcontexts/index.d.ts:7627
invoicetypeof InvoiceContextcontexts/index.d.ts:7628
left_chat_membertypeof LeftChatMemberContextcontexts/index.d.ts:7629
locationtypeof LocationContextcontexts/index.d.ts:7630
managed_bottypeof ManagedBotContextcontexts/index.d.ts:7631
managed_bot_createdtypeof ManagedBotCreatedContextcontexts/index.d.ts:7632
messagetypeof MessageContextcontexts/index.d.ts:7638
message_auto_delete_timer_changedtypeof MessageAutoDeleteTimerChangedContextcontexts/index.d.ts:7637
message_reactiontypeof MessageReactionContextcontexts/index.d.ts:7696
message_reaction_counttypeof MessageReactionCountContextcontexts/index.d.ts:7697
migrate_from_chat_idtypeof MigrateFromChatIdContextcontexts/index.d.ts:7647
migrate_to_chat_idtypeof MigrateToChatIdContextcontexts/index.d.ts:7648
my_chat_membertypeof ChatMemberContextcontexts/index.d.ts:7623
new_chat_memberstypeof NewChatMembersContextcontexts/index.d.ts:7649
new_chat_phototypeof NewChatPhotoContextcontexts/index.d.ts:7650
new_chat_titletypeof NewChatTitleContextcontexts/index.d.ts:7651
paid_message_price_changedtypeof PaidMessagePriceChangedContextcontexts/index.d.ts:7688
passport_datatypeof PassportDataContextcontexts/index.d.ts:7652
pinned_messagetypeof PinnedMessageContextcontexts/index.d.ts:7653
polltypeof PollContextcontexts/index.d.ts:7657
poll_answertypeof PollAnswerContextcontexts/index.d.ts:7654
poll_option_addedtypeof PollOptionAddedContextcontexts/index.d.ts:7655
poll_option_deletedtypeof PollOptionDeletedContextcontexts/index.d.ts:7656
pre_checkout_querytypeof PreCheckoutQueryContextcontexts/index.d.ts:7658
proximity_alert_triggeredtypeof ProximityAlertTriggeredContextcontexts/index.d.ts:7659
purchased_paid_mediatypeof PaidMediaPurchasedContextcontexts/index.d.ts:7695
refunded_paymenttypeof RefundedPaymentContextcontexts/index.d.ts:7680
removed_chat_boosttypeof RemovedChatBoostContextcontexts/index.d.ts:7699
service_messagetypeof MessageContextcontexts/index.d.ts:7694
shipping_querytypeof ShippingQueryContextcontexts/index.d.ts:7677
stopped_message_generationtypeof MessageGenerationStoppedContextcontexts/index.d.ts:7636
subscriptiontypeof SubscriptionContextcontexts/index.d.ts:7678
successful_paymenttypeof SuccessfulPaymentContextcontexts/index.d.ts:7679
suggested_post_approval_failedtypeof SuggestedPostApprovalFailedContextcontexts/index.d.ts:7667
suggested_post_approvedtypeof SuggestedPostApprovedContextcontexts/index.d.ts:7666
suggested_post_declinedtypeof SuggestedPostDeclinedContextcontexts/index.d.ts:7668
suggested_post_paidtypeof SuggestedPostPaidContextcontexts/index.d.ts:7669
suggested_post_refundedtypeof SuggestedPostRefundedContextcontexts/index.d.ts:7670
unique_gifttypeof UniqueGiftContextcontexts/index.d.ts:7685
users_sharedtypeof UsersSharedContextcontexts/index.d.ts:7681
video_chat_endedtypeof VideoChatEndedContextcontexts/index.d.ts:7689
video_chat_participants_invitedtypeof VideoChatParticipantsInvitedContextcontexts/index.d.ts:7690
video_chat_scheduledtypeof VideoChatScheduledContextcontexts/index.d.ts:7691
video_chat_startedtypeof VideoChatStartedContextcontexts/index.d.ts:7692
web_app_datatypeof WebAppDataContextcontexts/index.d.ts:7693
write_access_allowedtypeof WriteAccessAllowedContextcontexts/index.d.ts:7660

Example

typescript
contextMappings["message"] is MessageContext

EVENTS

const EVENTS: [keyof Message, MessageEventName][]

Defined in: contexts/index.d.ts:59

Array of EVENTS


filterPayload

const filterPayload: (payload) => Record<string, unknown>

Defined in: contexts/index.d.ts:53

Helper for filter objects

Parameters

ParameterType
payloadRecord<string, any>

Returns

Record<string, unknown>


isParsable

const isParsable: (source) => boolean

Defined in: contexts/index.d.ts:55

Guard to check is string can be parsed via JSON.parse

Parameters

ParameterType
sourcestring

Returns

boolean


isPlainObject

const isPlainObject: (object) => object is Record<string, any>

Defined in: contexts/index.d.ts:51

Guard to check is it play object

Parameters

ParameterType
objectobject

Returns

object is Record<string, any>


paidMediaMap

const paidMediaMap: object

Defined in: contexts/index.d.ts:4851

This object describes paid media. Currently, it can be one of

Documentation

Type Declaration

NameTypeDefined in
live_phototypeof PaidMediaLivePhotocontexts/index.d.ts:4852
phototypeof PaidMediaPhotocontexts/index.d.ts:4855
previewtypeof PaidMediaPreviewcontexts/index.d.ts:4853
videotypeof PaidMediaVideocontexts/index.d.ts:4854

SERVICE_MESSAGE_EVENTS

const SERVICE_MESSAGE_EVENTS: MessageEventName[]

Defined in: contexts/index.d.ts:57

Array of SERVICE_MESSAGE_EVENTS

Functions

isRichString()

isRichString(value): value is RichStringLike

Defined in: contexts/index.d.ts:45

Detect a @gramio/format rich value without importing @gramio/format — by its global brand symbol. Lets ctx.send/reply/editText route a rich message to sendRichMessage while keeping @gramio/contexts free of a @gramio/format dependency.

Parameters

ParameterType
valueunknown

Returns

value is RichStringLike


memoizeGetters()

memoizeGetters<T>(cls, fields): void

Defined in: contexts/index.d.ts:47

Helper for getters memoization

Type Parameters

Type Parameter
T

Parameters

ParameterType
cls(...args) => T
fieldskeyof T[]

Returns

void


sleep()

sleep(ms): Promise<unknown>

Defined in: contexts/index.d.ts:5866

Parameters

ParameterType
msnumber

Returns

Promise<unknown>