Skip to content

Eddievin/grammY

 
 

Repository files navigation

grammY

The Telegram Bot Framework.


Bot API Deno npm All Contributors

grammY makes it easy to create Telegram bots. Both for beginners and at scale.

You want grammY because it is easy to use. It is very powerful and always up to date. It has the best documentation in town. It is extremely efficient and scales up effortlessly. It has a thriving ecosystem of plugins, a friendly community chat, seamless integrations with web frameworks and databases, and so much more.

Are you ready? 🤖🚀

Bots are written in TypeScript (or JavaScript) and run on Node.js or Deno.

Quickstart

If you are new to Telegram bots, read the official Introduction for Developers written by the Telegram team.

Visit @BotFather and create a new bot. You will obtain a bot token.

Create a new directory and run

npm install grammy

inside it. Then create a file bot.js with this content:

const { Bot } = require("grammy");

// Create a bot object
const bot = new Bot(""); // <-- place your bot token in this string

// Register listeners to handle messages
bot.on("message:text", (ctx) => ctx.reply("Echo: " + ctx.message.text));

// Start the bot (using long polling)
bot.start();

Now you can run the bot via

node bot.js

and it will echo all received text messages.

Congrats! You just wrote a Telegram bot :)

Going Further

grammY has an excellent documentation, and an API Reference. It even integrates with your code editor, e.g. VSCode. You can hover over any element of grammY to get a detailed description of what that thing does or means.

If you are still stuck, just join the Telegram chat and ask for help. People are nice there and we appreciate your question, no matter what it is :)

Here are some more resources to support you:

Resources

—main project website and documentation.

—reference of everything that grammY exports.

—repository full of example bots. Includes a setup to easily run any of them.

—Telegram chat where you can ask any question about grammY or bots in general. We are also open for feedback, ideas, and contributions!

The Russian commnity chat can be found here.

—Telegram channel where updates to grammY and the ecosystem are posted.

—documentation of the API that Telegram offers, and that grammY connects to under the hood.

Deno Support

All grammY packages published by @grammyjs run natively on Deno. We are compiling every codebase to still run on Node.js.

However, given that most bot developers are still using Node.js, all documentation is written Node.js-first. We may migrate it if Deno overtakes Node.js. If you are already on Deno today, import grammY from https://deno.land/x/grammy/mod.ts.

You may also be interested in why we support Deno.

Browser Support

The grammY core package in this repository is available as a JavaScript bundle from the CDN at get.grammy.dev. Currently, we transpile all stable versions (all releases since v1.0) as well as the current main branch to ES6 and ESNext.

You can download them from the URL https://get.grammy.dev/[ES version lowercased]@[grammY version including v-prefix].js. For example, the most recent source on main in ES6 is available from https://get.grammy.dev/es6@dev.js.

So far, this is mainly useful for running bots on Cloudflare Workers.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


KnorpelSenf

🤔 💻 📖 🎨 💡 ⚠️ 🔌 📦 👀 🧑‍🏫 📆 🚇

Tecardo1

🔌 📓 💡 📖 👀

Wojciech Pawlik

🤔 👀 🚇 📦 🔧

Alessandro Bertozzi

📖

trgwii

💻 👀

KnightNiwrem

💻 🐛 🔌 📖 💡 👀 🧑‍🏫

Muthu Kumar

👀

EdJoPaTo

🔌 📖 🤔 👀 🐛 💻

Amir Zouerami

📖 🔌 💡

Roj

📖 👀 🚇 🌍 💻 🤔 🧑‍🏫 💡

jokasimr

🐛

Ciki Momogi

📖

AndreoliBR

👀

Kirill Loskutov

📖 🐛 🤔 🎨 💬 👀

Andrew Lane

🐛 👀

code-withAshish

📖

Stephane Mensah

🐛 🔌

Asaku01

📖

ppsimn

🐛

Satont

🔌 📖

deptyped

💡 📖

Jacek Nowacki

📖 💻 🐛 👀 🤔

Outvi V

💻

Ikko Ashimine

📖

Yevhen Denesiuk

👀 🐛 💻

prastian

🐛 💻

Sayem Chowdhury

🤔

kospra

🤔 💻

Chimit

📖

Calsi

📖

Jonas Zohren

🐛 💻

linbuxiao

📖 🌍

JiquanWang99

📖 🌍

Borhan Hafez

🔌

WingLim

📖 🌍

taotie111

📖 🌍

Merlin

📖

Darvesh

🐛 💻 👀

dcdunkan

🐛 💻 🔌 👀 📖 🤔 🚇

Kid

📖 🌍

Slava Fomin II

🐛 📖

Kiko Beats

📖

Vsevolod

💻 🤔 👀

Habemuscode

👀 📖 🌍

Nikita Kolmogorov

🔌

Vitaliy Meshchaninov

🐛 💻

Дилян Палаузов

🐛 💻

lmx-Hexagram

📖

Ilya Semenov

🤔 👀 💻

abdollahzadehAli

📖 💡

Saeed Nasiri

📖

Hesoyam

📖

yrzam

🐛

drmikecrowe

👀

Martin

📖

Pavel

💡

Thor 雷神 Schaeff

💡

x066it

🐛 👀

kolay

👀

Evgeny Nepomnyashchiy

👀

This project follows the all-contributors specification. Contributions of any kind welcome!

About

The Telegram Bot Framework.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.7%
  • Shell 0.3%