import * as grammy from "https://deno.land/x/grammy@v1.32.0/mod.ts";
Classes
c Api | 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. |
c Bot | 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 | |
The composer is the heart of the middleware system in grammY. It is also the
superclass of | |
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/features#inline-keyboards). | |
An | |
Use this class to simplify building a custom keyboard (something like this: https://core.telegram.org/bots/features#keyboards). | |
The memory session storage is a built-in storage adapter that saves your
session data in RAM using a regular JavaScript |
Variables
A container for constants used in the Telegram Bot API. Currently holds all available update types as well as all chat permissions. | |
Holds a number of helper methods for building | |
Holds a number of helper methods for building |
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. | |
| |
| |
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
| |
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
Options to pass to the API client that eventually connects to the Telegram Bot API server and makes the HTTP requests. | |
Types of the constants used in the Telegram Bot API. Currently holds all available update types as well as all chat permissions. | |
Options to pass to the bot when creating it. | |
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. | |
A lazy session flavor is a context flavor that holds a promise of some
session data under | |
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. | |
Options that can be specified when running the bot via simple long polling. | |
A session flavor is a context flavor that holds session data under
| |
Options for session middleware. | |
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. | |
A transformable API enhances the | |
Small utility interface that abstracts from webhook reply calls of different web frameworks. |
Type Aliases
Type of a function that can perform an API call. Used for Transformers. | |
Type of the context object that is available inside the handlers for
| |
Type of the middleware that can be passed to | |
Type of the context object that is available inside the handlers for
| |
Type of the middleware that can be passed to | |
Type of the context object that is available inside the handlers for
| |
Type of the middleware that can be passed to | |
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 | |
Type of the context object that is available inside the handlers for
| |
Type of the middleware that can be passed to | |
Type of the context object that is available inside the handlers for
| |
Type of the middleware that can be passed to | |
Type of the context object that is available inside the handlers for
| |
Type of the middleware that can be passed to | |
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 | |
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. | |
Represents the raw Telegram Bot API with all methods specified 1:1 as documented on the website (https://core.telegram.org/bots/api). | |
Type of the context object that is available inside the handlers for
| |
Type of the middleware that can be passed to | |
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. |