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

x/grammy/mod.ts>ApiConstants

The Telegram Bot Framework.
Very Popular
Latest
interface ApiConstants
import { type ApiConstants } from "https://deno.land/x/grammy@v1.30.1/mod.ts";

Types of the constants used in the Telegram Bot API. Currently holds all available update types as well as all chat permissions.

Properties

DEFAULT_UPDATE_TYPES: DEFAULT_UPDATE_TYPES[number]

List of update types a bot receives by default. Useful if you want to receive all update types but chat_member, message_reaction, and message_reaction_count.

// Built-in polling:
bot.start({ allowed_updates: DEFAULT_UPDATE_TYPES });
// grammY runner:
run(bot, { runner: { fetch: { allowed_updates: DEFAULT_UPDATE_TYPES } } });
// Webhooks:
await bot.api.setWebhook(url, { allowed_updates: DEFAULT_UPDATE_TYPES });

See the Bot API reference for more information.

ALL_UPDATE_TYPES: ALL_UPDATE_TYPES[number]

List of all available update types. Useful if you want to receive all updates from the Bot API, rather than just those that are delivered by default.

The main use case for this is when you want to receive chat_member, message_reaction, and message_reaction_count updates, as they need to be enabled first. Use it like so:

// Built-in polling:
bot.start({ allowed_updates: ALL_UPDATE_TYPES });
// grammY runner:
run(bot, { runner: { fetch: { allowed_updates: ALL_UPDATE_TYPES } } });
// Webhooks:
await bot.api.setWebhook(url, { allowed_updates: ALL_UPDATE_TYPES });

See the Bot API reference for more information.

ALL_CHAT_PERMISSIONS: keyof ALL_CHAT_PERMISSIONS

An object containing all available chat permissions. Useful if you want to lift restrictions from a user, as this action requires you to pass true for all permissions. Use it like so:

// On `Bot`:
await bot.api.restrictChatMember(chat_id, user_id, ALL_CHAT_PERMISSIONS);
// On `Api`:
await ctx.api.restrictChatMember(chat_id, user_id, ALL_CHAT_PERMISSIONS);
// On `Context`:
await ctx.restrictChatMember(user_id, ALL_CHAT_PERMISSIONS);
await ctx.restrictAuthor(ALL_CHAT_PERMISSIONS);

See the Bot API reference for more information.