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.21.2/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.1 que fue liberada el 16 de Febrero del 2024. (Última novedad: Mejoras en el chat grupal)