abdollahzadehAli / sols-bot

just a simple telegram bot that upload given files into i-gap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grammY Example Bots

This repository provides a number of example bots to help you get started.

  1. Create a bot with @BotFather, and get the bot token
  2. Clone this example repository
  3. Run npm install in the root directory of this repo
  4. Paste your token into the bot source file that you want to run (e.g. ./echo.ts)
  5. Run a bot with:
npm run bot <name>

# Example:
npm run bot echo

Hello World (echo)

A simple echo bot that echoes all text messages.

Send a Single Message (send-message)

Not a real bot, only illustrates how to manually send a single message once. Maybe useful for scripts.

Nested Menus (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 where all data is generated at runtime.

Media Menus (menu-with-photo)

Similar to the nested menu example, but with menu messages that include photos.

Sessions (stats)

Full-blown example bot that counts messages in a chat and stores the statistics in session objects.

Lazy Sessions (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 real database. Therefore, using lazy sessions does not make much sense. This bot uses them anyway in order to illustrate how to use them.)

Runner Example (runner)

Illustrates how to use the @grammyjs/runner package that is useful for large bots.

Scaling Example (scaling)

An advanced but minimal example bot that demonstrates a viable directory structure, for the collective orchestration of custom context flavors, transformers, sessions with initial data, composers, and routers.

Example bot that can run on Vercel.

Illustrates how to run a bot using a local Bot API server via Docker.

Illustrates how to run a bot using a local Bot API server with a reverse proxy and self-signed certificate via Docker.

Please Contribute

We could need some more examples here, e.g. about

  • command handling
  • filter queries
  • inline keyboards
  • file support

and other things.

About

just a simple telegram bot that upload given files into i-gap

License:MIT License


Languages

Language:TypeScript 98.0%Language:Dockerfile 1.2%Language:Shell 0.8%