grammY

grammY

Telegram Bot 框架

立刻开始 介绍

易用

grammY 使创建 Telegram Bot 变得如此简单!

灵活

grammY 是开放的,通过插件让它完全适合你的需要。

可扩展

grammY 在你 bot 拥有较多流量时提供可靠的帮助.

… bot 开发的新时代.

快速开始

bot 是用 TypeScriptopen in new window(或JavaScript)编写的,并在各种平台上运行,包括 Node.jsopen in new window

npm install grammy 并粘贴以下代码:

import { Bot } from "grammy";

const bot = new Bot(""); // <-- 把你的 bot token 放在这里 (https://t.me/BotFather)

// 用"你好!"来回复任意信息
bot.on("message", (ctx) => ctx.reply("你好!"));

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

const bot = new Bot(""); // <-- 把你的 bot token 放在这里 (https://t.me/BotFather)

// 用"你好!"来回复任意信息
bot.on("message", (ctx) => ctx.reply("你好!"));

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

const bot = new Bot(""); // <-- 把你的 bot token 放在这里 (https://t.me/BotFather)

// 用"你好!"来回复任意信息
bot.on("message", (ctx) => ctx.reply("你好!"));

bot.start();

运行成功! 🎉


grammY 支持 Telegram Bot API 6.0,该 API 于 2022 年 4 月 16 日 发布open in new window。 (新增: Web 应用)