Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/grammy_menu/deps.deno.ts

Interactive menus for grammY
Go to Latest
import * as grammyMenu from "https://deno.land/x/grammy_menu@v1.2.1/deps.deno.ts";

Namespaces

Internal namespace used to make some message types more accurate

Classes

This class provides access to the full Telegram Bot API. All methods of the API have an equivalent on this class, with the most important parameters pulled up into the function signature, and the other parameters captured by an object.

This is the single most important class of grammY. It represents your bot.

This error is thrown when middleware throws. It simply wraps the original error (accessible via the error property), but also provides access to the respective context object that was processed while the error occurred.

The composer is the heart of the middleware system in grammY. It is also the superclass of Bot. Whenever you call use or on or some of the other methods on your bot, you are in fact using the underlying composer instance to register your middleware.

When your bot receives a message, Telegram sends an update object to your bot. The update contains information about the chat, the user, and of course the message itself. There are numerous other updates, too: https://core.telegram.org/bots/api#update

This class represents errors that are thrown by grammY because the Telegram Bot API responded with an error.

This class represents errors that are thrown by grammY because an HTTP call to the Telegram Bot API failed.

Use this class to simplify building an inline keyboard (something like this: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating).

An InputFile wraps a number of different sources for sending files.

Use this class to simplify building a custom keyboard (something like this: https://core.telegram.org/bots#keyboards).

The memory session storage is a built-in storage adapter that saves your session data in RAM using a regular JavaScript Map object. If you use this storage adapter, all sessions will be lost when your process terminates or restarts. Hence, you should only use it for short-lived data that is not important to persist.

Functions

You can use this function to transform an existing storage adapter, and add more features to it. Currently, you can add session migrations and expiry dates.

This is an advanced function of grammY.

This is an advanced function of grammY.

Session middleware provides a persistent data storage for your bot. You can use it to let your bot remember any data you want, for example the messages it sent or received in the past. This is done by attaching session data to every chat. The stored data is then provided on the context object under ctx.session.

Creates a callback function that you can pass to a web framework (such as express) if you want to run your bot via webhooks. Use it like this:

Interfaces

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

Options to pass to the API client that eventually connects to the Telegram Bot API server and makes the HTTP requests.

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

This object represents a bot command.

Represents the scope of bot commands, covering all group and supergroup chat administrators.

Represents the scope of bot commands, covering all group and supergroup chats.

Represents the scope of bot commands, covering all private chats.

Represents the scope of bot commands, covering a specific chat.

Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.

Represents the scope of bot commands, covering a specific member of a group or supergroup chat.

Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.

Options to pass to the bot when creating it.

This object represents the bot's description.

This object represents the bot's name.

This object represents the bot's short description.

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

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.

Internal type representing channel chats.

Internal type representing channel chats returned from getChat.

Internal type representing group chats.

Internal type representing group chats returned from getChat.

Internal type representing private chats.

Internal type representing private chats returned from getChat.

Internal type representing super group chats.

Internal type representing supergroup chats returned from getChat.

Represents the rights of an administrator in a chat.

Represents an invite link for a chat.

Represents a join request sent to a chat.

Represents a location to which a chat is connected.

Represents a chat member that has some additional privileges.

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

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

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

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

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

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

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

This object represents a chat photo.

This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button.

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

This object represents a phone contact.

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

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

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

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

When enhancing a storage adapter, it needs to be able to store additional information. It does this by wrapping the actual data inside an object, and adding more properties to this wrapper.

This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot/<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.

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.

This object represents a forum topic.

This object represents a service message about a forum topic closed in the chat. Currently holds no information.

This object represents a service message about a new forum topic created in the chat.

This object represents a service message about an edited forum topic.

This object represents a service message about a forum topic reopened in the chat. Currently holds no information.

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

This object represents one row of the high scores table for a game.

This object represents a service message about General forum topic hidden in the chat. Currently holds no information.

This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.

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

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

Represents a link to an article or web page.

Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.

Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.

Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.

Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.

Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.

Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.

Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.

Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.

Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.

Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.

Represents a Game.

Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

Represents 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.

Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.

This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.

Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.

Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.

Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.

Represents the content of a contact message to be sent as the result of an inline query.

Represents the content of an invoice message to be sent as the result of an inline query.

Represents the content of a location message to be sent as the result of an inline query.

Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

Represents an audio file to be treated as music to be sent.

Represents a general file to be sent.

Represents a photo to be sent.

Represents a video to be sent.

This object describes a sticker to be added to a sticker set.

Represents the content of a text message to be sent as the result of an inline query.

Represents the content of a venue message to be sent as the result of an inline query.

This object contains basic information about an invoice.

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

This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed.

This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed.

This object represents a portion of the price for goods or services.

A lazy session flavor is a context flavor that holds a promise of some session data under ctx.session.

This object represents a point on the map.

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.

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

Represents a menu button, which opens the bot's list of commands.

Describes that no specific value for the menu button was set.

Represents a menu button, which launches a Web App.

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

This object represents a unique message identifier.

Middleware in the form of a container for a function.

Options for enhanced sessions

A mapping from version numbers to session migration functions. Each entry in this object has a version number as a key, and a function as a value.

This object represents information about an order.

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

Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.

Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.

Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.

Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.

Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.

Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.

Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.

Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.

Represents an issue in an unspecified place. The error is considered resolved when new data is added.

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.

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

This object contains information about a poll.

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

Options that can be specified when running the bot via simple long polling.

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

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

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

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

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).

Describes why a request was unsuccessful.

Describes an inline message sent by a Web App on behalf of a user.

A session flavor is a context flavor that holds session data under ctx.session.

Options for session middleware.

This object represents a shipping address.

This object represents one shipping option.

This object contains information about an incoming shipping query.

This object represents a sticker.

This object represents a sticker set.

A storage adapter is an abstraction that provides read, write, and delete access to a storage solution of any kind. Storage adapters are used to keep session middleware independent of your database provider, and they allow you to pass your own storage solution.

This object contains basic information about a successful payment.

This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.

A transformable API enhances the RawApi type by transformers.

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

Internal type holding properties that message updates in channels share.

Internal type holding properties that updates about edited messages share.

Internal type holding properties that message updates outside of channels share.

This object represents a Telegram user or bot.

This object represents a Telegram user or bot that was returned by getMe.

This object represent a user's profile pictures.

This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button.

This object represents a venue.

This object represents a video file.

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

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

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

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

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

This object represents a voice note.

Describes data sent from a Web App to the bot.

Describes a Web App.

Describes the current status of a webhook.

Small utility interface that abstracts from webhook reply calls of different web frameworks.

This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link.

Type Aliases

Type of a function that can perform an API call. Used for Transformers.

Wrapper type to bundle all methods of the Telegram Bot API

The response contains an object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals true, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals false and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error.

This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:

  • BotCommandScopeDefault
  • BotCommandScopeAllPrivateChats
  • BotCommandScopeAllGroupChats
  • BotCommandScopeAllChatAdministrators
  • BotCommandScopeChat
  • BotCommandScopeChatAdministrators
  • BotCommandScopeChatMember

Type of the context object that is available inside the handlers for bot.callbackQuery.

Type of the middleware that can be passed to bot.callbackQuery.

This object represents a chat.

This object represents a Telegram user or bot that was returned by getChat.

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

Type of the context object that is available inside the handlers for bot.chatType.

Type of the middleware that can be passed to bot.chatType.

Type of the context object that is available inside the handlers for bot.command.

Type of the middleware that can be passed to bot.command.

Error handler that can be installed on a bot to catch error thrown by middleware.

This type infers which properties will be present on the given context object provided it matches the given filter query. If the filter query is a union type, the produced context object will be a union of possible combinations, hence allowing you to narrow down manually which of the properties are present.

Represents a filter query that can be passed to bot.on. There are three different kinds of filter queries: Level 1, Level 2, and Level 3. Check out the website to read about how filter queries work in grammY, and how to use them.

Type of the context object that is available inside the handlers for bot.gameQuery.

Type of the middleware that can be passed to bot.gameQuery.

Type of the context object that is available inside the handlers for bot.hears.

Type of the middleware that can be passed to bot.hears.

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

Type of the context object that is available inside the handlers for bot.inlineQuery.

Type of the middleware that can be passed to bot.inlineQuery.

This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:

  • InlineQueryResultCachedAudio
  • InlineQueryResultCachedDocument
  • InlineQueryResultCachedGif
  • InlineQueryResultCachedMpeg4Gif
  • InlineQueryResultCachedPhoto
  • InlineQueryResultCachedSticker
  • InlineQueryResultCachedVideo
  • InlineQueryResultCachedVoice
  • InlineQueryResultArticle
  • InlineQueryResultAudio
  • InlineQueryResultContact
  • InlineQueryResultGame
  • InlineQueryResultDocument
  • InlineQueryResultGif
  • InlineQueryResultLocation
  • InlineQueryResultMpeg4Gif
  • InlineQueryResultPhoto
  • InlineQueryResultVenue
  • InlineQueryResultVideo
  • InlineQueryResultVoice

This object represents the content of a media message to be sent. It should be one of

  • InputMediaAnimation
  • InputMediaDocument
  • InputMediaAudio
  • InputMediaPhoto
  • InputMediaVideo

Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

Represents an audio file to be treated as music to be sent.

Represents a general file to be sent.

Represents a photo to be sent.

Represents a video to be sent.

This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:

This object describes a sticker to be added to a sticker set.

This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_user, request_chat, request_contact, request_location, and request_poll are mutually exclusive.

This object describes the bot's menu button in a private chat. It should be one of

  • MenuButtonCommands
  • MenuButtonWebApp
  • MenuButtonDefault

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

Middleware for grammY, either as a function or as a container for a function.

Middleware in the form of a function.

Options for session middleware if multi sessions are used. Specify "type": "multi" in the options to use multi sessions.

A function of this type is passed as the second parameter to all middleware. Invoke it to call the downstream middleware and pass on the control flow.

Utility type providing the argument type for the given method name or {} if the method does not take any parameters

The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, and spoiler text, as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.

This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:

  • PassportElementErrorDataField
  • PassportElementErrorFrontSide
  • PassportElementErrorReverseSide
  • PassportElementErrorSelfie
  • PassportElementErrorFile
  • PassportElementErrorFiles
  • PassportElementErrorTranslationFile
  • PassportElementErrorTranslationFiles
  • PassportElementErrorUnspecified

Represents the raw Telegram Bot API with all methods specified 1:1 as documented on the website (https://core.telegram.org/bots/api).

API call transformers are functions that can access and modify the method and payload of an API call on the fly. This can be useful if you want to implement rate limiting or other things against the Telegram Bot API.