Skip to content

grammY

Telegram Bot 框架。

像做柠檬汁一样简单。

grammY 徽标

快速开始

bot 是用 TypeScript(或JavaScript)编写的,并在各种平台上运行,包括 Node.js

npm install grammy 并粘贴以下代码:

ts
import { Bot } from "grammy";

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

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

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

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

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

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

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

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

bot.start();

运行成功! 🎉


contributor's identiconx066it

感谢 x066it 成为 grammY 的贡献者。

© 2021-2025 · grammY 支持 Telegram Bot API 9.0,该 API 于 2025 年 4 月 11 日 发布。 (最新亮点: 商业账号和礼物改进)