--- url: 'https://gramio.dev/api/auto-retry.md' --- [GramIO API Reference](../../../index.md) / @gramio/auto-retry/dist # @gramio/auto-retry/dist ## Functions ### autoRetry() > **autoRetry**(): [`Plugin`](../../../gramio/classes/Plugin.md) Defined in: auto-retry/index.d.ts:27 A plugin that catches errors with the `retry_after` field (**rate limit** errors), **waits** for the specified time and **repeats** the API request. #### Returns [`Plugin`](../../../gramio/classes/Plugin.md) #### Example ```ts import { Bot } from "gramio"; import { autoRetry } from "@gramio/auto-retry"; const bot = new Bot(process.env.TOKEN!) .extend(autoRetry()) .command("start", async (context) => { for (let index = 0; index < 100; index++) { await context.reply(`some ${index}`); } }) .onStart(console.log); bot.start(); ``` --- --- url: 'https://gramio.dev/api/autoload.md' --- [GramIO API Reference](../../../index.md) / @gramio/autoload/dist # @gramio/autoload/dist ## Interfaces | Interface | Description | | ------ | ------ | | [AutoloadOptions](interfaces/AutoloadOptions.md) | Options for [autoload](#autoload) plugin with options for Options | fdir and PicomatchOptions | picomatch | | [AutoloadOptionsPathParams](interfaces/AutoloadOptionsPathParams.md) | Params that used in [onLoad](interfaces/AutoloadOptions.md#onload) and [onFinish](interfaces/AutoloadOptions.md#onfinish) hooks | ## Functions ### autoload() > **autoload**(`options?`): `Promise`<[`Plugin`](../../../gramio/classes/Plugin.md)<{ }, [`DeriveDefinitions`](../../../gramio/type-aliases/DeriveDefinitions.md), { }>> Defined in: autoload/index.d.ts:81 Autoload commands plugin for GramIO. #### Parameters | Parameter | Type | | ------ | ------ | | `options?` | [`AutoloadOptions`](interfaces/AutoloadOptions.md) | #### Returns `Promise`<[`Plugin`](../../../gramio/classes/Plugin.md)<{ }, [`DeriveDefinitions`](../../../gramio/type-aliases/DeriveDefinitions.md), { }>> #### Example ## Register the plugin ```ts // index.ts import { Bot } from "gramio"; import { autoload } from "@gramio/autoload"; const bot = new Bot(process.env.TOKEN as string) .extend(autoload()) .onStart(console.log); bot.start(); export type BotType = typeof bot; ``` ## Create command ```ts // commands/command.ts import type { BotType } from ".."; export default (bot: BotType) => bot.command("start", (context) => context.send("hello!")); ``` --- --- url: 'https://gramio.dev/api/callback-data.md' --- [GramIO API Reference](../../../index.md) / @gramio/callback-data/dist # @gramio/callback-data/dist ## Classes | Class | Description | | ------ | ------ | | [CallbackData](classes/CallbackData.md) | Class-helper that construct schema and serialize/deserialize with [CallbackData.pack](classes/CallbackData.md#pack) and [CallbackData.unpack](classes/CallbackData.md#unpack) methods | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [InferDataPack](type-aliases/InferDataPack.md) | - | | [InferDataUnpack](type-aliases/InferDataUnpack.md) | - | | [SafeUnpackResult](type-aliases/SafeUnpackResult.md) | - | --- --- url: 'https://gramio.dev/extend/composer.md' --- # @gramio/composer [![npm](https://img.shields.io/npm/v/@gramio/composer?logo=npm\&style=flat\&labelColor=000\&color=3b82f6)](https://www.npmjs.org/package/@gramio/composer) [![JSR](https://jsr.io/badges/@gramio/composer)](https://jsr.io/@gramio/composer) `@gramio/composer` is the general-purpose, type-safe middleware composition library that powers GramIO's internals. If you're writing a plugin, building a framework on top of GramIO, or just want to understand how context enrichment works — this is the place to start. ## Installation ::: pm-add @gramio/composer ::: ## Core Concepts A `Composer` is a chainable middleware pipeline. Each method registers a new middleware step and returns the (updated) composer for chaining: ```ts import { Composer } from "@gramio/composer"; const app = new Composer<{ request: Request }>() .use(logger) .derive(fetchUser) .guard(isAuthenticated) .use(handler); ``` ### use() Register raw middleware. The handler receives `(context, next)` and must call `next()` to continue the chain: ```ts app.use(async (ctx, next) => { console.log("before"); await next(); console.log("after"); }); ``` ### derive() Enriches context with computed values. The returned object is merged into the context for all downstream middleware: ```ts app.derive(async (ctx) => { const user = await db.findUser(ctx.userId); return { user }; }); // ctx.user is now available downstream ``` ### decorate() Like `derive()`, but for static values that don't need per-request computation. Assigns the object once at registration time and reuses the same reference — zero function call overhead: ```ts app.decorate({ db: myDatabase, config: appConfig }); // ctx.db and ctx.config available on every request, no overhead ``` Supports scoping with `{ as: "scoped" }` or `{ as: "global" }` to propagate through `extend()`. ### guard() Only continues the chain if the predicate returns true: ```ts app.guard((ctx) => ctx.user.isAdmin); // Subsequent middleware only runs for admins ``` ### when() Build-time conditional middleware registration. The condition is evaluated once at startup, not per-request. Properties added inside the block are typed as `Partial` (optional): ```ts const app = new Composer() .when(process.env.NODE_ENV !== "production", (c) => c.use(verboseLogger) ) .when(config.features.analytics, (c) => c.derive(() => ({ analytics: createAnalyticsClient() })) ); ``` Differences from `branch()`: * `when()` — condition evaluated **once at startup** (build-time) * `branch()` — condition evaluated **on every request** (runtime) Nested `when()` blocks work. Dedup keys, error handlers, and error definitions propagate from the conditional block. ## Observability ### inspect() Returns a read-only snapshot of all registered middleware with metadata: ```ts const app = new Composer() .derive(function getUser() { return { user: "alice" }; }) .guard(function isAdmin() { return true; }) .use(async function handleRequest(_, next) { return next(); }); app.inspect(); // [ // { index: 0, type: "derive", name: "getUser", scope: "local" }, // { index: 1, type: "guard", name: "isAdmin", scope: "local" }, // { index: 2, type: "use", name: "handleRequest", scope: "local" }, // ] ``` When a named plugin is extended, the `plugin` field shows the source: ```ts const auth = new Composer({ name: "auth" }) .derive(function getUser() { return { user: "alice" }; }) .as("scoped"); new Composer().extend(auth).inspect(); // [{ index: 0, type: "derive", name: "getUser", scope: "local", plugin: "auth" }] ``` ### trace() Opt-in per-middleware instrumentation hook. Zero overhead when not used — middleware functions are passed through unwrapped when no tracer is set: ```ts app.trace((entry, ctx) => { const span = tracer.startSpan(`${entry.type}:${entry.name ?? "anonymous"}`); span.setAttributes({ "middleware.index": entry.index, "middleware.scope": entry.scope, ...(entry.plugin && { "middleware.plugin": entry.plugin }), }); return (error) => { if (error) span.recordException(error as Error); span.end(); }; }); ``` The `TraceHandler` callback: 1. Is called before each middleware executes with `MiddlewareInfo` and context 2. May return a cleanup function `(error?: unknown) => void` 3. Cleanup is called after middleware completes (with no args on success, with the error on failure) 4. Errors still propagate to `onError` after cleanup ## Scope System The scope system controls how middleware propagates when one composer extends another: | Scope | Behavior | |-------|---------| | `"local"` (default) | Isolated inside an isolation wrapper — context does not leak to parent | | `"scoped"` | Adds directly to parent as a local entry — visible to parent's downstream middleware | | `"global"` | Adds to parent as global — continues propagating through further `extend()` calls | Promote a whole composer to a scope with `.as()`: ```ts const plugin = new Composer({ name: "auth" }) .derive(function getUser() { return { user: "alice" }; }) .as("scoped"); // everything in this composer is scoped app.extend(plugin); // getUser is now visible in app's downstream ``` ## Error Handling ```ts class NotFoundError extends Error {} const app = new Composer() .error("NotFound", NotFoundError) .onError(({ error, kind, context }) => { if (kind === "NotFound") { context.send("Resource not found"); return "handled"; } }) .use(() => { throw new NotFoundError("Item missing"); }); ``` Multiple `onError()` handlers are evaluated in order — the first to return a non-undefined value wins. Errors without a matching handler are logged via `console.error`. ## Plugin Development For plugin authors, `@gramio/composer` is the foundation of GramIO's `Plugin` class. The concepts map directly: ```ts import { Plugin } from "gramio"; // Plugin uses the same Composer API internally const myPlugin = new Plugin("my-plugin") .decorate({ db: myDatabase }) // static enrichment .derive(async () => ({ user: ... })) // per-request enrichment .on("message", handler); // event handler ``` For advanced plugin creation that needs custom shorthand methods or observability, work directly with `@gramio/composer`. ## createComposer() — Building Custom Frameworks If you're building a framework on top of `@gramio/composer` and need custom shorthand methods (like GramIO's own `hears()`, `command()`, `reaction()`), use `createComposer()`: ```ts import { createComposer, eventTypes } from "@gramio/composer"; const { Composer } = createComposer({ discriminator: (ctx: BaseCtx) => ctx.updateType, types: eventTypes<{ message: MessageCtx; callback_query: CallbackCtx }>(), methods: { hears(trigger: RegExp | string, handler: (ctx: MessageCtx) => unknown) { return this.on("message", (ctx, next) => { const text = ctx.text; if (typeof trigger === "string" ? text === trigger : trigger.test(text ?? "")) return handler(ctx); return next(); }); }, command(cmd: string, handler: (ctx: MessageCtx) => unknown) { return this.on("message", (ctx, next) => { if (ctx.text?.startsWith(`/${cmd}`)) return handler(ctx); return next(); }); }, }, }); // Custom methods survive through all chain operations: const app = new Composer() .hears(/hello/, h1) // custom method .on("message", h2) // built-in — TMethods still preserved .hears(/bye/, h3); // custom method still available ``` **`types` + `eventTypes()`**: TypeScript cannot partially infer type arguments. The `types` phantom field with `eventTypes()` helper lets you specify `TEventMap` without losing `TMethods` inference: ```ts // Instead of explicit type parameters (can't infer TMethods): createComposer({ ... }) // Use the phantom types pattern: createComposer({ discriminator: (ctx: BaseCtx) => ctx.updateType, types: eventTypes<{ message: MessageCtx }>(), // inferred, not explicit methods: { /* TMethods inferred from here */ }, }) ``` A runtime conflict check throws if a `methods` key collides with a built-in method name. ### `defineComposerMethods()` — generic custom methods with derives When custom methods have **generic signatures** that need to capture accumulated derives, use `defineComposerMethods()` first. TypeScript cannot infer generic method signatures when `TMethods` is nested inside the return type of `createComposer`, so the helper is required: ```ts import { defineComposerMethods, createComposer } from "@gramio/composer"; import type { ComposerLike, ContextOf, Middleware } from "@gramio/composer"; const methods = defineComposerMethods({ command>( this: TThis, name: string, handler: Middleware>, ): TThis { return this.on("message", (ctx, next) => { if (ctx.text === `/${name}`) return handler(ctx, next); return next(); }); }, }); const { Composer } = createComposer({ discriminator: (ctx) => ctx.updateType, methods, }); // Derives flow into the handler automatically — zero annotation: new Composer() .derive(() => ({ user: { id: 1, name: "Alice" } })) .command("start", (ctx) => { ctx.user.id; // ✅ typed — inferred via ContextOf ctx.text; // ✅ from MessageCtx }); ``` ## `ContextOf` — extract the current context type Extracts `TOut` (the fully accumulated context after all `derive()`/`decorate()` calls) from a Composer or EventComposer instance type. Most useful in `defineComposerMethods()` custom method signatures so that derives flow in automatically: ```ts import type { ContextOf } from "@gramio/composer"; type Ctx = ContextOf; // Ctx = accumulated context including all derive() results ``` ## `EventContextOf` — per-event context type Extracts the context for a **specific event** from a composer instance, including both global and per-event derives: ```ts import type { EventContextOf } from "@gramio/composer"; // Per-event derive: only visible in 'message' handlers composer.derive(['message'], () => ({ messageData: "..." })); type MessageCtx = EventContextOf; // Includes both global derives AND messageData ``` ## `ComposerLike` — minimal structural type for `this` constraints A minimal interface `{ on(event: any, handler: any): T }` used as an F-bounded constraint on `TThis` in custom methods. Makes `this.on(...)` fully typed and return `TThis` without casts. ## Macro System Register reusable behaviors that handlers activate declaratively via an options object. Useful for cross-cutting concerns like authentication, rate limiting, validation — without polluting handler bodies with boilerplate checks: ```ts // Register a macro const app = new Composer().macro("adminOnly", { preHandler: async (ctx, next) => { if (ctx.userId !== ADMIN_ID) return ctx.reply("Admins only"); return next(); }, }); // Activate per handler via options: app.on("message", handler, { adminOnly: true }); app.on("callback_query", handler, { adminOnly: true }); ``` `macro()` accepts either: * **Plain `MacroHooks` object** — for boolean shorthand (`{ adminOnly: true }`) * **`(opts) => MacroHooks` function** — for parameterized options (`{ throttle: { limit: 3 } }`) `MacroHooks` has: * `preHandler` — middleware that runs before the handler * `derive` — context enrichment function; returning `void` stops the chain --- --- url: 'https://gramio.dev/api/composer.md' --- [GramIO API Reference](../../../index.md) / @gramio/composer/dist # @gramio/composer/dist ## Classes | Class | Description | | ------ | ------ | | [Composer](classes/Composer.md) | - | | [EventQueue](classes/EventQueue.md) | Concurrent event queue with graceful shutdown support. Processes events in parallel (like an event loop), not sequentially. | ## Interfaces | Interface | Description | | ------ | ------ | | [ComposerOptions](interfaces/ComposerOptions.md) | Composer constructor options | | [ContextCallback](interfaces/ContextCallback.md) | Marker type for context-aware callbacks in macro options. The framework replaces this with the actual handler context type at the call site. | | [EventComposer](interfaces/EventComposer.md) | EventComposer interface — Composer + .on() + per-event derive tracking + custom methods | | [EventComposerConstructor](interfaces/EventComposerConstructor.md) | - | | [MacroHooks](interfaces/MacroHooks.md) | What a macro can return when activated | | [MiddlewareInfo](interfaces/MiddlewareInfo.md) | Read-only projection of a middleware entry for inspect()/trace() | | [RouteBuilder](interfaces/RouteBuilder.md) | Route builder passed to the builder-callback overload of route() | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [CompatibleEvents](type-aliases/CompatibleEvents.md) | Given an event map and a Narrowing type, yields the union of event names whose context type contains all keys from Narrowing. | | [ComposedMiddleware](type-aliases/ComposedMiddleware.md) | Composed middleware: next is optional (acts as terminal continuation) | | [ComposerLike](type-aliases/ComposerLike.md) | Minimal structural type for constraining `this` in custom composer methods. | | [ContextOf](type-aliases/ContextOf.md) | Extracts the current accumulated context type (`TOut`) from an EventComposer or Composer instance type. | | [DeriveFromOptions](type-aliases/DeriveFromOptions.md) | Collects all derive types from macros that are activated in `TOptions`. The result is intersected into the handler's context type. | | [DeriveHandler](type-aliases/DeriveHandler.md) | Function that computes additional context properties | | [ErrorHandler](type-aliases/ErrorHandler.md) | Error handler receives an object with error, context, and resolved kind | | [EventContextOf](type-aliases/EventContextOf.md) | Extracts the context type for a specific event from an EventComposer instance, combining global `TOut` (like `ContextOf`) **and** per-event `TDerives[E]`. | | [HandlerOptions](type-aliases/HandlerOptions.md) | Builds the `options` parameter type for handler methods. Includes `preHandler` plus all registered macro option types with ContextCallback markers replaced by `TBaseCtx`. | | [LazyFactory](type-aliases/LazyFactory.md) | Lazy middleware factory — called per invocation | | [MacroDef](type-aliases/MacroDef.md) | A macro definition: either a function accepting options, or a plain hooks object (boolean shorthand). | | [MacroDefinitions](type-aliases/MacroDefinitions.md) | Registry of named macro definitions | | [MacroDeriveType](type-aliases/MacroDeriveType.md) | Extract the derive (context enrichment) type from a macro | | [MacroOptionType](type-aliases/MacroOptionType.md) | Extract the options type a macro accepts (boolean for shorthand macros) | | [MaybeArray](type-aliases/MaybeArray.md) | Single value or array | | [Middleware](type-aliases/Middleware.md) | Middleware function: receives context and next | | [MiddlewareType](type-aliases/MiddlewareType.md) | Which method created a middleware entry | | [Next](type-aliases/Next.md) | next() continuation function | | [RouteHandler](type-aliases/RouteHandler.md) | Route handler: single middleware, array, or Composer instance | | [Scope](type-aliases/Scope.md) | Scope level for middleware propagation | | [TraceHandler](type-aliases/TraceHandler.md) | Trace callback invoked on middleware enter; returns cleanup called on exit | | [WithCtx](type-aliases/WithCtx.md) | Recursively replaces all `ContextCallback` occurrences in `T` with `(ctx: TCtx) => unknown`. | ## Variables ### noopNext > `const` **noopNext**: [`Next`](type-aliases/Next.md) Defined in: composer/index.d.ts:496 No-op next function: () => Promise.resolve() *** ### skip > `const` **skip**: [`Middleware`](type-aliases/Middleware.md)<`any`> Defined in: composer/index.d.ts:498 Pass-through middleware: calls next() immediately *** ### stop > `const` **stop**: [`Middleware`](type-aliases/Middleware.md)<`any`> Defined in: composer/index.d.ts:500 Terminal middleware: does NOT call next() ## Functions ### buildFromOptions() > **buildFromOptions**<`TCtx`>(`macros`, `options`, `handler`): [`Middleware`](type-aliases/Middleware.md)<`TCtx`> Defined in: composer/index.d.ts:493 Composes a handler with macro hooks and preHandlers from an options object. Execution order: 1. `options.preHandler` array (explicit guards — user controls order) 2. Per-macro in options property order: a. macro.preHandler (guard middleware) b. macro.derive (context enrichment; void return = stop chain) 3. Main handler #### Type Parameters | Type Parameter | | ------ | | `TCtx` | #### Parameters | Parameter | Type | | ------ | ------ | | `macros` | `Record`<`string`, [`MacroDef`](type-aliases/MacroDef.md)<`any`, `any`>> | | `options` | `Record`<`string`, `unknown`> | | `handler` | [`Middleware`](type-aliases/Middleware.md)<`TCtx`> | #### Returns [`Middleware`](type-aliases/Middleware.md)<`TCtx`> *** ### compose() > **compose**<`T`>(`middlewares`): [`ComposedMiddleware`](type-aliases/ComposedMiddleware.md)<`T`> Defined in: composer/index.d.ts:132 Compose an array of middleware functions into a single middleware. Koa-style onion model: each middleware receives (context, next). #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `middlewares` | [`Middleware`](type-aliases/Middleware.md)<`T`>\[] | #### Returns [`ComposedMiddleware`](type-aliases/ComposedMiddleware.md)<`T`> *** ### createComposer() > **createComposer**<`TBase`, `TEventMap`, `TMethods`>(`config`): `object` Defined in: composer/index.d.ts:473 Creates a configured Composer class with type-safe .on() event discrimination. #### Type Parameters | Type Parameter | Default type | | ------ | ------ | | `TBase` *extends* `object` | - | | `TEventMap` *extends* `Record`<`string`, `TBase`> | `object` | | `TMethods` *extends* `Record`<`string`, (...`args`) => `any`> | `object` | #### Parameters | Parameter | Type | | ------ | ------ | | `config` | { `discriminator`: (`context`) => `string`; `methods?`: `TMethods` & `ThisType`<[`EventComposer`](interfaces/EventComposer.md)<`TBase`, `TEventMap`, `TBase`, `TBase`, { }, { }, `TMethods`, { }> & `TMethods`>; `types?`: `TEventMap`; } | | `config.discriminator` | (`context`) => `string` | | `config.methods?` | `TMethods` & `ThisType`<[`EventComposer`](interfaces/EventComposer.md)<`TBase`, `TEventMap`, `TBase`, `TBase`, { }, { }, `TMethods`, { }> & `TMethods`> | | `config.types?` | `TEventMap` | #### Returns | Name | Type | Defined in | | ------ | ------ | ------ | | `compose()` | <`T`>(`middlewares`) => [`ComposedMiddleware`](type-aliases/ComposedMiddleware.md)<`T`> | composer/index.d.ts:479 | | `Composer` | [`EventComposerConstructor`](interfaces/EventComposerConstructor.md)<`TBase`, `TEventMap`, `TMethods`> | composer/index.d.ts:478 | | `EventQueue` | *typeof* [`EventQueue`](classes/EventQueue.md) | composer/index.d.ts:480 | *** ### defineComposerMethods() > **defineComposerMethods**<`TMethods`>(`methods`): `TMethods` Defined in: composer/index.d.ts:454 Helper to define custom composer methods with full TypeScript inference. TypeScript cannot infer generic method signatures when they're passed directly inside `createComposer({ methods: { ... } })` because `TMethods` is buried inside the nested return type `{ Composer: EventComposerConstructor<..., TMethods> }`. This helper has return type `TMethods` directly — which lets TypeScript preserve generic method signatures. Pass the result (via `typeof`) as the 3rd type argument to `createComposer`: #### Type Parameters | Type Parameter | | ------ | | `TMethods` *extends* `Record`<`string`, (...`args`) => `any`> | #### Parameters | Parameter | Type | | ------ | ------ | | `methods` | `TMethods` | #### Returns `TMethods` #### Example ```ts const methods = defineComposerMethods({ // Pattern: `this: TThis` + `ContextOf` — zero annotation at call site command( this: TThis, name: string, handler: Middleware>, ): TThis { return (this as any).on("message", (ctx: any, next: any) => { if (ctx.text === `/${name}`) return handler(ctx, next); return next(); }) as TThis; }, }); const { Composer } = createComposer({ discriminator: (ctx) => ctx.updateType, methods, }); // No annotation needed — derives flow in automatically: new Composer() .derive(() => ({ user: { id: 1 } })) .command("start", (ctx) => ctx.user.id); // ✅ ``` *** ### eventTypes() > **eventTypes**<`TEventMap`>(): `TEventMap` Defined in: composer/index.d.ts:469 Phantom type carrier for event map inference. Returns `undefined` at runtime — exists purely for type-level inference so that `TEventMap` can be inferred from the `types` config field. #### Type Parameters | Type Parameter | | ------ | | `TEventMap` *extends* `Record`<`string`, `any`> | #### Returns `TEventMap` #### Example ```ts const { Composer } = createComposer({ discriminator: (ctx: BaseCtx) => ctx.updateType, types: eventTypes(), methods: { hears(trigger) { return this.on("message", ...); } }, }); ``` --- --- url: 'https://gramio.dev/api/contexts.md' --- [GramIO API Reference](../../../index.md) / @gramio/contexts/dist # @gramio/contexts/dist ## Enumerations | Enumeration | Description | | ------ | ------ | | [ChatType](enumerations/ChatType.md) | Enum of ChatType property | | [EntityType](enumerations/EntityType.md) | Enum of EntityType property | | [PollType](enumerations/PollType.md) | Enum of PollType property | ## Classes | Class | Description | | ------ | ------ | | [AcceptedGiftTypes](classes/AcceptedGiftTypes.md) | This object describes the types of gifts that can be gifted to a user or a chat. | | [AnimationAttachment](classes/AnimationAttachment.md) | This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). | | [Attachment](classes/Attachment.md) | Simple attachment | | [AudioAttachment](classes/AudioAttachment.md) | This object represents an audio file to be treated as music by the Telegram clients. | | [BackgroundFillFreeformGradient](classes/BackgroundFillFreeformGradient.md) | The background is a freeform gradient that rotates after every message in the chat. | | [BackgroundFillGradient](classes/BackgroundFillGradient.md) | The background is a gradient fill. | | [BackgroundFillSolid](classes/BackgroundFillSolid.md) | The background is filled using the selected color. | | [BackgroundTypeChatTheme](classes/BackgroundTypeChatTheme.md) | The background is taken directly from a built-in chat theme. | | [BackgroundTypeFill](classes/BackgroundTypeFill.md) | The background is automatically filled based on the selected colors. | | [BackgroundTypePattern](classes/BackgroundTypePattern.md) | The 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. | | [BackgroundTypeWallpaper](classes/BackgroundTypeWallpaper.md) | The background is a wallpaper in the JPEG format. | | [Birthdate](classes/Birthdate.md) | Describes the birthdate of a user. | | [BoostAddedContext](classes/BoostAddedContext.md) | This object represents a service message about a forum topic closed in the chat. Currently holds no information. | | [BotCommand](classes/BotCommand.md) | This object represents a bot command | | [BotDescription](classes/BotDescription.md) | This object represents the bot's description. | | [BotShortDescription](classes/BotShortDescription.md) | This object represents the bot's short description. | | [BusinessBotRights](classes/BusinessBotRights.md) | Represents the rights of a business bot. | | [BusinessConnection](classes/BusinessConnection.md) | Describes the connection of the bot with a business account. | | [BusinessConnectionContext](classes/BusinessConnectionContext.md) | This object Describes the connection of the bot with a business account. | | [BusinessIntro](classes/BusinessIntro.md) | Contains information about the start page settings of a Telegram Business account. | | [BusinessLocation](classes/BusinessLocation.md) | Contains information about the location of a Telegram Business account. | | [BusinessMessagesDeleted](classes/BusinessMessagesDeleted.md) | Describes the connection of the bot with a business account. | | [BusinessMessagesDeletedContext](classes/BusinessMessagesDeletedContext.md) | This object represents a boost added to a chat or changed. | | [BusinessOpeningHours](classes/BusinessOpeningHours.md) | [Documentation](https://core.telegram.org/bots/api/#businessopeninghours) | | [BusinessOpeningHoursInterval](classes/BusinessOpeningHoursInterval.md) | Describes an interval of time during which a business is open. | | [CallbackGame](classes/CallbackGame.md) | A placeholder, currently holds no information. | | [CallbackQuery](classes/CallbackQuery.md) | 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. | | [CallbackQueryContext](classes/CallbackQueryContext.md) | Called when `callback_query` event occurs | | [Chat](classes/Chat.md) | This object represents a chat. | | [ChatActionMixin](classes/ChatActionMixin.md) | Main base context | | [ChatAdministratorRights](classes/ChatAdministratorRights.md) | Represents the rights of an administrator in a chat. | | [ChatBackground](classes/ChatBackground.md) | This object represents a chat background. | | [ChatBackgroundSetContext](classes/ChatBackgroundSetContext.md) | This object represents a service message about chat background set. | | [ChatBoost](classes/ChatBoost.md) | This object contains information about a chat boost. | | [ChatBoostAdded](classes/ChatBoostAdded.md) | This object represents a service message about a user boosting a chat. | | [ChatBoostContext](classes/ChatBoostContext.md) | This object represents a boost added to a chat or changed. | | [ChatBoostRemoved](classes/ChatBoostRemoved.md) | This object represents a boost added to a chat or changed. | | [ChatBoostSourceGiftCode](classes/ChatBoostSourceGiftCode.md) | The 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. | | [ChatBoostSourceGiveaway](classes/ChatBoostSourceGiveaway.md) | The 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. | | [ChatBoostSourcePremium](classes/ChatBoostSourcePremium.md) | The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user. | | [ChatBoostUpdated](classes/ChatBoostUpdated.md) | This object represents a boost added to a chat or changed. | | [ChatControlMixin](classes/ChatControlMixin.md) | This object represents a mixin that is responsible for all the chat management methods | | [ChatFullInfo](classes/ChatFullInfo.md) | This object contains full information about a chat. | | [ChatInviteControlMixin](classes/ChatInviteControlMixin.md) | This object represents a mixin that works with all `*ChatInviteLink` methods | | [ChatInviteLink](classes/ChatInviteLink.md) | Represents an invite link for a chat. | | [ChatJoinRequest](classes/ChatJoinRequest.md) | Represents a join request sent to a chat. | | [ChatJoinRequestContext](classes/ChatJoinRequestContext.md) | Represents a join request sent to a chat. | | [ChatLocation](classes/ChatLocation.md) | Represents a location to which a chat is connected. | | [ChatMember](classes/ChatMember.md) | 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` | | [ChatMemberContext](classes/ChatMemberContext.md) | This object represents changes in the status of a chat member. | | [ChatMemberControlMixin](classes/ChatMemberControlMixin.md) | This object represents a mixin that is able to control member's rights | | [ChatMemberUpdated](classes/ChatMemberUpdated.md) | This object represents changes in the status of a chat member. | | [ChatOwnerChanged](classes/ChatOwnerChanged.md) | Describes a service message about an ownership change in the chat. | | [ChatOwnerChangedContext](classes/ChatOwnerChangedContext.md) | This object represents a service message about an ownership change in the chat. | | [ChatOwnerLeft](classes/ChatOwnerLeft.md) | Describes a service message about the chat owner leaving the chat. | | [ChatOwnerLeftContext](classes/ChatOwnerLeftContext.md) | This object represents a service message about the chat owner leaving the chat. | | [ChatPermissions](classes/ChatPermissions.md) | Describes actions that a non-administrator user is allowed to take in a chat. | | [ChatPhoto](classes/ChatPhoto.md) | This object represents a chat photo. | | [ChatSenderControlMixin](classes/ChatSenderControlMixin.md) | This object is a mixin that does all the chat-sender stuff, right? | | [ChatShared](classes/ChatShared.md) | This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button. | | [ChatSharedContext](classes/ChatSharedContext.md) | This object contains information about the chat whose identifier was shared with the bot using a `KeyboardButtonRequestChat` button. | | [Checklist](classes/Checklist.md) | Describes a checklist. | | [ChecklistTask](classes/ChecklistTask.md) | Describes a task in a checklist. | | [ChecklistTasksAdded](classes/ChecklistTasksAdded.md) | Describes a service message about tasks added to a checklist. | | [ChecklistTasksAddedContext](classes/ChecklistTasksAddedContext.md) | This object represents a service message about checklist tasks added. | | [ChecklistTasksDone](classes/ChecklistTasksDone.md) | Describes a service message about checklist tasks marked as done or not done. | | [ChecklistTasksDoneContext](classes/ChecklistTasksDoneContext.md) | This object represents a service message about checklist tasks done. | | [ChosenInlineResult](classes/ChosenInlineResult.md) | Represents a result of an inline query that was chosen by the user and sent to their chat partner. | | [ChosenInlineResultContext](classes/ChosenInlineResultContext.md) | The result of an inline query that was chosen by a user and sent to their chat partner | | [CloneMixin](classes/CloneMixin.md) | This object represents a mixin which has `clone(options?)` method | | [Contact](classes/Contact.md) | This object represents a phone contact. | | [ContactAttachment](classes/ContactAttachment.md) | This object represents a phone contact. | | [Context](classes/Context.md) | Main base context | | [DeleteChatPhotoContext](classes/DeleteChatPhotoContext.md) | Service message: the chat photo was deleted | | [Dice](classes/Dice.md) | This object represents an animated emoji that displays a random value. | | [DirectMessagePriceChanged](classes/DirectMessagePriceChanged.md) | Describes a service message about a change in the price of direct messages sent to a channel chat. | | [DirectMessagePriceChangedContext](classes/DirectMessagePriceChangedContext.md) | This object represents a service message about direct message price changed. | | [DirectMessagesTopic](classes/DirectMessagesTopic.md) | Describes a topic of a direct messages chat. | | [DocumentAttachment](classes/DocumentAttachment.md) | This object represents a general file (as opposed to photos, voice messages and audio files). | | [DownloadMixin](classes/DownloadMixin.md) | This object represents a mixin that can be used to download media files | | [EncryptedCredentials](classes/EncryptedCredentials.md) | Contains data required for decrypting and authenticatin `EncryptedPassportElement`. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. | | [EncryptedPassportElement](classes/EncryptedPassportElement.md) | Contains information about documents or other Telegram Passport elements shared with the bot by the user. | | [ExternalReplyInfo](classes/ExternalReplyInfo.md) | This object contains information about a message that is being replied to, which may come from another chat or forum topic. | | [File](classes/File.md) | This object represents a file ready to be downloaded. The file can be downloaded via the link `https://api.telegram.org/file/bot/`. 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`. | | [FileAttachment](classes/FileAttachment.md) | Attachment with `fileId` and `fileUniqueId` properties | | [ForumMixin](classes/ForumMixin.md) | This object represents a mixin that's used in all topic-related updates | | [ForumTopicClosed](classes/ForumTopicClosed.md) | This object represents a service message about a forum topic closed in the chat. Currently holds no information. | | [ForumTopicClosedContext](classes/ForumTopicClosedContext.md) | This object represents a service message about a forum topic closed in the chat. Currently holds no information. | | [ForumTopicCreated](classes/ForumTopicCreated.md) | This object represents a service message about a new forum topic created in the chat. | | [ForumTopicCreatedContext](classes/ForumTopicCreatedContext.md) | This object represents a service message about a new forum topic created in the chat. | | [ForumTopicEdited](classes/ForumTopicEdited.md) | This object represents a service message about an edited forum topic. | | [ForumTopicEditedContext](classes/ForumTopicEditedContext.md) | This object represents a service message about an edited forum topic. | | [ForumTopicReopened](classes/ForumTopicReopened.md) | This object represents a service message about an edited forum topic. | | [ForumTopicReopenedContext](classes/ForumTopicReopenedContext.md) | This object represents a service message about a forum topic reopened in the chat. Currently holds no information. | | [Game](classes/Game.md) | This object represents a game. | | [GeneralForumTopicHidden](classes/GeneralForumTopicHidden.md) | This object represents a service message about General forum topic hidden in the chat. Currently holds no information. | | [GeneralForumTopicHiddenContext](classes/GeneralForumTopicHiddenContext.md) | This object represents a service message about General forum topic hidden in the chat. Currently holds no information. | | [GeneralForumTopicUnhidden](classes/GeneralForumTopicUnhidden.md) | This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. | | [GeneralForumTopicUnhiddenContext](classes/GeneralForumTopicUnhiddenContext.md) | This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. | | [Gift](classes/Gift.md) | Describes a service message about a regular gift that was sent or received. | | [GiftBackground](classes/GiftBackground.md) | This object describes the background of a gift. | | [GiftContext](classes/GiftContext.md) | This object contains information about the chat whose identifier was shared with the bot using a `KeyboardButtonRequestChat` button. | | [GiftInfo](classes/GiftInfo.md) | Describes a service message about a regular gift that was sent or received. | | [GiftUpgradeSentContext](classes/GiftUpgradeSentContext.md) | This object represents a service message about an upgrade of a gift that was purchased after the gift was sent. | | [Giveaway](classes/Giveaway.md) | This object represents a message about a scheduled giveaway. | | [GiveawayCompleted](classes/GiveawayCompleted.md) | This object represents a service message about the completion of a giveaway without public winners. | | [GiveawayCompletedContext](classes/GiveawayCompletedContext.md) | This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. | | [GiveawayCreated](classes/GiveawayCreated.md) | This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. | | [GiveawayCreatedContext](classes/GiveawayCreatedContext.md) | This object represents a service message about the creation of a scheduled giveaway. | | [GiveawayWinners](classes/GiveawayWinners.md) | This object represents a message about the completion of a giveaway with public winners. | | [GiveawayWinnersContext](classes/GiveawayWinnersContext.md) | This object represents a message about the completion of a giveaway with public winners. | | [GroupChatCreatedContext](classes/GroupChatCreatedContext.md) | service message: the group has been created | | [InaccessibleMessage](classes/InaccessibleMessage.md) | This object describes a message that was deleted or is otherwise inaccessible to the bot. | | [InlineKeyboardButton](classes/InlineKeyboardButton.md) | This object represents one button of an inline keyboard. You must use exactly one of the optional fields. | | [InlineKeyboardMarkup](classes/InlineKeyboardMarkup.md) | This object represents an inline keyboard that appears right next to the message it belongs to. | | [InlineQuery](classes/InlineQuery.md) | This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. | | [InlineQueryContext](classes/InlineQueryContext.md) | This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. | | [InlineQueryResultLocation](classes/InlineQueryResultLocation.md) | 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. | | [InputChecklist](classes/InputChecklist.md) | Describes a checklist to create. | | [InputChecklistTask](classes/InputChecklistTask.md) | Describes a task to add to a checklist. | | [InputLocationMessageContent](classes/InputLocationMessageContent.md) | Represents the [content](https://core.telegram.org/bots/api/#inputmessagecontent) of a location message to be sent as the result of an inline query. | | [InputPollOption](classes/InputPollOption.md) | This object contains information about one answer option in a poll to send. | | [Invoice](classes/Invoice.md) | This object contains basic information about an invoice. | | [InvoiceContext](classes/InvoiceContext.md) | Message is an invoice for a [payment](https://core.telegram.org/bots/api/#payments), information about the invoice. [More about payments »](https://core.telegram.org/bots/api/#payments) | | [LeftChatMemberContext](classes/LeftChatMemberContext.md) | A member was removed from the group, information about them (this member may be the bot itself) | | [LinkPreviewOptions](classes/LinkPreviewOptions.md) | Describes the options used for link preview generation. | | [Location](classes/Location.md) | This object represents a point on the map. | | [LocationAttachment](classes/LocationAttachment.md) | This object represents a point on the map. | | [LocationContext](classes/LocationContext.md) | This object represents a point on the map. | | [LoginUrl](classes/LoginUrl.md) | This object represents a parameter of the inline keyboard button used to automatically authorize a user. | | [MaskPosition](classes/MaskPosition.md) | This object describes the position on faces where a mask should be placed by default. | | [MenuButton](classes/MenuButton.md) | This object describes the bot's menu button in a private chat. | | [Message](classes/Message.md) | This object represents a message. | | [MessageAutoDeleteTimerChanged](classes/MessageAutoDeleteTimerChanged.md) | This object represents a service message about a change in auto-delete timer settings | | [MessageAutoDeleteTimerChangedContext](classes/MessageAutoDeleteTimerChangedContext.md) | This object represents a service message about a change in auto-delete timer settings. | | [MessageContext](classes/MessageContext.md) | Called when `message` event occurs | | [MessageEntity](classes/MessageEntity.md) | This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. | | [MessageId](classes/MessageId.md) | This object represents a unique message identifier. | | [MessageOriginChannel](classes/MessageOriginChannel.md) | The message was originally sent to a channel chat. | | [MessageOriginChat](classes/MessageOriginChat.md) | The message was originally sent on behalf of a chat to a group chat. | | [MessageOriginHiddenUser](classes/MessageOriginHiddenUser.md) | The message was originally sent by an unknown user. | | [MessageOriginUser](classes/MessageOriginUser.md) | The message was originally sent by a known user. | | [MessageReactionContext](classes/MessageReactionContext.md) | This object represents a change of a reaction on a message performed by a user. | | [MessageReactionCountContext](classes/MessageReactionCountContext.md) | This object represents reaction changes on a message with anonymous reactions. | | [MessageReactionCountUpdated](classes/MessageReactionCountUpdated.md) | This object represents reaction changes on a message with anonymous reactions. | | [MessageReactionUpdated](classes/MessageReactionUpdated.md) | This object represents a change of a reaction on a message performed by a user. | | [MigrateFromChatIdContext](classes/MigrateFromChatIdContext.md) | 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. | | [MigrateToChatIdContext](classes/MigrateToChatIdContext.md) | 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. | | [NewChatMembersContext](classes/NewChatMembersContext.md) | New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) | | [NewChatPhotoContext](classes/NewChatPhotoContext.md) | A chat photo was change to this value | | [NewChatTitleContext](classes/NewChatTitleContext.md) | A chat title was changed to this value | | [NodeMixin](classes/NodeMixin.md) | This object represents a mixin which has `id` field and can invoke `id`-dependent methods | | [OrderInfo](classes/OrderInfo.md) | This object represents information about an order. | | [PaidMediaInfo](classes/PaidMediaInfo.md) | Describes the paid media added to a message. | | [PaidMediaPhoto](classes/PaidMediaPhoto.md) | The paid media is a photo. | | [PaidMediaPreview](classes/PaidMediaPreview.md) | The paid media isn't available before the payment. | | [PaidMediaPurchasedContext](classes/PaidMediaPurchasedContext.md) | This object contains information about a paid media purchase. | | [PaidMediaVideo](classes/PaidMediaVideo.md) | The paid media is a video. | | [PaidMessagePriceChangedContext](classes/PaidMessagePriceChangedContext.md) | Describes a service message about a change in the price of paid messages within a chat. | | [PassportData](classes/PassportData.md) | Contains information about Telegram Passport data shared with the bot by the user. | | [PassportDataContext](classes/PassportDataContext.md) | Describes Telegram Passport data shared with the bot by the user. | | [PassportFile](classes/PassportFile.md) | 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. | | [PhotoAttachment](classes/PhotoAttachment.md) | This object represents a photo file with it's sizes | | [PhotoSize](classes/PhotoSize.md) | This object represents one size of a photo or a file / sticker thumbnail | | [PinnedMessageContext](classes/PinnedMessageContext.md) | Specified 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. | | [PinsMixin](classes/PinsMixin.md) | This object represents a mixin that ensures you have methods to pin/unpin messages in the chat | | [Poll](classes/Poll.md) | This object contains information about a poll. | | [PollAnswer](classes/PollAnswer.md) | This object represents an answer of a user in a non-anonymous poll. | | [PollAnswerContext](classes/PollAnswerContext.md) | This object represents an answer of a user in a non-anonymous poll. | | [PollAttachment](classes/PollAttachment.md) | This object contains information about a poll. | | [PollContext](classes/PollContext.md) | This object contains information about a poll. | | [PollOption](classes/PollOption.md) | This object contains information about one answer option in a poll. | | [PreCheckoutQuery](classes/PreCheckoutQuery.md) | This object contains information about an incoming pre-checkout query. | | [PreCheckoutQueryContext](classes/PreCheckoutQueryContext.md) | This object contains information about an incoming pre-checkout query. | | [ProximityAlertTriggered](classes/ProximityAlertTriggered.md) | This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. | | [ProximityAlertTriggeredContext](classes/ProximityAlertTriggeredContext.md) | This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. | | [ReactionCount](classes/ReactionCount.md) | Represents a reaction added to a message along with the number of times it was added. | | [ReactionTypeCustomEmoji](classes/ReactionTypeCustomEmoji.md) | The reaction is based on a custom emoji. | | [ReactionTypeEmoji](classes/ReactionTypeEmoji.md) | The reaction is based on an emoji. | | [ReactionTypePaid](classes/ReactionTypePaid.md) | The reaction is paid. | | [RefundedPayment](classes/RefundedPayment.md) | This object contains basic information about a refunded payment. | | [RefundedPaymentContext](classes/RefundedPaymentContext.md) | This object contains basic information about a successful payment. | | [RemovedChatBoostContext](classes/RemovedChatBoostContext.md) | This object represents a boost removed from a chat. | | [SendMixin](classes/SendMixin.md) | This object represents a mixin which can invoke `chatId`/`senderId`-dependent methods | | [SentWebAppMessage](classes/SentWebAppMessage.md) | Contains information about an inline message sent by a Web App on behalf of a user. | | [SharedUser](classes/SharedUser.md) | This object contains information about the user whose identifier was shared with the bot using a `KeyboardButtonRequestUser` button. | | [ShippingAddress](classes/ShippingAddress.md) | This object represents a shipping address. | | [ShippingQuery](classes/ShippingQuery.md) | This object contains information about an incoming shipping query. | | [ShippingQueryContext](classes/ShippingQueryContext.md) | This object contains information about an incoming shipping query. | | [StickerAttachment](classes/StickerAttachment.md) | This object represents a sticker. | | [StickerSet](classes/StickerSet.md) | This object represents a sticker set. | | [Story](classes/Story.md) | This object represents a story. | | [StoryAttachment](classes/StoryAttachment.md) | This object represents a story. | | [SuccessfulPayment](classes/SuccessfulPayment.md) | This object contains basic information about a successful payment. | | [SuccessfulPaymentContext](classes/SuccessfulPaymentContext.md) | This object contains basic information about a successful payment. | | [SuggestedPostApprovalFailed](classes/SuggestedPostApprovalFailed.md) | Describes a service message about the failed approval of a suggested post. | | [SuggestedPostApprovalFailedContext](classes/SuggestedPostApprovalFailedContext.md) | This object represents a service message about the failed approval of a suggested post. | | [SuggestedPostApproved](classes/SuggestedPostApproved.md) | Describes a service message about the approval of a suggested post. | | [SuggestedPostApprovedContext](classes/SuggestedPostApprovedContext.md) | This object represents a service message about the approval of a suggested post. | | [SuggestedPostDeclined](classes/SuggestedPostDeclined.md) | Describes a service message about the rejection of a suggested post. | | [SuggestedPostDeclinedContext](classes/SuggestedPostDeclinedContext.md) | This object represents a service message about the rejection of a suggested post. | | [SuggestedPostInfo](classes/SuggestedPostInfo.md) | Contains information about a suggested post. | | [SuggestedPostPaid](classes/SuggestedPostPaid.md) | Describes a service message about a successful payment for a suggested post. | | [SuggestedPostPaidContext](classes/SuggestedPostPaidContext.md) | This object represents a service message about a successful payment for a suggested post. | | [SuggestedPostPrice](classes/SuggestedPostPrice.md) | Describes price of a suggested post. | | [SuggestedPostRefunded](classes/SuggestedPostRefunded.md) | Describes a service message about a payment refund for a suggested post. | | [SuggestedPostRefundedContext](classes/SuggestedPostRefundedContext.md) | This object represents a service message about a payment refund for a suggested post. | | [TargetMixin](classes/TargetMixin.md) | This object represents a mixin which has sender data (e.g. `senderId`, `from` etc.) | | [TextQuote](classes/TextQuote.md) | This object contains information about the quoted part of a message that is replied to by the given message. | | [UniqueGift](classes/UniqueGift.md) | This object describes a unique gift that was upgraded from a regular gift. | | [UniqueGiftBackdrop](classes/UniqueGiftBackdrop.md) | This object describes the colors of the backdrop of a unique gift. | | [UniqueGiftBackdropColors](classes/UniqueGiftBackdropColors.md) | Describes a service message about a regular gift that was sent or received. | | [UniqueGiftColors](classes/UniqueGiftColors.md) | This object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift. | | [UniqueGiftContext](classes/UniqueGiftContext.md) | This object contains information about the chat whose identifier was shared with the bot using a `KeyboardButtonRequestChat` button. | | [UniqueGiftInfo](classes/UniqueGiftInfo.md) | Describes a service message about a unique gift that was sent or received. | | [UniqueGiftModel](classes/UniqueGiftModel.md) | Describes a service message about a regular gift that was sent or received. | | [UniqueGiftSymbol](classes/UniqueGiftSymbol.md) | Describes a service message about a regular gift that was sent or received. | | [Update](classes/Update.md) | This object represents an incoming update. | | [User](classes/User.md) | This object represents a Telegram user or bot. | | [UserProfileAudios](classes/UserProfileAudios.md) | This object represents the audios displayed on a user's profile. | | [UserProfilePhotos](classes/UserProfilePhotos.md) | This object represent a user's profile pictures. | | [UserRating](classes/UserRating.md) | This object describes the rating of a user based on their Telegram Star spendings. | | [UsersShared](classes/UsersShared.md) | This object contains information about the user whose identifier was shared with the bot using a `KeyboardButtonRequestUser` button. | | [UsersSharedContext](classes/UsersSharedContext.md) | This object contains information about the users whose identifiers were shared with the bot using a `KeyboardButtonRequestUsers` button. | | [Venue](classes/Venue.md) | This object represents a venue. | | [VenueAttachment](classes/VenueAttachment.md) | This object represents a venue. | | [VideoAttachment](classes/VideoAttachment.md) | This object represents a video file. | | [VideoChatEnded](classes/VideoChatEnded.md) | This object represents a service message about a video chat ended in the chat. | | [VideoChatEndedContext](classes/VideoChatEndedContext.md) | This object represents a service message about a video chat ended in the chat. | | [VideoChatParticipantsInvited](classes/VideoChatParticipantsInvited.md) | This object represents a service message about new members invited to a video chat. | | [VideoChatParticipantsInvitedContext](classes/VideoChatParticipantsInvitedContext.md) | This object represents a service message about new members invited to a video chat. | | [VideoChatScheduled](classes/VideoChatScheduled.md) | This object represents a service message about a video chat scheduled in the chat | | [VideoChatScheduledContext](classes/VideoChatScheduledContext.md) | This object represents a service message about a video chat scheduled in the chat. | | [VideoChatStarted](classes/VideoChatStarted.md) | This object represents a service message about a video chat started in the chat. Currently holds no information. | | [VideoChatStartedContext](classes/VideoChatStartedContext.md) | This object represents a service message about a video chat started in the chat. | | [VideoNoteAttachment](classes/VideoNoteAttachment.md) | This object represents a video message. | | [VideoQuality](classes/VideoQuality.md) | This object represents a video file of a specific quality. | | [VoiceAttachment](classes/VoiceAttachment.md) | This object represents a voice note. | | [WebAppData](classes/WebAppData.md) | Contains data sent from a Web App to the bot. | | [WebAppDataContext](classes/WebAppDataContext.md) | Describes data sent from a [Web App](https://core.telegram.org/bots/webapps) to the bot. | | [WebAppInfo](classes/WebAppInfo.md) | Contains information about a Web App. | | [WriteAccessAllowed](classes/WriteAccessAllowed.md) | This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information. | | [WriteAccessAllowedContext](classes/WriteAccessAllowedContext.md) | This 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](https://core.telegram.org/bots/webapps#initializing-mini-apps). | ## Interfaces | Interface | Description | | ------ | ------ | | [AttachmentsMapping](interfaces/AttachmentsMapping.md) | Mapping attachments type to their structures | | [BotLike](interfaces/BotLike.md) | The required object that the contexts are based on | | [DefaultAttachment](interfaces/DefaultAttachment.md) | Base interface for attachment | | [StreamMessageOptions](interfaces/StreamMessageOptions.md) | Options for SendMixin.streamMessage | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [AttachmentType](type-aliases/AttachmentType.md) | Union type of attachments type | | [Constructor](type-aliases/Constructor.md) | Type helper constructor | | [ContextsMapping](type-aliases/ContextsMapping.md) | Mapping events to their contexts | | [ContextType](type-aliases/ContextType.md) | Type util to get type of Context | | [CustomEventName](type-aliases/CustomEventName.md) | Custom Event Name | | [GetDerives](type-aliases/GetDerives.md) | - | | [JoinUnion](type-aliases/JoinUnion.md) | Type helper to join union type | | [MaybeArray](type-aliases/MaybeArray.md) | Type helper to add array and non-array type | | [MessageContextWithRequiredFrom](type-aliases/MessageContextWithRequiredFrom.md) | - | | [MessageDraftPiece](type-aliases/MessageDraftPiece.md) | A chunk of text for streaming via sendMessageDraft | | [MessageEventName](type-aliases/MessageEventName.md) | Union type of MessageEvent names | | [Optional](type-aliases/Optional.md) | Make some keys optional | | [Require](type-aliases/Require.md) | Like `Required` but for specified keys of `T` | | [RequireValue](type-aliases/RequireValue.md) | Like `Require` but it sets `V` as the value for `K` values | | [SoftString](type-aliases/SoftString.md) | Permits `string` but gives hints | | [tSendAnimation](type-aliases/tSendAnimation.md) | This type represent SendAnimationParams and used by Contexts.MessageContext.sendMedia | | [tSendAudio](type-aliases/tSendAudio.md) | This type represent SendAudioParams and used by Contexts.MessageContext.sendMedia | | [tSendDocument](type-aliases/tSendDocument.md) | This type represent SendDocumentParams and used by Contexts.MessageContext.sendMedia | | [tSendMethods](type-aliases/tSendMethods.md) | This Union type represent a media that can be sended and used by Contexts.MessageContext.sendMedia | | [tSendPhoto](type-aliases/tSendPhoto.md) | This type represent SendPhotoParams and used by Contexts.MessageContext.sendMedia | | [tSendSticker](type-aliases/tSendSticker.md) | This type represent SendStickerParams and used by Contexts.MessageContext.sendMedia | | [tSendVideo](type-aliases/tSendVideo.md) | This type represent SendVideoParams and used by Contexts.MessageContext.sendMedia | | [tSendVideoNote](type-aliases/tSendVideoNote.md) | This type represent SendVideoNoteParams and used by Contexts.MessageContext.sendMedia | | [tSendVoice](type-aliases/tSendVoice.md) | This type represent SendVoiceParams and used by Contexts.MessageContext.sendMedia | | [UpdateName](type-aliases/UpdateName.md) | Union type of Update names | ## Variables ### applyMixins() > `const` **applyMixins**: (`derivedCtor`, `baseCtors`) => `void` Defined in: contexts/index.d.ts:6701 Helper for construct mixins #### Parameters | Parameter | Type | | ------ | ------ | | `derivedCtor` | `any` | | `baseCtors` | `any`\[] | #### Returns `void` *** ### backgroundFillMap > `const` **backgroundFillMap**: `object` Defined in: contexts/index.d.ts:1023 This object describes the way a background is filled based on the selected colors. Currently, it can be one of * [BackgroundFillSolid](https://core.telegram.org/bots/api/#backgroundfillsolid) * [BackgroundFillGradient](https://core.telegram.org/bots/api/#backgroundfillgradient) * [BackgroundFillFreeformGradient](https://core.telegram.org/bots/api/#backgroundfillfreeformgradient) [Documentation](https://core.telegram.org/bots/api/#backgroundfill) #### Type Declaration | Name | Type | Defined in | | ------ | ------ | ------ | | `freeform_gradient` | *typeof* [`BackgroundFillFreeformGradient`](classes/BackgroundFillFreeformGradient.md) | contexts/index.d.ts:1026 | | `gradient` | *typeof* [`BackgroundFillGradient`](classes/BackgroundFillGradient.md) | contexts/index.d.ts:1025 | | `solid` | *typeof* [`BackgroundFillSolid`](classes/BackgroundFillSolid.md) | contexts/index.d.ts:1024 | *** ### backgroundTypeMap > `const` **backgroundTypeMap**: `object` Defined in: contexts/index.d.ts:1151 This object describes the type of a background. Currently, it can be one of * [BackgroundTypeFill](https://core.telegram.org/bots/api/#backgroundtypefill) * [BackgroundTypeWallpaper](https://core.telegram.org/bots/api/#backgroundtypewallpaper) * [BackgroundTypePattern](https://core.telegram.org/bots/api/#backgroundtypepattern) * [BackgroundTypeChatTheme](https://core.telegram.org/bots/api/#backgroundtypechattheme) [Documentation](https://core.telegram.org/bots/api/#backgroundtype) #### Type Declaration | Name | Type | Defined in | | ------ | ------ | ------ | | `chat_theme` | *typeof* [`BackgroundTypeChatTheme`](classes/BackgroundTypeChatTheme.md) | contexts/index.d.ts:1155 | | `fill` | *typeof* [`BackgroundTypeFill`](classes/BackgroundTypeFill.md) | contexts/index.d.ts:1152 | | `pattern` | *typeof* [`BackgroundTypePattern`](classes/BackgroundTypePattern.md) | contexts/index.d.ts:1154 | | `wallpaper` | *typeof* [`BackgroundTypeWallpaper`](classes/BackgroundTypeWallpaper.md) | contexts/index.d.ts:1153 | *** ### contextsMappings > `const` **contextsMappings**: `object` Defined in: contexts/index.d.ts:6728 Mapping UpdateNames to their contexts #### Type Declaration | Name | Type | Defined in | | ------ | ------ | ------ | | `boost_added` | *typeof* [`BoostAddedContext`](classes/BoostAddedContext.md) | contexts/index.d.ts:6761 | | `business_connection` | *typeof* [`BusinessConnectionContext`](classes/BusinessConnectionContext.md) | contexts/index.d.ts:6748 | | `business_message` | *typeof* [`MessageContext`](classes/MessageContext.md) | contexts/index.d.ts:6745 | | `callback_query` | *typeof* [`CallbackQueryContext`](classes/CallbackQueryContext.md) | contexts/index.d.ts:6729 | | `channel_post` | *typeof* [`MessageContext`](classes/MessageContext.md) | contexts/index.d.ts:6742 | | `chat_background_set` | *typeof* [`ChatBackgroundSetContext`](classes/ChatBackgroundSetContext.md) | contexts/index.d.ts:6762 | | `chat_boost` | *typeof* [`ChatBoostContext`](classes/ChatBoostContext.md) | contexts/index.d.ts:6797 | | `chat_join_request` | *typeof* [`ChatJoinRequestContext`](classes/ChatJoinRequestContext.md) | contexts/index.d.ts:6730 | | `chat_member` | *typeof* [`ChatMemberContext`](classes/ChatMemberContext.md) | contexts/index.d.ts:6731 | | `chat_owner_changed` | *typeof* [`ChatOwnerChangedContext`](classes/ChatOwnerChangedContext.md) | contexts/index.d.ts:6786 | | `chat_owner_left` | *typeof* [`ChatOwnerLeftContext`](classes/ChatOwnerLeftContext.md) | contexts/index.d.ts:6785 | | `chat_shared` | *typeof* [`ChatSharedContext`](classes/ChatSharedContext.md) | contexts/index.d.ts:6781 | | `checklist_tasks_added` | *typeof* [`ChecklistTasksAddedContext`](classes/ChecklistTasksAddedContext.md) | contexts/index.d.ts:6764 | | `checklist_tasks_done` | *typeof* [`ChecklistTasksDoneContext`](classes/ChecklistTasksDoneContext.md) | contexts/index.d.ts:6763 | | `chosen_inline_result` | *typeof* [`ChosenInlineResultContext`](classes/ChosenInlineResultContext.md) | contexts/index.d.ts:6733 | | `delete_chat_photo` | *typeof* [`DeleteChatPhotoContext`](classes/DeleteChatPhotoContext.md) | contexts/index.d.ts:6734 | | `deleted_business_messages` | *typeof* [`BusinessMessagesDeletedContext`](classes/BusinessMessagesDeletedContext.md) | contexts/index.d.ts:6747 | | `direct_message_price_changed` | *typeof* [`DirectMessagePriceChangedContext`](classes/DirectMessagePriceChangedContext.md) | contexts/index.d.ts:6765 | | `edited_business_message` | *typeof* [`MessageContext`](classes/MessageContext.md) | contexts/index.d.ts:6746 | | `edited_channel_post` | *typeof* [`MessageContext`](classes/MessageContext.md) | contexts/index.d.ts:6744 | | `edited_message` | *typeof* [`MessageContext`](classes/MessageContext.md) | contexts/index.d.ts:6743 | | `forum_topic_closed` | *typeof* [`ForumTopicClosedContext`](classes/ForumTopicClosedContext.md) | contexts/index.d.ts:6773 | | `forum_topic_created` | *typeof* [`ForumTopicCreatedContext`](classes/ForumTopicCreatedContext.md) | contexts/index.d.ts:6771 | | `forum_topic_edited` | *typeof* [`ForumTopicEditedContext`](classes/ForumTopicEditedContext.md) | contexts/index.d.ts:6772 | | `forum_topic_reopened` | *typeof* [`ForumTopicReopenedContext`](classes/ForumTopicReopenedContext.md) | contexts/index.d.ts:6774 | | `general_forum_topic_hidden` | *typeof* [`GeneralForumTopicHiddenContext`](classes/GeneralForumTopicHiddenContext.md) | contexts/index.d.ts:6775 | | `general_forum_topic_unhidden` | *typeof* [`GeneralForumTopicUnhiddenContext`](classes/GeneralForumTopicUnhiddenContext.md) | contexts/index.d.ts:6776 | | `gift` | *typeof* [`GiftContext`](classes/GiftContext.md) | contexts/index.d.ts:6782 | | `gift_upgrade_sent` | *typeof* [`GiftUpgradeSentContext`](classes/GiftUpgradeSentContext.md) | contexts/index.d.ts:6783 | | `giveaway_completed` | *typeof* [`GiveawayCompletedContext`](classes/GiveawayCompletedContext.md) | contexts/index.d.ts:6800 | | `giveaway_created` | *typeof* [`GiveawayCreatedContext`](classes/GiveawayCreatedContext.md) | contexts/index.d.ts:6799 | | `giveaway_winners` | *typeof* [`GiveawayWinnersContext`](classes/GiveawayWinnersContext.md) | contexts/index.d.ts:6801 | | `group_chat_created` | *typeof* [`GroupChatCreatedContext`](classes/GroupChatCreatedContext.md) | contexts/index.d.ts:6735 | | `inline_query` | *typeof* [`InlineQueryContext`](classes/InlineQueryContext.md) | contexts/index.d.ts:6736 | | `invoice` | *typeof* [`InvoiceContext`](classes/InvoiceContext.md) | contexts/index.d.ts:6737 | | `left_chat_member` | *typeof* [`LeftChatMemberContext`](classes/LeftChatMemberContext.md) | contexts/index.d.ts:6738 | | `location` | *typeof* [`LocationContext`](classes/LocationContext.md) | contexts/index.d.ts:6739 | | `message` | *typeof* [`MessageContext`](classes/MessageContext.md) | contexts/index.d.ts:6741 | | `message_auto_delete_timer_changed` | *typeof* [`MessageAutoDeleteTimerChangedContext`](classes/MessageAutoDeleteTimerChangedContext.md) | contexts/index.d.ts:6740 | | `message_reaction` | *typeof* [`MessageReactionContext`](classes/MessageReactionContext.md) | contexts/index.d.ts:6795 | | `message_reaction_count` | *typeof* [`MessageReactionCountContext`](classes/MessageReactionCountContext.md) | contexts/index.d.ts:6796 | | `migrate_from_chat_id` | *typeof* [`MigrateFromChatIdContext`](classes/MigrateFromChatIdContext.md) | contexts/index.d.ts:6749 | | `migrate_to_chat_id` | *typeof* [`MigrateToChatIdContext`](classes/MigrateToChatIdContext.md) | contexts/index.d.ts:6750 | | `my_chat_member` | *typeof* [`ChatMemberContext`](classes/ChatMemberContext.md) | contexts/index.d.ts:6732 | | `new_chat_members` | *typeof* [`NewChatMembersContext`](classes/NewChatMembersContext.md) | contexts/index.d.ts:6751 | | `new_chat_photo` | *typeof* [`NewChatPhotoContext`](classes/NewChatPhotoContext.md) | contexts/index.d.ts:6752 | | `new_chat_title` | *typeof* [`NewChatTitleContext`](classes/NewChatTitleContext.md) | contexts/index.d.ts:6753 | | `paid_message_price_changed` | *typeof* [`PaidMessagePriceChangedContext`](classes/PaidMessagePriceChangedContext.md) | contexts/index.d.ts:6787 | | `passport_data` | *typeof* [`PassportDataContext`](classes/PassportDataContext.md) | contexts/index.d.ts:6754 | | `pinned_message` | *typeof* [`PinnedMessageContext`](classes/PinnedMessageContext.md) | contexts/index.d.ts:6755 | | `poll` | *typeof* [`PollContext`](classes/PollContext.md) | contexts/index.d.ts:6757 | | `poll_answer` | *typeof* [`PollAnswerContext`](classes/PollAnswerContext.md) | contexts/index.d.ts:6756 | | `pre_checkout_query` | *typeof* [`PreCheckoutQueryContext`](classes/PreCheckoutQueryContext.md) | contexts/index.d.ts:6758 | | `proximity_alert_triggered` | *typeof* [`ProximityAlertTriggeredContext`](classes/ProximityAlertTriggeredContext.md) | contexts/index.d.ts:6759 | | `purchased_paid_media` | *typeof* [`PaidMediaPurchasedContext`](classes/PaidMediaPurchasedContext.md) | contexts/index.d.ts:6794 | | `refunded_payment` | *typeof* [`RefundedPaymentContext`](classes/RefundedPaymentContext.md) | contexts/index.d.ts:6779 | | `removed_chat_boost` | *typeof* [`RemovedChatBoostContext`](classes/RemovedChatBoostContext.md) | contexts/index.d.ts:6798 | | `service_message` | *typeof* [`MessageContext`](classes/MessageContext.md) | contexts/index.d.ts:6793 | | `shipping_query` | *typeof* [`ShippingQueryContext`](classes/ShippingQueryContext.md) | contexts/index.d.ts:6777 | | `successful_payment` | *typeof* [`SuccessfulPaymentContext`](classes/SuccessfulPaymentContext.md) | contexts/index.d.ts:6778 | | `suggested_post_approval_failed` | *typeof* [`SuggestedPostApprovalFailedContext`](classes/SuggestedPostApprovalFailedContext.md) | contexts/index.d.ts:6767 | | `suggested_post_approved` | *typeof* [`SuggestedPostApprovedContext`](classes/SuggestedPostApprovedContext.md) | contexts/index.d.ts:6766 | | `suggested_post_declined` | *typeof* [`SuggestedPostDeclinedContext`](classes/SuggestedPostDeclinedContext.md) | contexts/index.d.ts:6768 | | `suggested_post_paid` | *typeof* [`SuggestedPostPaidContext`](classes/SuggestedPostPaidContext.md) | contexts/index.d.ts:6769 | | `suggested_post_refunded` | *typeof* [`SuggestedPostRefundedContext`](classes/SuggestedPostRefundedContext.md) | contexts/index.d.ts:6770 | | `unique_gift` | *typeof* [`UniqueGiftContext`](classes/UniqueGiftContext.md) | contexts/index.d.ts:6784 | | `users_shared` | *typeof* [`UsersSharedContext`](classes/UsersSharedContext.md) | contexts/index.d.ts:6780 | | `video_chat_ended` | *typeof* [`VideoChatEndedContext`](classes/VideoChatEndedContext.md) | contexts/index.d.ts:6788 | | `video_chat_participants_invited` | *typeof* [`VideoChatParticipantsInvitedContext`](classes/VideoChatParticipantsInvitedContext.md) | contexts/index.d.ts:6789 | | `video_chat_scheduled` | *typeof* [`VideoChatScheduledContext`](classes/VideoChatScheduledContext.md) | contexts/index.d.ts:6790 | | `video_chat_started` | *typeof* [`VideoChatStartedContext`](classes/VideoChatStartedContext.md) | contexts/index.d.ts:6791 | | `web_app_data` | *typeof* [`WebAppDataContext`](classes/WebAppDataContext.md) | contexts/index.d.ts:6792 | | `write_access_allowed` | *typeof* [`WriteAccessAllowedContext`](classes/WriteAccessAllowedContext.md) | contexts/index.d.ts:6760 | #### Example ```typescript contextMappings["message"] is MessageContext ``` *** ### EVENTS > `const` **EVENTS**: \[keyof [`Message`](classes/Message.md), [`MessageEventName`](type-aliases/MessageEventName.md)]\[] Defined in: contexts/index.d.ts:6711 Array of EVENTS *** ### filterPayload() > `const` **filterPayload**: (`payload`) => `Record`<`string`, `unknown`> Defined in: contexts/index.d.ts:6705 Helper for filter objects #### Parameters | Parameter | Type | | ------ | ------ | | `payload` | `Record`<`string`, `any`> | #### Returns `Record`<`string`, `unknown`> *** ### isParsable() > `const` **isParsable**: (`source`) => `boolean` Defined in: contexts/index.d.ts:6707 Guard to check is string can be parsed via JSON.parse #### Parameters | Parameter | Type | | ------ | ------ | | `source` | `string` | #### Returns `boolean` *** ### isPlainObject() > `const` **isPlainObject**: (`object`) => `object is Record` Defined in: contexts/index.d.ts:6703 Guard to check is it play object #### Parameters | Parameter | Type | | ------ | ------ | | `object` | `object` | #### Returns `object is Record` *** ### paidMediaMap > `const` **paidMediaMap**: `object` Defined in: contexts/index.d.ts:4354 This object describes paid media. Currently, it can be one of * [PaidMediaPreview](https://core.telegram.org/bots/api/#paidmediapreview) * [PaidMediaPhoto](https://core.telegram.org/bots/api/#paidmediaphoto) * [PaidMediaVideo](https://core.telegram.org/bots/api/#paidmediavideo) [Documentation](https://core.telegram.org/bots/api/#paidmedia) #### Type Declaration | Name | Type | Defined in | | ------ | ------ | ------ | | `photo` | *typeof* [`PaidMediaPhoto`](classes/PaidMediaPhoto.md) | contexts/index.d.ts:4357 | | `preview` | *typeof* [`PaidMediaPreview`](classes/PaidMediaPreview.md) | contexts/index.d.ts:4355 | | `video` | *typeof* [`PaidMediaVideo`](classes/PaidMediaVideo.md) | contexts/index.d.ts:4356 | *** ### SERVICE\_MESSAGE\_EVENTS > `const` **SERVICE\_MESSAGE\_EVENTS**: [`MessageEventName`](type-aliases/MessageEventName.md)\[] Defined in: contexts/index.d.ts:6709 Array of SERVICE\_MESSAGE\_EVENTS ## Functions ### memoizeGetters() > **memoizeGetters**<`T`>(`cls`, `fields`): `void` Defined in: contexts/index.d.ts:6699 Helper for getters memoization #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `cls` | (...`args`) => `T` | | `fields` | keyof `T`\[] | #### Returns `void` *** ### sleep() > **sleep**(`ms`): `Promise`<`unknown`> Defined in: contexts/index.d.ts:5204 #### Parameters | Parameter | Type | | ------ | ------ | | `ms` | `number` | #### Returns `Promise`<`unknown`> --- --- url: 'https://gramio.dev/api/files.md' --- [GramIO API Reference](../../../index.md) / @gramio/files/dist # @gramio/files/dist ## Classes | Class | Description | | ------ | ------ | | [MediaInput](classes/MediaInput.md) | Class-helper with static methods that represents the content of a media message to be sent. | | [MediaUpload](classes/MediaUpload.md) | Class-helper with static methods for file uploading. | ## Variables ### MEDIA\_METHODS > `const` **MEDIA\_METHODS**: `MethodsWithMediaUpload` Defined in: files/index.d.ts:41 A set of methods with the function of checking whether a File has been passed in the parameters #### Codegenerated ## Functions ### convertJsonToFormData() > **convertJsonToFormData**<`T`>(`method`, `params`): `Promise`<`FormData`> Defined in: files/index.d.ts:12 Helper to convert JSON to FormData that can accept Telegram Bot API. if File is not top-level property it will be `“attach://”` [Documentation](https://core.telegram.org/bots/api#inputfile) #### Type Parameters | Type Parameter | | ------ | | `T` *extends* keyof [`APIMethods`](../../../gramio/interfaces/APIMethods.md) | #### Parameters | Parameter | Type | | ------ | ------ | | `method` | `T` | | `params` | `NonNullable`<[`APIMethodParams`](../../../gramio/type-aliases/APIMethodParams.md)<`T`>> | #### Returns `Promise`<`FormData`> *** ### convertStreamToBuffer() > **convertStreamToBuffer**(`stream`): `Promise`<`Buffer`<`ArrayBufferLike`>> Defined in: files/index.d.ts:21 Helper for convert Readable stream to buffer #### Parameters | Parameter | Type | | ------ | ------ | | `stream` | `Readable` | #### Returns `Promise`<`Buffer`<`ArrayBufferLike`>> *** ### extractFilesToFormData() > **extractFilesToFormData**<`T`>(`method`, `params`): `Promise`<\[`FormData`, `NonNullable`<[`APIMethodParams`](../../../gramio/type-aliases/APIMethodParams.md)<`T`>>]> Defined in: files/index.d.ts:19 Helper to extract files from params and convert them to FormData. (Similar to [convertJsonToFormData](#convertjsontoformdata)) if File is not top-level property it will be `“attach://”` [Documentation](https://core.telegram.org/bots/api#inputfile) #### Type Parameters | Type Parameter | | ------ | | `T` *extends* keyof [`APIMethods`](../../../gramio/interfaces/APIMethods.md) | #### Parameters | Parameter | Type | | ------ | ------ | | `method` | `T` | | `params` | `NonNullable`<[`APIMethodParams`](../../../gramio/type-aliases/APIMethodParams.md)<`T`>> | #### Returns `Promise`<\[`FormData`, `NonNullable`<[`APIMethodParams`](../../../gramio/type-aliases/APIMethodParams.md)<`T`>>]> *** ### isBlob() > **isBlob**(`blob?`): `boolean` Defined in: files/index.d.ts:35 Guard to check is it Blob or Promise #### Parameters | Parameter | Type | | ------ | ------ | | `blob?` | `string` | `object` | `Blob` | #### Returns `boolean` *** ### isMediaUpload() > **isMediaUpload**<`T`>(`method`, `params`): `boolean` Defined in: files/index.d.ts:5 Guard to check is method used for File Uploading #### Type Parameters | Type Parameter | | ------ | | `T` *extends* keyof [`APIMethods`](../../../gramio/interfaces/APIMethods.md) | #### Parameters | Parameter | Type | | ------ | ------ | | `method` | `T` | | `params` | `NonNullable`<[`APIMethodParams`](../../../gramio/type-aliases/APIMethodParams.md)<`T`>> | #### Returns `boolean` --- --- url: 'https://gramio.dev/api/format.md' --- [GramIO API Reference](../../../index.md) / @gramio/format/dist # @gramio/format/dist ## Variables ### blockquote() > `const` **blockquote**: {(`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md); (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md); } Defined in: format/index.d.ts:103 Format text as blockquote. Cannot be nested. #### Call Signature > (`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Call Signature > (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `strings` | `TemplateStringsArray` | | ...`values` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts blockquote`test` format`test ${blockquote(bold("GramIO"))}` format`Format text as ${blockquote`blockquote`}`; ``` ![blockquote](https://gramio.dev/formatting/blockquote.png) *** ### bold() > `const` **bold**: {(`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md); (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md); } Defined in: format/index.d.ts:33 Format text as **bold**. Cannot be combined with `code` and `pre`. #### Call Signature > (`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Call Signature > (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `strings` | `TemplateStringsArray` | | ...`values` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts bold`test` format`test ${bold(italic("GramIO"))}` format`Format text as ${bold`bold`}`; ``` ![bold](https://gramio.dev/formatting/bold.png) *** ### code() > `const` **code**: {(`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md); (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md); } Defined in: format/index.d.ts:131 Format text as `code`. Cannot be combined with any other format. #### Call Signature > (`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Call Signature > (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `strings` | `TemplateStringsArray` | | ...`values` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts code`test` format`test ${code("copy it")}` format`Format text as ${code`code`}`; ``` ![code](https://gramio.dev/formatting/code.png) *** ### customEmoji() > `const` **customEmoji**: (`str`, `custom_emoji_id`) => [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:182 Insert custom emoji by their id. #### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | `null` | `undefined` | | `custom_emoji_id` | `string` | #### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts customEmoji("⚔️", "5222106016283378623") format`test ${customEmoji("⚔️", "5222106016283378623")}` ``` **NOTE**: Custom emoji entities can only be used by bots that purchased additional usernames on [Fragment](https://fragment.com/). ![customEmoji](https://gramio.dev/formatting/custom_emoji.png) *** ### dateTime() > `const` **dateTime**: (`str`, `unix_time`, `date_time_format?`) => [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:212 Format text as a date/time entity with a Unix timestamp. Telegram renders it in the user's locale and timezone. #### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | `null` | `undefined` | The display text (shown as-is when `date_time_format` is empty) | | `unix_time` | `number` | Unix timestamp associated with the entity | | `date_time_format?` | `string` | Optional format string matching `r|w?[dD]?[tT]?`: - `""` — display text as-is; user can still see the date in their local format - `"r"` — relative time (e.g. "in 3 hours"). Cannot be combined with other chars. - `"w"` — day of week in user's language - `"d"` — short date (e.g. "17.03.22") - `"D"` — long date (e.g. "March 17, 2022") - `"t"` — short time (e.g. "22:45") - `"T"` — long time (e.g. "22:45:00") - Combinations: `"wD"`, `"dt"`, `"wDT"`, `"Dt"`, etc. | #### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts dateTime("soon", 1740787200, "r") // relative: "in 2 days" dateTime("17.03.22", 1740787200, "d") // short date dateTime("March 17", 1740787200, "D") // long date dateTime("22:45", 1740787200, "t") // short time dateTime("22:45:00", 1740787200, "T") // long time dateTime("Thu, March 17", 1740787200, "wD") // weekday + long date dateTime("March 17, 22:45", 1740787200, "Dt") // long date + short time format`Event starts ${dateTime("March 17 at 22:45", 1740787200, "DT")}` ``` ![dateTime](https://gramio.dev/formatting/date_time.png) *** ### expandableBlockquote() > `const` **expandableBlockquote**: {(`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md); (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md); } Defined in: format/index.d.ts:117 Format text as expandable blockquote. Cannot be nested. #### Call Signature > (`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Call Signature > (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `strings` | `TemplateStringsArray` | | ...`values` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts blockquote`test` format`test ${expandableBlockquote(bold("GramIO"))}` format`Format text as ${expandableBlockquote`blockquote`}`; ``` ![blockquote](https://gramio.dev/formatting/expandable_blockquote.png) *** ### FormattableMap > `const` **FormattableMap**: `FormattableMethods` Defined in: format/index.d.ts:14 A set of methods that decompose the [FormattableString](../../../gramio/classes/FormattableString.md) into a string and an array of [entities](https://core.telegram.org/bots/api#messageentity) for further sending to the Telegram Bot API #### Codegenerated *** ### italic() > `const` **italic**: {(`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md); (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md); } Defined in: format/index.d.ts:47 Format text as *italic*. Cannot be combined with `code` and `pre`. #### Call Signature > (`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Call Signature > (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `strings` | `TemplateStringsArray` | | ...`values` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts italic`test` format`test ${italic(bold("GramIO"))}` format`Format text as ${italic`italic`}`; ``` ![italic](https://gramio.dev/formatting/italic.png) *** ### link() > `const` **link**: (`str`, `url`) => [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:161 Format text as [link](https://github.com/gramiojs/gramio). Cannot be combined with `code` and `pre`. #### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | `null` | `undefined` | | `url` | `string` | #### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts link("test", "https://...") format`test ${bold(link("GramIO", "https://github.com/gramiojs/gramio"))}` format`Format text as ${link("link", "https://github.com/gramiojs/gramio")}`; ``` ![link](https://gramio.dev/formatting/link.png) *** ### mention() > `const` **mention**: (`str`, `user`) => [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:171 Format text as mention. Cannot be combined with `code` and `pre`. #### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | `null` | `undefined` | | `user` | [`TelegramUser`](../../../gramio/interfaces/TelegramUser.md) | #### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts mention("friend", { id: 228, is_bot: false, first_name: "GramIO"}) format`test ${mention("friend", { id: 228, is_bot: false, first_name: "GramIO"})}` ``` ![mention](https://gramio.dev/formatting/mention.png) *** ### pre() > `const` **pre**: (`str`, `language?`) => [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:150 Format text as `pre`. Cannot be combined with any other format. #### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | `null` | `undefined` | | `language?` | `string` | #### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts pre`test` format`test ${pre(`console.log("GramIO")`, "js")}` ``` pre with language result is ```js console.log("GramIO") ``` [Supported languages](https://github.com/TelegramMessenger/libprisma#supported-languages) ![pre](https://gramio.dev/formatting/pre.png) *** ### spoiler() > `const` **spoiler**: {(`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md); (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md); } Defined in: format/index.d.ts:89 Format text as spoiler. Cannot be combined with `code` and `pre`. #### Call Signature > (`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Call Signature > (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `strings` | `TemplateStringsArray` | | ...`values` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts spoiler`test` format`test ${spoiler(bold("GramIO"))}` format`Format text as ${spoiler`spoiler`}`; ``` ![spoiler](https://gramio.dev/formatting/spoiler.png) *** ### strikethrough() > `const` **strikethrough**: {(`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md); (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md); } Defined in: format/index.d.ts:75 Format text as ~~strikethrough~~. Cannot be combined with `code` and `pre`. #### Call Signature > (`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Call Signature > (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `strings` | `TemplateStringsArray` | | ...`values` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts strikethrough`test` format`test ${strikethrough(bold("GramIO"))}` format`Format text as ${strikethrough`strikethrough`}`; ``` ![](https://gramio.dev/formatting/strikethrough.png) *** ### underline() > `const` **underline**: {(`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md); (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md); } Defined in: format/index.d.ts:61 Format text as underline. Cannot be combined with `code` and `pre`. #### Call Signature > (`str`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `str` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Call Signature > (`strings`, ...`values`): [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Parameters | Parameter | Type | | ------ | ------ | | `strings` | `TemplateStringsArray` | | ...`values` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts underline`test` format`test ${underline(bold("GramIO"))}` format`Format text as ${underline`underline`}`; ``` ![underline](https://gramio.dev/formatting/underline.png) ## Functions ### format() > **format**(`stringParts`, ...`strings`): [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:249 [Template literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) that helps construct message [entities](https://core.telegram.org/bots/api#messageentity) for text formatting. [Documentation](https://gramio.dev/formatting/) Use if you want to strip all of the indentation from the beginning of each line. **NOTE**: for format with **arrays** use it with [join](#join) helper - ```ts format`${join(["test", "other"], (x) => format`${bold(x)}`, "\n")}` ``` #### Parameters | Parameter | Type | | ------ | ------ | | `stringParts` | `TemplateStringsArray` | | ...`strings` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | #### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts bot.api.sendMessage({ chat_id: 12321, text: format`${bold`Hi!`} Can ${italic(`you`)} help ${spoiler`me`}? Can you give me a ${link("star", "https://github.com/gramiojs/gramio")}?` }) ``` ![format](https://gramio.dev/formatting/format.png) *** ### formatSaveIndents() > **formatSaveIndents**(`stringParts`, ...`strings`): [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:275 [Template literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) that helps construct message [entities](https://core.telegram.org/bots/api#messageentity) for text formatting. ``` [Documentation](https://gramio.dev/formatting/) ``` Use if you want to save all of the indentation. **NOTE**: for format with **arrays** use it with [join](#join) helper - ```ts format`${join(["test", "other"], (x) => format`${bold(x)}`, "\n")}` ``` #### Parameters | Parameter | Type | | ------ | ------ | | `stringParts` | `TemplateStringsArray` | | ...`strings` | [`Stringable`](../../../gramio/type-aliases/Stringable.md)\[] | #### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) #### Example ```ts bot.api.sendMessage({ chat_id: 12321, text: format`${bold`Hi!`} Can ${italic(`you`)} help ${spoiler`me`}? Can you give me a ${link("star", "https://github.com/gramiojs/gramio")}?` }) ``` ![formatSaveIndents](https://gramio.dev/formatting/format-save-indents.png) *** ### join() #### Call Signature > **join**(`array`, `separator?`): [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:222 Helper for great work with formattable arrays. (\[].join break styling) Separator by default is `, ` ##### Parameters | Parameter | Type | | ------ | ------ | | `array` | (`false` | [`Stringable`](../../../gramio/type-aliases/Stringable.md))\[] | | `separator?` | `string` | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Example ```ts join([format`hello`, format`world`], "\n") format`${join(["test", "other"], (x) => format`${bold(x)}`, "\n")}` ``` #### Call Signature > **join**<`T`>(`array`, `iterator`, `separator?`): [`FormattableString`](../../../gramio/classes/FormattableString.md) Defined in: format/index.d.ts:223 Helper for great work with formattable arrays. (\[].join break styling) Separator by default is `, ` ##### Type Parameters | Type Parameter | | ------ | | `T` | ##### Parameters | Parameter | Type | | ------ | ------ | | `array` | `T`\[] | | `iterator` | (`item`, `index`) => `false` | [`Stringable`](../../../gramio/type-aliases/Stringable.md) | | `separator?` | `string` | ##### Returns [`FormattableString`](../../../gramio/classes/FormattableString.md) ##### Example ```ts join([format`hello`, format`world`], "\n") format`${join(["test", "other"], (x) => format`${bold(x)}`, "\n")}` ``` ## References ### FormattableString Re-exports [FormattableString](../../../gramio/classes/FormattableString.md) *** ### getFormattable Re-exports [getFormattable](../../../gramio/index.md#getformattable) *** ### Stringable Re-exports [Stringable](../../../gramio/type-aliases/Stringable.md) --- --- url: 'https://gramio.dev/api/i18n.md' --- [GramIO API Reference](../../../index.md) / @gramio/i18n/dist # @gramio/i18n/dist ## Interfaces | Interface | Description | | ------ | ------ | | [I18nOptions](interfaces/I18nOptions.md) | - | | [LanguageMap](interfaces/LanguageMap.md) | - | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [ExtractArgsParams](type-aliases/ExtractArgsParams.md) | - | | [ExtractItemValue](type-aliases/ExtractItemValue.md) | - | | [ExtractLanguages](type-aliases/ExtractLanguages.md) | - | | [GetI18nKeys](type-aliases/GetI18nKeys.md) | - | | [GetI18nParams](type-aliases/GetI18nParams.md) | - | | [GetValueNested](type-aliases/GetValueNested.md) | - | | [LanguagesMap](type-aliases/LanguagesMap.md) | - | | [LocaleArgs](type-aliases/LocaleArgs.md) | - | | [LocaleItem](type-aliases/LocaleItem.md) | - | | [LocaleValue](type-aliases/LocaleValue.md) | - | | [NestedKeysDelimited](type-aliases/NestedKeysDelimited.md) | - | | [ShouldFollowLanguage](type-aliases/ShouldFollowLanguage.md) | - | | [ShouldFollowLanguageStrict](type-aliases/ShouldFollowLanguageStrict.md) | - | | [SoftString](type-aliases/SoftString.md) | - | ## Functions ### defineI18n() > **defineI18n**<`Languages`, `PrimaryLanguage`>(`__namedParameters`): `object` Defined in: i18n/index.d.ts:41 #### Type Parameters | Type Parameter | | ------ | | `Languages` *extends* [`LanguagesMap`](type-aliases/LanguagesMap.md) | | `PrimaryLanguage` *extends* `string` | `number` | `symbol` | #### Parameters | Parameter | Type | | ------ | ------ | | `__namedParameters` | [`I18nOptions`](interfaces/I18nOptions.md)<`Languages`, `PrimaryLanguage`> | #### Returns `object` | Name | Type | Defined in | | ------ | ------ | ------ | | `_` | `object` | i18n/index.d.ts:46 | | `_.languages` | `Languages` | i18n/index.d.ts:47 | | `_.primaryLanguage` | `PrimaryLanguage` | i18n/index.d.ts:48 | | `buildT()` | <`Language`>(`language?`) => <`Key`, `Item`, `FallbackItem`>(`key`, ...`args`) => [`ExtractItemValue`](type-aliases/ExtractItemValue.md)<`Item`, `FallbackItem`> | i18n/index.d.ts:45 | | `languages` | keyof `Languages`\[] | i18n/index.d.ts:43 | | `primaryLanguage` | `PrimaryLanguage` | i18n/index.d.ts:44 | | `t()` | <`Language`, `Key`, `Item`, `FallbackItem`>(`language`, `key`, ...`args`) => [`ExtractItemValue`](type-aliases/ExtractItemValue.md)<`Item`, `FallbackItem`> | i18n/index.d.ts:42 | *** ### pluralizeEnglish() > **pluralizeEnglish**<`T`>(`n`, `one`, `many`): `T` Defined in: i18n/index.d.ts:37 #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `n` | `number` | | `one` | `T` | | `many` | `T` | #### Returns `T` *** ### pluralizeRussian() > **pluralizeRussian**<`T`>(`count`, `one`, `few`, `many`): `T` Defined in: i18n/index.d.ts:39 #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `count` | `number` | | `one` | `T` | | `few` | `T` | | `many` | `T` | #### Returns `T` --- --- url: 'https://gramio.dev/api/init-data.md' --- [GramIO API Reference](../../../index.md) / @gramio/init-data/dist # @gramio/init-data/dist ## Interfaces | Interface | Description | | ------ | ------ | | [WebAppChat](interfaces/WebAppChat.md) | This object represents a chat. | | [WebAppInitData](interfaces/WebAppInitData.md) | This object contains data that is transferred to the Mini App when it is opened. It is empty if the Mini App was launched from a [keyboard button](https://core.telegram.org/bots/webapps#keyboard-button-mini-apps) or from [inline mode](https://core.telegram.org/bots/webapps#inline-mode-mini-apps). | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [MakeOptional](type-aliases/MakeOptional.md) | - | | [Optional](type-aliases/Optional.md) | - | | [WebAppChatType](type-aliases/WebAppChatType.md) | Known type of chat. | | [WebAppUser](type-aliases/WebAppUser.md) | This object contains the data of the Mini App user. | ## Variables ### sha256Hash() > `const` **sha256Hash**: (`hmacKey`, `input`, `encoding?`) => `string` Defined in: init-data/index.d.ts:142 #### Parameters | Parameter | Type | | ------ | ------ | | `hmacKey` | `string` | `Buffer` | | `input` | `string` | | `encoding?` | `BinaryToTextEncoding` | #### Returns `string` ## Functions ### getBotTokenSecretKey() > **getBotTokenSecretKey**(`botToken`): `Buffer`<`ArrayBufferLike`> Defined in: init-data/index.d.ts:143 #### Parameters | Parameter | Type | | ------ | ------ | | `botToken` | `string` | #### Returns `Buffer`<`ArrayBufferLike`> *** ### parseInitData() > **parseInitData**(`query`): [`WebAppInitData`](interfaces/WebAppInitData.md) Defined in: init-data/index.d.ts:146 #### Parameters | Parameter | Type | | ------ | ------ | | `query` | `string` | #### Returns [`WebAppInitData`](interfaces/WebAppInitData.md) *** ### parseJSON() > **parseJSON**<`T`>(`value`): `T` Defined in: init-data/index.d.ts:141 #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `value` | `string` | #### Returns `T` *** ### serializeInitData() > **serializeInitData**(`data`): `URLSearchParams` Defined in: init-data/index.d.ts:144 #### Parameters | Parameter | Type | | ------ | ------ | | `data` | [`MakeOptional`](type-aliases/MakeOptional.md)<[`WebAppInitData`](interfaces/WebAppInitData.md), `"hash"` | `"auth_date"`> | #### Returns `URLSearchParams` *** ### signInitData() #### Call Signature > **signInitData**(`initData`, `secretKeyOrToken`): `string` Defined in: init-data/index.d.ts:150 ##### Parameters | Parameter | Type | | ------ | ------ | | `initData` | `string` | | `secretKeyOrToken` | `string` | `Buffer`<`ArrayBufferLike`> | ##### Returns `string` #### Call Signature > **signInitData**(`initData`, `secretKeyOrToken`): `string` Defined in: init-data/index.d.ts:151 ##### Parameters | Parameter | Type | | ------ | ------ | | `initData` | [`MakeOptional`](type-aliases/MakeOptional.md)<[`WebAppInitData`](interfaces/WebAppInitData.md), `"hash"` | `"auth_date"`> | | `secretKeyOrToken` | `string` | `Buffer`<`ArrayBufferLike`> | ##### Returns `string` *** ### validateAndParseInitData() > **validateAndParseInitData**(`query`, `token`): `false` | [`WebAppInitData`](interfaces/WebAppInitData.md) Defined in: init-data/index.d.ts:148 #### Parameters | Parameter | Type | | ------ | ------ | | `query` | `string` | | `token` | `string` | `Buffer`<`ArrayBufferLike`> | #### Returns `false` | [`WebAppInitData`](interfaces/WebAppInitData.md) *** ### validateInitData() > **validateInitData**(`webAppInitData`, `token`): `boolean` Defined in: init-data/index.d.ts:147 #### Parameters | Parameter | Type | | ------ | ------ | | `webAppInitData` | `string` | | `token` | `string` | `Buffer`<`ArrayBufferLike`> | #### Returns `boolean` --- --- url: 'https://gramio.dev/api/keyboards.md' --- [GramIO API Reference](../../../index.md) / @gramio/keyboards/dist # @gramio/keyboards/dist ## Classes | Class | Description | | ------ | ------ | | [BaseKeyboardConstructor](classes/BaseKeyboardConstructor.md) | Base-class for construct keyboard with useful helpers | | [ForceReplyKeyboard](classes/ForceReplyKeyboard.md) | **ForceReply** builder | | [InlineKeyboard](classes/InlineKeyboard.md) | **InlineKeyboardMarkup** builder | | [InlineQueryResult](classes/InlineQueryResult.md) | Result of InlineQuery builder. | | [InputMessageContent](classes/InputMessageContent.md) | This object represents the content of a message to be sent as a result of an inline query. | | [Keyboard](classes/Keyboard.md) | **ReplyKeyboardMarkup** builder | | [RemoveKeyboard](classes/RemoveKeyboard.md) | **ReplyKeyboardRemove** builder | ## Interfaces | Interface | Description | | ------ | ------ | | [ButtonOptions](interfaces/ButtonOptions.md) | - | | [KeyboardFeatureFlags](interfaces/KeyboardFeatureFlags.md) | - | | [KeyboardHelperColumns](interfaces/KeyboardHelperColumns.md) | - | | [KeyboardHelperFilter](interfaces/KeyboardHelperFilter.md) | - | | [KeyboardHelperPattern](interfaces/KeyboardHelperPattern.md) | - | | [KeyboardHelperWrap](interfaces/KeyboardHelperWrap.md) | - | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [ButtonsIterator](type-aliases/ButtonsIterator.md) | - | | [CreateButtonIterator](type-aliases/CreateButtonIterator.md) | - | | [KeyboardHelpers](type-aliases/KeyboardHelpers.md) | - | ## Variables ### keyboardsFeatureFlagsMap > `const` **keyboardsFeatureFlagsMap**: [`KeyboardFeatureFlags`](interfaces/KeyboardFeatureFlags.md) Defined in: keyboards/index.d.ts:10 ## Functions ### chunk() > **chunk**<`T`>(`array`, `size`): `T`\[]\[] Defined in: keyboards/index.d.ts:38 #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `array` | `T`\[]\[] | | `size` | `number` | #### Returns `T`\[]\[] *** ### customWrap() > **customWrap**<`T`>(`array`, `fn`): `T`\[]\[] Defined in: keyboards/index.d.ts:39 #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `array` | `T`\[]\[] | | `fn` | [`ButtonsIterator`](type-aliases/ButtonsIterator.md)<`T`> | #### Returns `T`\[]\[] *** ### filter() > **filter**<`T`>(`array`, `fn`): `T`\[]\[] Defined in: keyboards/index.d.ts:41 #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `array` | `T`\[]\[] | | `fn` | [`ButtonsIterator`](type-aliases/ButtonsIterator.md)<`T`> | #### Returns `T`\[]\[] *** ### pattern() > **pattern**<`T`>(`array`, `pattern`): `T`\[]\[] Defined in: keyboards/index.d.ts:40 #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `array` | `T`\[]\[] | | `pattern` | `number`\[] | #### Returns `T`\[]\[] --- --- url: 'https://gramio.dev/api/prompt.md' --- [GramIO API Reference](../../../index.md) / @gramio/prompt/dist # @gramio/prompt/dist ## Interfaces | Interface | Description | | ------ | ------ | | [PromptFunction](interfaces/PromptFunction.md) | Send message and wait answer | | [PromptFunctionParams](interfaces/PromptFunctionParams.md) | Make some keys optional | | [PromptOptions](interfaces/PromptOptions.md) | - | | [PromptPluginTypes](interfaces/PromptPluginTypes.md) | - | | [WaitFunction](interfaces/WaitFunction.md) | Wait for the next event from the user | | [WaitWithActionFunction](interfaces/WaitWithActionFunction.md) | - | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [EventsUnion](type-aliases/EventsUnion.md) | - | | [MaybeArray](type-aliases/MaybeArray.md) | - | | [OnValidateErrorFunction](type-aliases/OnValidateErrorFunction.md) | - | | [PromptAnswer](type-aliases/PromptAnswer.md) | - | | [PromptsType](type-aliases/PromptsType.md) | - | | [Stringable](type-aliases/Stringable.md) | - | | [TimeoutStrategy](type-aliases/TimeoutStrategy.md) | - | | [TransformFunction](type-aliases/TransformFunction.md) | - | | [ValidateFunction](type-aliases/ValidateFunction.md) | - | ## Functions ### prompt() > **prompt**<`GlobalData`>(`options?`): [`Plugin`](../../../gramio/classes/Plugin.md)<{ `prompt-cancel`: `PromptCancelError`; }, [`DeriveDefinitions`](../../../gramio/type-aliases/DeriveDefinitions.md) & `object`> Defined in: prompt/index.d.ts:153 Prompt plugin #### Type Parameters | Type Parameter | Default type | | ------ | ------ | | `GlobalData` | `never` | #### Parameters | Parameter | Type | | ------ | ------ | | `options?` | [`PromptOptions`](interfaces/PromptOptions.md)<`GlobalData`> | #### Returns [`Plugin`](../../../gramio/classes/Plugin.md)<{ `prompt-cancel`: `PromptCancelError`; }, [`DeriveDefinitions`](../../../gramio/type-aliases/DeriveDefinitions.md) & `object`> #### Example ```ts import { Bot, format, bold } from "gramio"; import { prompt } from "@gramio/prompt"; const bot = new Bot(process.env.token!) .extend(prompt()) .command("start", async (context) => { const answer = await context.prompt( "message", format`What's your ${bold`name`}?` ); return context.send(`✨ Your name is ${answer.text}`); }) .onStart(console.log); bot.start(); ``` --- --- url: 'https://gramio.dev/api/scenes.md' --- [GramIO API Reference](../../../index.md) / @gramio/scenes/dist # @gramio/scenes/dist ## Classes | Class | Description | | ------ | ------ | | [Scene](classes/Scene.md) | - | ## Interfaces | Interface | Description | | ------ | ------ | | [EnterExit](interfaces/EnterExit.md) | - | | [InActiveSceneHandlerReturn](interfaces/InActiveSceneHandlerReturn.md) | - | | [InUnknownScene](interfaces/InUnknownScene.md) | - | | [ParentSceneFrame](interfaces/ParentSceneFrame.md) | - | | [PossibleInUnknownScene](interfaces/PossibleInUnknownScene.md) | - | | [ScenesOptions](interfaces/ScenesOptions.md) | - | | [ScenesStorageData](interfaces/ScenesStorageData.md) | - | | [SceneUpdateState](interfaces/SceneUpdateState.md) | - | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [AnyScene](type-aliases/AnyScene.md) | - | | [Modify](type-aliases/Modify.md) | - | | [SceneDerivesDefinitions](type-aliases/SceneDerivesDefinitions.md) | - | | [SceneEnterHandler](type-aliases/SceneEnterHandler.md) | - | | [ScenesStorage](type-aliases/ScenesStorage.md) | - | | [SceneStepReturn](type-aliases/SceneStepReturn.md) | - | | [StateTypesDefault](type-aliases/StateTypesDefault.md) | - | | [StepHandler](type-aliases/StepHandler.md) | - | | [UpdateData](type-aliases/UpdateData.md) | - | ## Functions ### scenes() > **scenes**(`scenes`, `options?`): [`Plugin`](../../../gramio/classes/Plugin.md)<{ }, [`DeriveDefinitions`](../../../gramio/type-aliases/DeriveDefinitions.md) & `object`, { }> Defined in: scenes/index.d.ts:789 #### Parameters | Parameter | Type | | ------ | ------ | | `scenes` | [`AnyScene`](type-aliases/AnyScene.md)\[] | | `options?` | [`ScenesOptions`](interfaces/ScenesOptions.md) | #### Returns [`Plugin`](../../../gramio/classes/Plugin.md)<{ }, [`DeriveDefinitions`](../../../gramio/type-aliases/DeriveDefinitions.md) & `object`, { }> *** ### scenesDerives() > **scenesDerives**<`WithCurrentScene`>(`scenesOrOptions`, `optionsRaw?`): [`EventComposer`](../../composer/dist/interfaces/EventComposer.md)<[`Context`](../../contexts/dist/classes/Context.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, { `boost_added`: [`BoostAddedContext`](../../contexts/dist/classes/BoostAddedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `business_connection`: [`BusinessConnectionContext`](../../contexts/dist/classes/BusinessConnectionContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `business_message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `callback_query`: [`CallbackQueryContext`](../../contexts/dist/classes/CallbackQueryContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `channel_post`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_background_set`: [`ChatBackgroundSetContext`](../../contexts/dist/classes/ChatBackgroundSetContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_boost`: [`ChatBoostContext`](../../contexts/dist/classes/ChatBoostContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_join_request`: [`ChatJoinRequestContext`](../../contexts/dist/classes/ChatJoinRequestContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_member`: [`ChatMemberContext`](../../contexts/dist/classes/ChatMemberContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_owner_changed`: [`ChatOwnerChangedContext`](../../contexts/dist/classes/ChatOwnerChangedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_owner_left`: [`ChatOwnerLeftContext`](../../contexts/dist/classes/ChatOwnerLeftContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_shared`: [`ChatSharedContext`](../../contexts/dist/classes/ChatSharedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `checklist_tasks_added`: [`ChecklistTasksAddedContext`](../../contexts/dist/classes/ChecklistTasksAddedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `checklist_tasks_done`: [`ChecklistTasksDoneContext`](../../contexts/dist/classes/ChecklistTasksDoneContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chosen_inline_result`: [`ChosenInlineResultContext`](../../contexts/dist/classes/ChosenInlineResultContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `delete_chat_photo`: [`DeleteChatPhotoContext`](../../contexts/dist/classes/DeleteChatPhotoContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `deleted_business_messages`: [`BusinessMessagesDeletedContext`](../../contexts/dist/classes/BusinessMessagesDeletedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `direct_message_price_changed`: [`DirectMessagePriceChangedContext`](../../contexts/dist/classes/DirectMessagePriceChangedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `edited_business_message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `edited_channel_post`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `edited_message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `forum_topic_closed`: [`ForumTopicClosedContext`](../../contexts/dist/classes/ForumTopicClosedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `forum_topic_created`: [`ForumTopicCreatedContext`](../../contexts/dist/classes/ForumTopicCreatedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `forum_topic_edited`: [`ForumTopicEditedContext`](../../contexts/dist/classes/ForumTopicEditedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `forum_topic_reopened`: [`ForumTopicReopenedContext`](../../contexts/dist/classes/ForumTopicReopenedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `general_forum_topic_hidden`: [`GeneralForumTopicHiddenContext`](../../contexts/dist/classes/GeneralForumTopicHiddenContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `general_forum_topic_unhidden`: [`GeneralForumTopicUnhiddenContext`](../../contexts/dist/classes/GeneralForumTopicUnhiddenContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `gift`: [`GiftContext`](../../contexts/dist/classes/GiftContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `gift_upgrade_sent`: [`GiftUpgradeSentContext`](../../contexts/dist/classes/GiftUpgradeSentContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `giveaway_completed`: [`GiveawayCompletedContext`](../../contexts/dist/classes/GiveawayCompletedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `giveaway_created`: [`GiveawayCreatedContext`](../../contexts/dist/classes/GiveawayCreatedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `giveaway_winners`: [`GiveawayWinnersContext`](../../contexts/dist/classes/GiveawayWinnersContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `group_chat_created`: [`GroupChatCreatedContext`](../../contexts/dist/classes/GroupChatCreatedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `inline_query`: [`InlineQueryContext`](../../contexts/dist/classes/InlineQueryContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `invoice`: [`InvoiceContext`](../../contexts/dist/classes/InvoiceContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `left_chat_member`: [`LeftChatMemberContext`](../../contexts/dist/classes/LeftChatMemberContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `location`: [`LocationContext`](../../contexts/dist/classes/LocationContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `message_auto_delete_timer_changed`: [`MessageAutoDeleteTimerChangedContext`](../../contexts/dist/classes/MessageAutoDeleteTimerChangedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `message_reaction`: [`MessageReactionContext`](../../contexts/dist/classes/MessageReactionContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `message_reaction_count`: [`MessageReactionCountContext`](../../contexts/dist/classes/MessageReactionCountContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `migrate_from_chat_id`: [`MigrateFromChatIdContext`](../../contexts/dist/classes/MigrateFromChatIdContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `migrate_to_chat_id`: [`MigrateToChatIdContext`](../../contexts/dist/classes/MigrateToChatIdContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `my_chat_member`: [`ChatMemberContext`](../../contexts/dist/classes/ChatMemberContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `new_chat_members`: [`NewChatMembersContext`](../../contexts/dist/classes/NewChatMembersContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `new_chat_photo`: [`NewChatPhotoContext`](../../contexts/dist/classes/NewChatPhotoContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `new_chat_title`: [`NewChatTitleContext`](../../contexts/dist/classes/NewChatTitleContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `paid_message_price_changed`: [`PaidMessagePriceChangedContext`](../../contexts/dist/classes/PaidMessagePriceChangedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `passport_data`: [`PassportDataContext`](../../contexts/dist/classes/PassportDataContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `pinned_message`: [`PinnedMessageContext`](../../contexts/dist/classes/PinnedMessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `poll`: [`PollContext`](../../contexts/dist/classes/PollContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `poll_answer`: [`PollAnswerContext`](../../contexts/dist/classes/PollAnswerContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `pre_checkout_query`: [`PreCheckoutQueryContext`](../../contexts/dist/classes/PreCheckoutQueryContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `proximity_alert_triggered`: [`ProximityAlertTriggeredContext`](../../contexts/dist/classes/ProximityAlertTriggeredContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `purchased_paid_media`: [`PaidMediaPurchasedContext`](../../contexts/dist/classes/PaidMediaPurchasedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `refunded_payment`: [`RefundedPaymentContext`](../../contexts/dist/classes/RefundedPaymentContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `removed_chat_boost`: [`RemovedChatBoostContext`](../../contexts/dist/classes/RemovedChatBoostContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `service_message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `shipping_query`: [`ShippingQueryContext`](../../contexts/dist/classes/ShippingQueryContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `successful_payment`: [`SuccessfulPaymentContext`](../../contexts/dist/classes/SuccessfulPaymentContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_approval_failed`: [`SuggestedPostApprovalFailedContext`](../../contexts/dist/classes/SuggestedPostApprovalFailedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_approved`: [`SuggestedPostApprovedContext`](../../contexts/dist/classes/SuggestedPostApprovedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_declined`: [`SuggestedPostDeclinedContext`](../../contexts/dist/classes/SuggestedPostDeclinedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_paid`: [`SuggestedPostPaidContext`](../../contexts/dist/classes/SuggestedPostPaidContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_refunded`: [`SuggestedPostRefundedContext`](../../contexts/dist/classes/SuggestedPostRefundedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `unique_gift`: [`UniqueGiftContext`](../../contexts/dist/classes/UniqueGiftContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `users_shared`: [`UsersSharedContext`](../../contexts/dist/classes/UsersSharedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `video_chat_ended`: [`VideoChatEndedContext`](../../contexts/dist/classes/VideoChatEndedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `video_chat_participants_invited`: [`VideoChatParticipantsInvitedContext`](../../contexts/dist/classes/VideoChatParticipantsInvitedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `video_chat_scheduled`: [`VideoChatScheduledContext`](../../contexts/dist/classes/VideoChatScheduledContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `video_chat_started`: [`VideoChatStartedContext`](../../contexts/dist/classes/VideoChatStartedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `web_app_data`: [`WebAppDataContext`](../../contexts/dist/classes/WebAppDataContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `write_access_allowed`: [`WriteAccessAllowedContext`](../../contexts/dist/classes/WriteAccessAllowedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; }, [`Context`](../../contexts/dist/classes/Context.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, [`Context`](../../contexts/dist/classes/Context.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, { }, { `callback_query`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `channel_post`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `chat_join_request`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `chat_shared`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `chosen_inline_result`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `delete_chat_photo`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `group_chat_created`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `inline_query`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `invoice`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `location`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `message`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `message_auto_delete_timer_changed`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `migrate_from_chat_id`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `migrate_to_chat_id`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `new_chat_members`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `new_chat_photo`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `new_chat_title`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `passport_data`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `pinned_message`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `pre_checkout_query`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `proximity_alert_triggered`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `shipping_query`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `successful_payment`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `users_shared`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `video_chat_ended`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `video_chat_participants_invited`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `video_chat_scheduled`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `video_chat_started`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `web_app_data`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; }, { `callbackQuery`: `TThis`; `chosenInlineResult`: `TThis`; `command`: `TThis`; `hears`: `TThis`; `inlineQuery`: `TThis`; `reaction`: `TThis`; `startParameter`: `TThis`; }, { }> & `object` Defined in: scenes/index.d.ts:494 #### Type Parameters | Type Parameter | Default type | | ------ | ------ | | `WithCurrentScene` *extends* `boolean` | `false` | #### Parameters | Parameter | Type | | ------ | ------ | | `scenesOrOptions` | [`AnyScene`](type-aliases/AnyScene.md)\[] | `ScenesDerivesOptions`<`WithCurrentScene`> | | `optionsRaw?` | `ScenesDerivesOptions`<`WithCurrentScene`> | #### Returns [`EventComposer`](../../composer/dist/interfaces/EventComposer.md)<[`Context`](../../contexts/dist/classes/Context.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, { `boost_added`: [`BoostAddedContext`](../../contexts/dist/classes/BoostAddedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `business_connection`: [`BusinessConnectionContext`](../../contexts/dist/classes/BusinessConnectionContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `business_message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `callback_query`: [`CallbackQueryContext`](../../contexts/dist/classes/CallbackQueryContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `channel_post`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_background_set`: [`ChatBackgroundSetContext`](../../contexts/dist/classes/ChatBackgroundSetContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_boost`: [`ChatBoostContext`](../../contexts/dist/classes/ChatBoostContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_join_request`: [`ChatJoinRequestContext`](../../contexts/dist/classes/ChatJoinRequestContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_member`: [`ChatMemberContext`](../../contexts/dist/classes/ChatMemberContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_owner_changed`: [`ChatOwnerChangedContext`](../../contexts/dist/classes/ChatOwnerChangedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_owner_left`: [`ChatOwnerLeftContext`](../../contexts/dist/classes/ChatOwnerLeftContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chat_shared`: [`ChatSharedContext`](../../contexts/dist/classes/ChatSharedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `checklist_tasks_added`: [`ChecklistTasksAddedContext`](../../contexts/dist/classes/ChecklistTasksAddedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `checklist_tasks_done`: [`ChecklistTasksDoneContext`](../../contexts/dist/classes/ChecklistTasksDoneContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `chosen_inline_result`: [`ChosenInlineResultContext`](../../contexts/dist/classes/ChosenInlineResultContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `delete_chat_photo`: [`DeleteChatPhotoContext`](../../contexts/dist/classes/DeleteChatPhotoContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `deleted_business_messages`: [`BusinessMessagesDeletedContext`](../../contexts/dist/classes/BusinessMessagesDeletedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `direct_message_price_changed`: [`DirectMessagePriceChangedContext`](../../contexts/dist/classes/DirectMessagePriceChangedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `edited_business_message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `edited_channel_post`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `edited_message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `forum_topic_closed`: [`ForumTopicClosedContext`](../../contexts/dist/classes/ForumTopicClosedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `forum_topic_created`: [`ForumTopicCreatedContext`](../../contexts/dist/classes/ForumTopicCreatedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `forum_topic_edited`: [`ForumTopicEditedContext`](../../contexts/dist/classes/ForumTopicEditedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `forum_topic_reopened`: [`ForumTopicReopenedContext`](../../contexts/dist/classes/ForumTopicReopenedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `general_forum_topic_hidden`: [`GeneralForumTopicHiddenContext`](../../contexts/dist/classes/GeneralForumTopicHiddenContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `general_forum_topic_unhidden`: [`GeneralForumTopicUnhiddenContext`](../../contexts/dist/classes/GeneralForumTopicUnhiddenContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `gift`: [`GiftContext`](../../contexts/dist/classes/GiftContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `gift_upgrade_sent`: [`GiftUpgradeSentContext`](../../contexts/dist/classes/GiftUpgradeSentContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `giveaway_completed`: [`GiveawayCompletedContext`](../../contexts/dist/classes/GiveawayCompletedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `giveaway_created`: [`GiveawayCreatedContext`](../../contexts/dist/classes/GiveawayCreatedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `giveaway_winners`: [`GiveawayWinnersContext`](../../contexts/dist/classes/GiveawayWinnersContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `group_chat_created`: [`GroupChatCreatedContext`](../../contexts/dist/classes/GroupChatCreatedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `inline_query`: [`InlineQueryContext`](../../contexts/dist/classes/InlineQueryContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `invoice`: [`InvoiceContext`](../../contexts/dist/classes/InvoiceContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `left_chat_member`: [`LeftChatMemberContext`](../../contexts/dist/classes/LeftChatMemberContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `location`: [`LocationContext`](../../contexts/dist/classes/LocationContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)> & [`Require`](../../contexts/dist/type-aliases/Require.md)<[`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, `"from"`>; `message_auto_delete_timer_changed`: [`MessageAutoDeleteTimerChangedContext`](../../contexts/dist/classes/MessageAutoDeleteTimerChangedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `message_reaction`: [`MessageReactionContext`](../../contexts/dist/classes/MessageReactionContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `message_reaction_count`: [`MessageReactionCountContext`](../../contexts/dist/classes/MessageReactionCountContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `migrate_from_chat_id`: [`MigrateFromChatIdContext`](../../contexts/dist/classes/MigrateFromChatIdContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `migrate_to_chat_id`: [`MigrateToChatIdContext`](../../contexts/dist/classes/MigrateToChatIdContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `my_chat_member`: [`ChatMemberContext`](../../contexts/dist/classes/ChatMemberContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `new_chat_members`: [`NewChatMembersContext`](../../contexts/dist/classes/NewChatMembersContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `new_chat_photo`: [`NewChatPhotoContext`](../../contexts/dist/classes/NewChatPhotoContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `new_chat_title`: [`NewChatTitleContext`](../../contexts/dist/classes/NewChatTitleContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `paid_message_price_changed`: [`PaidMessagePriceChangedContext`](../../contexts/dist/classes/PaidMessagePriceChangedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `passport_data`: [`PassportDataContext`](../../contexts/dist/classes/PassportDataContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `pinned_message`: [`PinnedMessageContext`](../../contexts/dist/classes/PinnedMessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `poll`: [`PollContext`](../../contexts/dist/classes/PollContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `poll_answer`: [`PollAnswerContext`](../../contexts/dist/classes/PollAnswerContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `pre_checkout_query`: [`PreCheckoutQueryContext`](../../contexts/dist/classes/PreCheckoutQueryContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `proximity_alert_triggered`: [`ProximityAlertTriggeredContext`](../../contexts/dist/classes/ProximityAlertTriggeredContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `purchased_paid_media`: [`PaidMediaPurchasedContext`](../../contexts/dist/classes/PaidMediaPurchasedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `refunded_payment`: [`RefundedPaymentContext`](../../contexts/dist/classes/RefundedPaymentContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `removed_chat_boost`: [`RemovedChatBoostContext`](../../contexts/dist/classes/RemovedChatBoostContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `service_message`: [`MessageContext`](../../contexts/dist/classes/MessageContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `shipping_query`: [`ShippingQueryContext`](../../contexts/dist/classes/ShippingQueryContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `successful_payment`: [`SuccessfulPaymentContext`](../../contexts/dist/classes/SuccessfulPaymentContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_approval_failed`: [`SuggestedPostApprovalFailedContext`](../../contexts/dist/classes/SuggestedPostApprovalFailedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_approved`: [`SuggestedPostApprovedContext`](../../contexts/dist/classes/SuggestedPostApprovedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_declined`: [`SuggestedPostDeclinedContext`](../../contexts/dist/classes/SuggestedPostDeclinedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_paid`: [`SuggestedPostPaidContext`](../../contexts/dist/classes/SuggestedPostPaidContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `suggested_post_refunded`: [`SuggestedPostRefundedContext`](../../contexts/dist/classes/SuggestedPostRefundedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `unique_gift`: [`UniqueGiftContext`](../../contexts/dist/classes/UniqueGiftContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `users_shared`: [`UsersSharedContext`](../../contexts/dist/classes/UsersSharedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `video_chat_ended`: [`VideoChatEndedContext`](../../contexts/dist/classes/VideoChatEndedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `video_chat_participants_invited`: [`VideoChatParticipantsInvitedContext`](../../contexts/dist/classes/VideoChatParticipantsInvitedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `video_chat_scheduled`: [`VideoChatScheduledContext`](../../contexts/dist/classes/VideoChatScheduledContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `video_chat_started`: [`VideoChatStartedContext`](../../contexts/dist/classes/VideoChatStartedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `web_app_data`: [`WebAppDataContext`](../../contexts/dist/classes/WebAppDataContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; `write_access_allowed`: [`WriteAccessAllowedContext`](../../contexts/dist/classes/WriteAccessAllowedContext.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>; }, [`Context`](../../contexts/dist/classes/Context.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, [`Context`](../../contexts/dist/classes/Context.md)<[`AnyBot`](../../../gramio/type-aliases/AnyBot.md)>, { }, { `callback_query`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `channel_post`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `chat_join_request`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `chat_shared`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `chosen_inline_result`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `delete_chat_photo`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `group_chat_created`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `inline_query`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `invoice`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `location`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `message`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `message_auto_delete_timer_changed`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `migrate_from_chat_id`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `migrate_to_chat_id`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `new_chat_members`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `new_chat_photo`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `new_chat_title`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `passport_data`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `pinned_message`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `pre_checkout_query`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `proximity_alert_triggered`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `shipping_query`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `successful_payment`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `users_shared`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `video_chat_ended`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `video_chat_participants_invited`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `video_chat_scheduled`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `video_chat_started`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; `web_app_data`: { `scene`: `WithCurrentScene` *extends* `true` ? [`PossibleInUnknownScene`](interfaces/PossibleInUnknownScene.md)<`any`, `any`, `null`> : [`EnterExit`](interfaces/EnterExit.md); }; }, { `callbackQuery`: `TThis`; `chosenInlineResult`: `TThis`; `command`: `TThis`; `hears`: `TThis`; `inlineQuery`: `TThis`; `reaction`: `TThis`; `startParameter`: `TThis`; }, { }> & `object` --- --- url: 'https://gramio.dev/ecosystem/schema-parser.md' --- # @gramio/schema-parser [![npm](https://img.shields.io/npm/v/@gramio/schema-parser?logo=npm\&style=flat\&labelColor=000\&color=3b82f6)](https://www.npmjs.org/package/@gramio/schema-parser) [![JSR](https://jsr.io/badges/@gramio/schema-parser)](https://jsr.io/@gramio/schema-parser) A TypeScript library that parses the [Telegram Bot API](https://core.telegram.org/bots/api) HTML documentation into a structured, type-annotated schema. It is used internally by [`@gramio/types`](/types) to generate all TypeScript type declarations — replacing the previous dependency on the Rust-based `tg-bot-api` crate. > This is an **advanced / infrastructure package**. Regular bot developers don't need it. It's relevant if you're building type generators, linters, documentation tools, or anything that needs a machine-readable representation of the Telegram Bot API. ## Installation ::: pm-add @gramio/schema-parser ::: ## Basic Usage ```ts import { parseSchema } from "@gramio/schema-parser"; const schema = await parseSchema(); // fetches https://core.telegram.org/bots/api console.log(schema.methods.sendMessage); // { // name: "sendMessage", // description: "...", // fields: [ ... ], // returns: { type: "reference", name: "Message" } // } console.log(schema.objects.Message); // { // name: "Message", // description: "...", // fields: [ ... ] // } ``` ## Schema Structure The parsed schema has two top-level maps: ```ts interface BotAPISchema { methods: Record; objects: Record; } ``` ### Fields & Types Each field in a method or object has a `type` discriminated union: | `type` value | Meaning | |---|---| | `"string"` | Plain string | | `"number"` | Integer or float | | `"boolean"` | Boolean | | `"reference"` | Reference to another object (e.g. `Message`) | | `"array"` | Array of another type | | `"one_of"` | Union of types | | `"file"` | `InputFile` — a file upload field | ### Semantic Type Markers Fields carry optional `semanticType` markers that convey meaning beyond the raw type: | `semanticType` | Meaning | How detected | |---|---|---| | `"formattable"` | Text that supports entities/parse\_mode | Has `_entities` or `_parse_mode` sibling field | | `"markup"` | Keyboard/reply markup object | Object name matches keyboard types | | `"updateType"` | Update discriminator string | Field used in event routing | Example — `sendMessage.text` has `semanticType: "formattable"` because the method also has `parse_mode` and `entities` parameters. ### InputFile Detection String fields that accept file uploads (detected via "More information on Sending Files" link in the description) are automatically converted to `one_of` unions: ```ts // Instead of: { type: "string" } // You get: { type: "one_of", variants: [ { type: "file" }, // InputFile — local upload { type: "string" }, // file_id or URL ] } ``` ### Currencies Enum The parser fetches Telegram's `currencies.json` and synthesizes a `Currencies` enum object, including `XTR` (Telegram Stars) which isn't in the currencies file: ```ts schema.objects.Currencies; // { // name: "Currencies", // type: "enum", // values: ["AED", "AFN", ..., "XTR", "ZMW"] // } ``` Fields typed as ISO 4217 currency codes (like `currency` in `sendInvoice`) automatically reference this enum. ## Exported Types ```ts import type { BotAPISchema, Method, TelegramObject, ObjectWithEnum, Field, FieldType, FieldFile, SemanticType, } from "@gramio/schema-parser"; ``` ## Use Case: Custom Type Generator ```ts import { parseSchema } from "@gramio/schema-parser"; const schema = await parseSchema(); for (const [name, method] of Object.entries(schema.methods)) { const returnType = method.returns; console.log(`${name} → ${JSON.stringify(returnType)}`); } ``` ## See Also * [`@gramio/types`](/types) — the generated TypeScript types powered by this package * [Telegram Bot API](https://core.telegram.org/bots/api) — the source documentation --- --- url: 'https://gramio.dev/api/session.md' --- [GramIO API Reference](../../../index.md) / @gramio/session/dist # @gramio/session/dist ## Interfaces | Interface | Description | | ------ | ------ | | [SessionOptions](interfaces/SessionOptions.md) | Options types from [session](#session) plugin | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [Events](type-aliases/Events.md) | Telegram events that support session | | [SessionData](type-aliases/SessionData.md) | Helper type: If Lazy is true, wraps Data in Promise, otherwise returns Data as-is | ## Functions ### session() > **session**<`Data`, `Key`, `Lazy`>(`options?`): [`Plugin`](../../../gramio/classes/Plugin.md)<{ }, [`DeriveDefinitions`](../../../gramio/type-aliases/DeriveDefinitions.md) & `object`> Defined in: session/index.d.ts:137 Session plugin #### Type Parameters | Type Parameter | Default type | | ------ | ------ | | `Data` | `unknown` | | `Key` *extends* `string` | `"session"` | | `Lazy` *extends* `boolean` | `false` | #### Parameters | Parameter | Type | | ------ | ------ | | `options?` | [`SessionOptions`](interfaces/SessionOptions.md)<`Data`, `Key`, `Lazy`> | #### Returns [`Plugin`](../../../gramio/classes/Plugin.md)<{ }, [`DeriveDefinitions`](../../../gramio/type-aliases/DeriveDefinitions.md) & `object`> #### Examples ```ts import { Bot } from "gramio"; import { session } from "@gramio/session"; const bot = new Bot(process.env.token!) .extend( session({ key: "sessionKey", initial: () => ({ apple: 1 }), }) ) .on("message", (context) => { context.send(`🍏 apple count is ${++context.sessionKey.apple}`); }) .onStart(console.log); bot.start(); ``` ```ts // Lazy sessions - only load when accessed const bot = new Bot(process.env.token!) .extend( session({ lazy: true, initial: () => ({ count: 0 }), }) ) .on("message", async (context) => { const session = await context.session; session.count++; }); ``` --- --- url: 'https://gramio.dev/api/storage.md' --- [GramIO API Reference](../../../index.md) / @gramio/storage/dist # @gramio/storage/dist ## Interfaces | Interface | Description | | ------ | ------ | | [Storage](interfaces/Storage.md) | Type of base storage which should implement all of storages | ## Type Aliases | Type Alias | Description | | ------ | ------ | | [InMemoryStorageMap](type-aliases/InMemoryStorageMap.md) | Type of in memory storage map | ## Functions ### inMemoryStorage() > **inMemoryStorage**<`Data`>(`map?`): [`Storage`](interfaces/Storage.md)<`Data`> Defined in: storage/index.d.ts:85 in memory storage. Can be used by **default** in plugins #### Type Parameters | Type Parameter | | ------ | | `Data` *extends* `Record`<`string`, `any`> | #### Parameters | Parameter | Type | | ------ | ------ | | `map?` | [`InMemoryStorageMap`](type-aliases/InMemoryStorageMap.md)<`Data`\[keyof `Data`]> | #### Returns [`Storage`](interfaces/Storage.md)<`Data`> --- --- url: 'https://gramio.dev/guides/for-beginners/4.md' --- # Coming Soon Check back soon for updates! --- --- url: 'https://gramio.dev/plugins/official/auto-answer-callback-query.md' --- # Auto answer callback query plugin [![npm](https://img.shields.io/npm/v/@gramio/auto-answer-callback-query?logo=npm\&style=flat\&labelColor=000\&color=3b82f6)](https://www.npmjs.org/package/@gramio/auto-answer-callback-query) [![JSR](https://jsr.io/badges/@gramio/auto-answer-callback-query)](https://jsr.io/@gramio/auto-answer-callback-query) [![JSR Score](https://jsr.io/badges/@gramio/auto-answer-callback-query/score)](https://jsr.io/@gramio/auto-answer-callback-query) This plugin auto answer on `callback_query` events with `answerCallbackQuery` method if you haven't done it yet. ### Installation ::: pm-add @gramio/auto-answer-callback-query ::: ```ts import { Bot, InlineKeyboard } from "gramio"; import { autoAnswerCallbackQuery } from "@gramio/auto-answer-callback-query"; const bot = new Bot(process.env.BOT_TOKEN as string) .extend(autoAnswerCallbackQuery()) .command("start", (context) => context.send("Hello!", { reply_markup: new InlineKeyboard() .text("test", "test") .text("test2", "test2"), }) ) .callbackQuery("test", () => { // The plugin will call an answerCallbackQuery method since you didn't do it return context.send("Hii"); }) .callbackQuery("test2", (context) => { // you already answered so plugin won't try to answer return context.answer("HII"); }); ``` ### Params You can pass params for [answerCallbackQuery](https://core.telegram.org/bots/api#answercallbackquery) method ```ts bot.extend( autoAnswerCallbackQuery({ text: "Auto answer", show_alert: true, }) ); ``` > \[!IMPORTANT] > This plugin hijack the `context.answerCallbackQuery` (`context.answer` too) method to determine if the callback query was already answered or not. Please avoid global usage of `bot.api.answerCallbackQuery` method in context because plugin can not work properly in this case. --- --- url: 'https://gramio.dev/plugins/official/auto-retry.md' --- # Auto retry plugin [![npm](https://img.shields.io/npm/v/@gramio/auto-retry?logo=npm\&style=flat\&labelColor=000\&color=3b82f6)](https://www.npmjs.org/package/@gramio/auto-retry) [![JSR](https://jsr.io/badges/@gramio/auto-retry)](https://jsr.io/@gramio/auto-retry) [![JSR Score](https://jsr.io/badges/@gramio/auto-retry/score)](https://jsr.io/@gramio/auto-retry) A plugin that catches errors with the `retry_after` field (**rate limit** errors), **waits** for the specified time and **repeats** the API request. ### Installation ::: pm-add @gramio/auto-retry ::: ### Usage ```ts import { Bot } from "gramio"; import { autoRetry } from "@gramio/auto-retry"; const bot = new Bot(process.env.BOT_TOKEN as string) .extend(autoRetry()) .command("start", async (context) => { for (let index = 0; index < 100; index++) { await context.reply(`some ${index}`); } }) .onStart(console.log); bot.start(); ``` --- --- url: 'https://gramio.dev/plugins/official/autoload.md' --- # Autoload Plugin [![npm](https://img.shields.io/npm/v/@gramio/autoload?logo=npm\&style=flat\&labelColor=000\&color=3b82f6)](https://www.npmjs.org/package/@gramio/autoload) [![JSR](https://jsr.io/badges/@gramio/autoload)](https://jsr.io/@gramio/autoload) [![JSR Score](https://jsr.io/badges/@gramio/autoload/score)](https://jsr.io/@gramio/autoload) Autoload commands plugin for GramIO with [`Bun.build`](#bun-build-usage) support. ### Installation ::: pm-add @gramio/autoload ::: ## Usage > [full example](https://github.com/gramiojs/autoload/tree/main/example) > \[!IMPORTANT] > Please read about [Lazy-load plugins](https://gramio.dev/plugins/lazy-load) ## Register the plugin ```ts twoslash // index.ts import { Bot } from "gramio"; import { autoload } from "@gramio/autoload"; const bot = new Bot(process.env.BOT_TOKEN as string) .extend(await autoload()) .onStart(console.log); bot.start(); export type BotType = typeof bot; ``` ## Create command ```ts // commands/command.ts import type { BotType } from ".."; export default (bot: BotType) => bot.command("start", (context) => context.send("hello!")); ``` ## Options | Key | Type | Default | Description | | ----------------- | -------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------- | | pattern? | string | string\[] | "\*\*/\*.{ts,js,cjs,mjs}" | [Glob patterns](https://en.wikipedia.org/wiki/Glob_\(programming\)) | | path? | string | "./commands" | Path to the folder | | import? | string | (file: any) => string | "default" | Import a specific `export` from a file | | failGlob? | boolean | true | Throws an error if no matches are found | | skipImportErrors? | boolean | false | Skip imports where needed `export` not defined | | onLoad? | (params: { absolute: string; relative: string }) => unknown | | Hook that is called when loading a file | | onFinish? | (paths: { absolute: string; relative: string }\[]) => unknown; | | Hook that is called after loading all files | | fdir? | [Options](https://github.com/thecodrr/fdir/blob/HEAD/documentation.md#method-chaining-alternative) | | Options to configure [fdir](https://github.com/thecodrr/fdir) | | picomatch? | [PicomatchOptions](https://github.com/micromatch/picomatch?tab=readme-ov-file#picomatch-options) | | Options to configure [picomatch](https://www.npmjs.com/package/picomatch) | ### [Bun build](https://bun.sh/docs/bundler) usage You can use this plugin with [`Bun.build`](https://bun.sh/docs/bundler), thanks to [esbuild-plugin-autoload](https://github.com/kravetsone/esbuild-plugin-autoload)! ```ts // @filename: build.ts import { autoload } from "esbuild-plugin-autoload"; // default import also supported await Bun.build({ entrypoints: ["src/index.ts"], target: "bun", outdir: "out", plugins: [autoload("./src/commands")], }).then(console.log); ``` Then, build it with `bun build.ts` and run with `bun out/index.ts`. ### [Bun compile](https://bun.sh/docs/bundler/executables) usage You can bundle and then compile it into a [single executable binary file](https://bun.sh/docs/bundler/executables) ```ts import { autoload } from "esbuild-plugin-autoload"; // default import also supported await Bun.build({ entrypoints: ["src/index.ts"], target: "bun", outdir: "out", plugins: [autoload("./src/commands")], }).then(console.log); await Bun.$`bun build --compile out/index.js`; ``` > \[!WARNING] > You cannot use it in `bun build --compile` mode without extra step ([Feature issue](https://github.com/oven-sh/bun/issues/11895)) [Read more](https://github.com/kravetsone/esbuild-plugin-autoload) --- --- url: 'https://gramio.dev/changelogs/2026-02-15.md' --- # Bot API 9.4, Views System, OpenTelemetry & `streamMessage` **February 8 – 15, 2026** An absolutely packed week. GramIO catches up to **Bot API 9.4** with 8 new contexts, ships a brand-new **views/template system**, launches **OpenTelemetry** and **Sentry** plugins, adds an `onApiCall` hook for API instrumentation, introduces `streamMessage` for live-typing drafts, brings **button styling** to keyboards, and delivers Node.js support for SQLite storage plus Bun-native Redis. Let's go. ## gramio v0.4.14 — `onApiCall` Hook & Better Stack Traces [`b54d121`](https://github.com/gramiojs/gramio/commit/b54d121) [`54ece76`](https://github.com/gramiojs/gramio/commit/54ece76) [`7e48c24`](https://github.com/gramiojs/gramio/commit/7e48c24) ### New hook: `onApiCall` for API call instrumentation The 7th hook joins the family. `onApiCall` wraps the entire API call lifecycle, enabling tracing, logging, metrics — anything you want around every outgoing Telegram request. It works like middleware with `next()`: ```ts bot.onApiCall(async (context, next) => { console.log(`→ ${context.method}`); const start = Date.now(); const result = await next(); console.log(`← ${context.method} (${Date.now() - start}ms)`); return result; }); ``` You can scope it to specific methods: ```ts bot.onApiCall("sendMessage", async (context, next) => { // only fires for sendMessage calls return next(); }); ``` Multiple hooks compose like middleware — the first registered wraps everything. Works in both `Bot` and `Plugin`. This is what powers the new OpenTelemetry plugin under the hood. ### Error stack traces now point to your code `TelegramError` now captures the call site where you made the API call. When `bot.api.sendMessage(...)` fails, the stack trace points to *your* line of code, not framework internals. No config needed — it just works. ### Dependencies * `@gramio/contexts` bumped to `^0.4.0` * `@gramio/keyboards` bumped to `^1.3.0` * `@gramio/types` bumped to `^9.4.0` ## @gramio/contexts v0.4.0 — Bot API 9.2 / 9.3 / 9.4 [`ea3049f`](https://github.com/gramiojs/contexts/commit/ea3049f) [`aa3ff6d`](https://github.com/gramiojs/contexts/commit/aa3ff6d) [`3df81eb`](https://github.com/gramiojs/contexts/commit/3df81eb) [`524ba8b`](https://github.com/gramiojs/contexts/commit/524ba8b) [`13564e6`](https://github.com/gramiojs/contexts/commit/13564e6) ### `streamMessage` — live-typing message drafts Stream text chunks to the chat with live typing previews. Each chunk updates a draft in real-time via `sendMessageDraft`, and the message auto-finalizes via `sendMessage` when a 4096-character segment completes. Perfect for AI/LLM streaming responses: ```ts bot.command("stream", async (context) => { const chunks = generateTextChunks(); // Iterable or AsyncIterable const messages = await context.streamMessage(chunks); }); ``` Accepts `Iterable` or `AsyncIterable` where each piece is a string or `{ text, entities?, draft_id? }`. Supports `AbortSignal` for cancellation. ### Bot API 9.2 — Suggested posts & direct messages 8 new contexts and structures for the suggested posts lifecycle: * `SuggestedPostApprovedContext`, `SuggestedPostApprovalFailedContext`, `SuggestedPostDeclinedContext`, `SuggestedPostPaidContext`, `SuggestedPostRefundedContext` * `DirectMessagesTopic` structure * `Chat.isDirectMessages`, `ChatFullInfo.parentChat`, `ChatAdministratorRights.canManageDirectMessages` * `Gift.publisherChat`, `UniqueGift.publisherChat` * `Message.suggestedPostInfo`, `Message.directMessagesTopic`, `Message.isPaidPost` ### Bot API 9.3 — Gift upgrades, new structures * `GiftUpgradeSentContext` — service message about gift upgrades * `sendMessageDraft()` method on SendMixin * New structures: `GiftBackground`, `UniqueGiftColors`, `UserRating` * Extended `Gift` with `isPremium`, `background`, `uniqueGiftVariantCount` * Extended `ChatFullInfo` with `rating`, `uniqueGiftColors`, `paidMessageStarCount` ### Bot API 9.4 — Chat ownership, video quality, profile audios * `ChatOwnerLeftContext`, `ChatOwnerChangedContext` — track chat ownership changes * `VideoQuality` structure with `codec` (`"h265"` | `"av01"`) * `UserProfileAudios` structure * Extended `VideoAttachment` with `qualities` getter * Extended `UniqueGiftModel` with `rarity` (`"uncommon"` | `"rare"` | `"epic"` | `"legendary"`) * Extended `UniqueGift` with `isBurned` * Extended `User` with `allowsUsersToCreateTopics()` ## @gramio/views — Template System for Reusable Message Views (NEW) [`4de789b`](https://github.com/gramiojs/views/commit/4de789b) [`cd3b934`](https://github.com/gramiojs/views/commit/cd3b934) [`944a5fb`](https://github.com/gramiojs/views/commit/944a5fb) [`c7521ae`](https://github.com/gramiojs/views/commit/c7521ae) [`b2f917b`](https://github.com/gramiojs/views/commit/b2f917b) A brand-new package for building reusable message templates with automatic send/edit strategy detection. Define views once, render them anywhere — the library figures out whether to send a new message or edit the existing one based on the context type. ### Programmatic views ```ts import { initViewsBuilder } from "@gramio/views"; import { defineAdapter } from "@gramio/views/define"; const adapter = defineAdapter({ welcome(name: string) { return this.response .text(`Hello, ${name}!`) .keyboard([[{ text: "Start", callback_data: "start" }]]); }, }); const defineView = initViewsBuilder().from(adapter); bot.derive(["message", "callback_query"], (context) => ({ render: defineView.buildRender(context, {}), })); bot.command("start", (context) => context.render("welcome", "Alice")); ``` ### JSON-driven views Define views as JSON with `{{key}}` interpolation for text, keyboards, and media: ```ts import { createJsonAdapter } from "@gramio/views/json"; const adapter = createJsonAdapter({ views: { welcome: { text: "Hello, {{name}}!", reply_markup: { inline_keyboard: [ [{ text: "Profile {{name}}", callback_data: "profile_{{id}}" }], ], }, }, }, }); ``` ### Filesystem loading ```ts import { loadJsonViewsDir } from "@gramio/views/fs"; // views/messages.json → "messages.welcome", "messages.goodbye" // views/goods/products.json → "goods.products.list" const views = await loadJsonViewsDir("./views"); ``` ### i18n support Two approaches: adapter factory for per-locale JSON files, or custom `resolve` callback for translation keys: ```ts // Per-locale adapter selection const defineView = initViewsBuilder<{ locale: string }>() .from((globals) => adapters[globals.locale]); // Or custom resolve for translation keys const adapter = createJsonAdapter({ views: { greet: { text: "{{t:hello}}, {{name}}!" } }, resolve: (key, globals) => { if (key.startsWith("t:")) return globals.t(key.slice(2)); }, }); ``` Supports all keyboard types (inline, reply, remove, force reply), single and grouped media with URL interpolation, and globals access via `{{$path}}` syntax. ## @gramio/opentelemetry — Distributed Tracing (NEW) [`5fe9928`](https://github.com/gramiojs/opentelemetry/commit/5fe9928) [`56789d9`](https://github.com/gramiojs/opentelemetry/commit/56789d9) [`1ba7880`](https://github.com/gramiojs/opentelemetry/commit/1ba7880) Vendor-neutral distributed tracing for GramIO using OpenTelemetry API. Every update becomes a root span, every API call becomes a child span — zero config, works with any OTEL backend (Jaeger, Grafana, Axiom, etc.). ```ts import { opentelemetryPlugin } from "@gramio/opentelemetry"; bot.extend(opentelemetryPlugin({ recordApiParams: true, // record API params as span attributes })); ``` Trace hierarchy: ``` gramio.update.message (CONSUMER) ├── telegram.api/sendMessage (CLIENT) ├── telegram.api/deleteMessage (CLIENT) └── custom spans via record() ``` Exported utilities: `record(name, fn)` for custom child spans, `getCurrentSpan()`, `setAttributes()`. Integrates seamlessly with Elysia webhooks — GramIO spans automatically nest under HTTP request spans. ## @gramio/sentry — Error Tracking (NEW) [`47948dd`](https://github.com/gramiojs/sentry/commit/47948dd) [`fb1e8c8`](https://github.com/gramiojs/sentry/commit/fb1e8c8) Sentry integration with automatic error capture, user identification, breadcrumbs, and optional tracing: ```ts import { sentryPlugin } from "@gramio/sentry"; bot.extend(sentryPlugin({ setUser: true, // auto-set user from context.from breadcrumbs: true, // breadcrumb per update + API call tracing: false, // per-update isolation scopes + spans })); // Derived context methods: bot.command("test", (context) => { context.sentry.captureMessage("Something happened"); context.sentry.setTag("custom", "value"); }); ``` Uses `@sentry/core` for runtime-agnostic support (works in both Bun and Node.js). ## @gramio/keyboards v1.3.0 — Button Styling [`b97e34e`](https://github.com/gramiojs/keyboards/commit/b97e34e) All button methods now accept an optional `options` parameter for visual styling: ```ts new InlineKeyboard() .text("Delete", "delete", { style: "danger" }) .text("Confirm", "confirm", { style: "success", icon_custom_emoji_id: "5368324170671202286", }); ``` Three styles: `"danger"` (red), `"primary"` (blue), `"success"` (green). Plus `icon_custom_emoji_id` for custom emoji icons next to button text. Works on both `InlineKeyboard` and `Keyboard`. ## @gramio/types v9.4.0 [`177ce3d`](https://github.com/gramiojs/types/commit/177ce3d) [`27149c1`](https://github.com/gramiojs/types/commit/27149c1) New types for Bot API 9.4: `VideoQuality`, `UserProfileAudios`, `ChatOwnerLeft`, `ChatOwnerChanged`, `UniqueGiftModelRarity`. Button styling types (`KeyboardButtonStyle`, `InlineKeyboardButtonStyle`) are now official. New API methods: `getUserProfileAudios`, `setMyProfilePhoto`, `removeMyProfilePhoto`. ## @gramio/storage-sqlite v1.0.0 — Now Works on Node.js! [`84ea1b1`](https://github.com/gramiojs/storages/commit/84ea1b1) The SQLite adapter is no longer Bun-only! It now has dual runtime exports: * **Bun**: uses `bun:sqlite` (unchanged) * **Node.js**: uses `node:sqlite` with `DatabaseSync` The correct implementation is auto-selected based on your runtime — no code changes needed. ## @gramio/storage-redis — Bun Native Redis [`8190612`](https://github.com/gramiojs/storages/commit/8190612) [`98749d1`](https://github.com/gramiojs/storages/commit/98749d1) The Redis adapter now supports Bun's built-in `RedisClient` alongside `ioredis`: ```ts // Auto-selected on Bun — no ioredis needed import { redisStorage } from "@gramio/storage-redis"; const storage = redisStorage({ url: "redis://localhost:6379" }); ``` Dual exports: `@gramio/storage-redis` (auto-detects runtime), `@gramio/storage-redis/ioredis` (explicit), `@gramio/storage-redis/bun` (explicit). The `ioredis` peer dependency is now optional. ## @gramio/test — API Mocking & Chat Simulation [`f9b670d`](https://github.com/gramiojs/test/commit/f9b670d) [`480cde3`](https://github.com/gramiojs/test/commit/480cde3) ### `onApi` / `offApi` for mocking API responses ```ts import { apiError } from "@gramio/test"; // Static response env.onApi("sendMessage", { message_id: 1, chat: { id: 1 }, ... }); // Dynamic handler env.onApi("getChat", (params) => { if (params.chat_id === 123) return chatData; return apiError(400, "Chat not found"); }); // Simulate errors with retry_after env.onApi("sendMessage", apiError(429, "Too Many Requests", { retry_after: 30 })); env.offApi("sendMessage"); // reset single env.offApi(); // reset all ``` ### Chat objects and user interactions ```ts const chat = env.createChat(); const user = env.createUser({ first_name: "Alice" }); await user.join(chat); // emits chat_member + new_chat_members await user.sendMessage(chat, "Hello!"); // emits message in chat await user.click("button_data"); // emits callback_query await user.leave(chat); // emits chat_member + left_chat_member ``` All API calls are recorded in `env.apiCalls` for assertions. --- --- url: 'https://gramio.dev/changelogs/2026-03-02.md' --- # Bot API 9.5 Lands, Rate Limiter Debuts, Composer Gets Superpowers **February 23 – March 2, 2026** A massive week for the GramIO ecosystem. Telegram Bot API 9.5 is fully supported — member tags, `date_time` entities, and `can_manage_tags` admin rights. A brand-new `@gramio/rate-limit` plugin arrives with macro-based per-handler throttling. `@gramio/format` learns to parse HTML directly into Telegram entities. `@gramio/composer` ships `EventContextOf`, `ContextOf`, `defineComposerMethods`, and a full Elysia-inspired macro system. Plus `@gramio/views` gains sticker/voice/video\_note support, `create-gramio` generates CLAUDE.md context files for AI tools, and `@gramio/scenes` gets cross-chain deduplication. ## [Bot API 9.5 — Member Tags & date\_time Entities](https://github.com/gramiojs/gramio/compare/v0.6.2...v0.7.0) Telegram Bot API 9.5 is now fully supported across the entire ecosystem. ### [Member tags: set, clear, and verify text labels per user](https://github.com/gramiojs/gramio/commit/d3dc668edcdfdf69114cf862de50c7af13677c7a) Bots can now assign **plain text tags** (up to 16 characters, no emoji) to group and supergroup members. Tags require the `can_manage_tags` administrator right. GramIO exposes this via the new [`setChatMemberTag`](/telegram/methods/setChatMemberTag) method and context shorthand: ```ts // Set a tag using the context shorthand bot.command("tag", async (ctx) => { if (!ctx.replyToMessage) return ctx.send("Reply to a user to tag them"); await ctx.replyToMessage.setMemberTag("VIP"); await ctx.reply("Tag set!"); }); // Remove a tag by passing undefined (or empty string) await ctx.setMemberTag(undefined); ``` The `ChatMember` type gains new fields: | Field | Type | Available on | |---|---|---| | `tag` | `string` | `ChatMemberMember`, `ChatMemberRestricted` | | `canEditTag` | `boolean` | `ChatMemberRestricted`, `ChatPermissions` | | `canManageTags` | `boolean` | `ChatAdministratorRights`, `ChatMemberAdministrator` | | `senderTag` | `string \| undefined` | `Message` | To allow other admins to set tags, pass `can_manage_tags: true` to [`promoteChatMember`](/telegram/methods/promoteChatMember). ### [New date\_time MessageEntity type](https://github.com/gramiojs/contexts/commit/116aacd059d0ecf675563bd9800a2fe23dc9bdf3) Telegram now marks timestamps in messages with `date_time` entities. GramIO surfaces the new fields on `MessageEntity`: ```ts bot.on("message", (ctx) => { const dateEntities = ctx.entities?.filter((e) => e.type === "date_time"); for (const entity of dateEntities ?? []) { console.log(entity.unixTime); // Unix timestamp console.log(entity.dateTimeFormat); // Telegram's format string } }); ``` **Updated packages:** `@gramio/types` v9.5.0, `gramio` v0.7.0, `@gramio/contexts` v0.5.0, `@gramio/keyboards` v1.3.1 ## [@gramio/rate-limit v0.0.1 — Rate Limiting via Macros](https://github.com/gramiojs/rate-limiter/commit/4e9f95cf1b18fffed297d2884f6d683d338f6e85) ### [Brand-new rate limiting plugin with per-handler throttling](https://github.com/gramiojs/rate-limiter/commit/4e9f95cf1b18fffed297d2884f6d683d338f6e85) `@gramio/rate-limit` is a new official plugin that protects your bot handlers from abuse using sliding-window rate limiting. The key design choice: it uses GramIO's **macro system** for per-handler options instead of imperative `if (!await ctx.rateLimit(...)) return` checks. ```ts import { Bot } from "gramio"; import { rateLimit } from "@gramio/rate-limit"; const bot = new Bot(process.env.BOT_TOKEN!) .extend( rateLimit({ // Optional: plug in Redis, SQLite, Cloudflare KV… // storage: redisStorage(redis), onLimitExceeded: async (ctx) => { if (ctx.is("message")) await ctx.reply("Too many requests, slow down!"); }, }), ); // Throttle per handler — no if-checks needed in handler body bot.command("pay", (ctx) => { // process payment }, { rateLimit: { limit: 3, window: 60 } }); bot.command("help", (ctx) => ctx.reply("Help text"), { rateLimit: { id: "help", limit: 20, window: 60, onLimitExceeded: (ctx) => ctx.reply("Too many /help requests!"), }, }); await bot.start(); ``` The plugin ships with **in-memory storage** out of the box. Swap in Redis, SQLite, or Cloudflare KV by passing a `storage` option from `@gramio/storages`. > **Note on the export name:** The plugin function was renamed from `rateLimitPlugin` to `rateLimit` in the same release. Use `rateLimit` — the old name is gone. ## [@gramio/format v0.5.0 — Parse HTML into Telegram Entities](https://github.com/gramiojs/format/compare/v0.4.0...v0.5.0) ### [htmlToFormattable(): send HTML content without parse\_mode](https://github.com/gramiojs/format/commit/77463cb24219ec94d9da4fb21a8771e668c45859) `@gramio/format` v0.5.0 adds `htmlToFormattable()` — a new sub-module that converts HTML markup into GramIO's `FormattableString` format. This is a perfect complement to `markdownToFormattable()` for when your content source produces HTML (CMS outputs, TipTap, ProseMirror, LLM-generated HTML, etc.). The approach is the same as with Markdown: parse locally into entities, send without any `parse_mode`. Invalid or partial HTML degrades gracefully to plain text instead of erroring. Install the peer dependency first: ::: pm-add node-html-parser ::: Then import from the `@gramio/format/html` sub-path: ```ts import { htmlToFormattable } from "@gramio/format/html"; import { Bot } from "gramio"; const bot = new Bot(process.env.BOT_TOKEN!); bot.command("start", (ctx) => { const content = `

Hello!

Bold and italic

  • item one
  • item two

Visit gramio.dev

`; ctx.send(htmlToFormattable(content)); }); await bot.start(); ``` **Supported HTML elements:** | HTML | Telegram entity | |---|---| | ``, `` | bold | | ``, `` | italic | | `` | underline | | ``, ``, `` | strikethrough | | `` | code | | `
` | pre (with language) |
| `
` | blockquote | | `` | text\_link | | `

`–`

` | bold | | `