Skip to content

grammY

El Framework de Bots para Telegram.

Logotipo de grammY

Quickstart

Bots están escritos en TypeScript (o JavaScript) y corren en varias plataformas, incluyendo Node.js.

npm install grammy y copia el siguiente código:

ts
import { Bot } from "grammy";

const bot = new Bot(""); // <-- pon tu token entre los "" (https://t.me/BotFather)

// Responde a cualquier mensaje con "¡Hola a todos!".
bot.on("message", (ctx) => ctx.reply("¡Hola a todos!"));

bot.start();
js
const { Bot } = require("grammy");

const bot = new Bot(""); // <-- pon tu token entre los "" (https://t.me/BotFather)

// Responde a cualquier mensaje con "¡Hola a todos!".
bot.on("message", (ctx) => ctx.reply("¡Hola a todos!"));

bot.start();
ts
import { Bot } from "https://deno.land/x/grammy@v1.22.4/mod.ts";

const bot = new Bot(""); // <-- pon tu token entre los "" (https://t.me/BotFather)

// Responde a cualquier mensaje con "¡Hola a todos!".
bot.on("message", (ctx) => ctx.reply("¡Hola a todos!"));

bot.start();

¡Funciona! 🎉


© 2021-2024 · grammY soporta Telegram Bot API 7.2 que fue liberada el 31 de Marzo del 2024. (Última novedad: Integración con cuentas de empresa)