This repository contains various bots and setups to help you get started with grammY.
./echo.ts
).npm install
from the root.npm run bot <name>
# For example, to run the echo example:
npm run bot echo
echo
)A simple bot that echoes the text messages it receives.
send-message
)Not a real bot, only an illustration of sending a single message once. Might be useful in scripts.
menu
)Advanced menu example bot that lets you manage different dishes (Pasta, Pizza, Sushi, Entrecôte) via a nested menu structure. It shows how to build more complex menus when all the data is generated at runtime.
menu-with-photo
)Similar to the nested menu example, but with photos.
stats
)Full-blown example bot that counts messages in a chat and stores the statistics in session objects.
stats-lazy
)Full-blown example bot that counts photos in a chat and stores the statistics using lazy sessions. The advantage of lazy sessions is that the storage is only queried whenever data is actually needed.
(Note that this bot stores data in-memory, it does not connect to a database. Therefore, using lazy sessions does not make much sense. This bot is only an illustratation on how to use them.)
runner
)Illustrates how to use the grammY runner
to run large bots.
fastify
)Simple example for using grammY
with Fastify
and Ngrok
scaling
)NOTE: This example is not endorsement of any directory structure. See
Awesome grammY
for live examples
instead.
A minimal example bot that demonstrates how various grammY objects can be
orchestrated together, including
custom context flavors
,
transformers
,
sessions with initial data
,
composers
,
and
routers
.
Example bot that can run on Deno Deploy.
Example bot that can run on Supabase Edge Functions.
Example bot using Node.js on Vercel Serverless Functions.
Example bot using Deno on Vercel Serverless Functions.
Example bot using Bun on Vercel Serverless Functions.
Example bot using Vercel Edge Functions.
Example bot that can run using AWS Lambda.
Example Deno bot that can run using Docker.
Example Node.js bot that can run using Docker.
Use Docker to setup a local Bot API server and run your bot on it.
Use Docker to setup a local Bot API server with a self-signed TLS certificate, and run your bot on it.
We could have some more examples here, for example:
and other things.