Skip to content

grammY

Framework Bot Telegram.

logo grammY

Mulai Cepat

Bot ditulis menggunakan TypeScript (atau JavaScript) dan dapat berjalan di berbagai platform, termasuk Node.js.

npm install grammy lalu tempel kode berikut:

ts
import { Bot } from "grammy";

const bot = new Bot(""); // <-- taruh token bot-mu di antara "" (https://t.me/BotFather)

// Balas pesan apapun dengan "Halo, apa kabar!".
bot.on("message", (ctx) => ctx.reply("Halo, apa kabar!"));

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

const bot = new Bot(""); // <-- taruh token bot-mu di antara "" (https://t.me/BotFather)

// Balas pesan apapun dengan "Halo, apa kabar!".
bot.on("message", (ctx) => ctx.reply("Halo, apa kabar!"));

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

const bot = new Bot(""); // <-- taruh token bot-mu di antara "" (https://t.me/BotFather)

// Balas pesan apapun dengan "Halo, apa kabar!".
bot.on("message", (ctx) => ctx.reply("Halo, apa kabar!"));

bot.start();

Berhasil! 🎉


© 2021-2024 · grammY mendukung API Bot Telegram versi 7.1 yang dirilis pada tanggal 16 Februari 2024. (Fitur yang disorot: Boost untuk Grup)