This project is a Node.js-based Telegram bot designed to interact with users by providing a personalized greeting and administrative capabilities.
Preview this bot in telegram https://t.me/WhaleTestAppBot
/start
Command: Users can initiate interaction with the bot. The bot will respond with a message and a web app button that, when clicked, displays the user's first name as a greeting on a simple webpage./adminhello <telegram_id> <text>
Command: Admins can send personalized messages to users by invoking this command followed by the user's Telegram ID and the intended message./getuserid <username>
Admins can retrivies any telegram user id by providing telegram username/makeadmin <userid>
Admins can make other users an admin by providing telegram user id
The project follows a monorepo pattern and includes the following directories:
- app/backend: Contains the Telegram bot source code.
- app/web: A simple Svelte web application that greets users.
- .github/workflows: Github deployment pipeline
- NestJS for the backend framework.
- Telegraf for interacting with the Telegram Bot API.
- TypeORM for database management.
- Svelte for the web frontend.
- Turbo for monorepo utilities.
Clone the repository and install dependencies:
git clone your-repo-link
cd your-repo-directory
yarn install
TELEGRAM_BOT_TOKEN=XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXX
TELEGRAM_WEBHOOK_DOMAIN=test.domain.net
POSTGRES_PASSWORD=pass
POSTGRES_USER=admin
POSTGRES_DB=db
POSTGRES_PORT=23423
POSTGRES_HOST=localhost
WEB_URL=http://dest.domain.net/
yarn dev
yarn build
The bot can be deployed on any Node.js compatible hosting service. For deployment, you have two options:
-
Local Deployment: Configure the
.env
file and run the application usingdocker-compose.yml
. -
Automated Deployment via GitHub Actions: Pushing to the main branch triggers a CI/CD pipeline that builds and pushes Docker images for the backend and web frontend, followed by deployment using Docker Compose on the remote server.