🇺🇸 English | 🇷🇺 Русский
Sources of Telegram bot https://t.me/hekumatiarubot for Massa Blockchain
- Find node by IP
- Receive notification when a roll is sold
Table of contents
- Under the hood
- Commands
- System Requirements
- Installation
- Configuration
- Installation (development)
- Mirrors
- NestJS - Node.js framework
- grammY - Telegram Bot Framework
- Fluent - Localization system
- TypeORM (MySQL) - ORM
- Docker
Command | Description | Example |
---|---|---|
/start | Main Menu | |
/help | List all available commands | |
/hosting | Hosting promocodes | |
/add | Add your node | /add abcdef tag |
/delete | Delete your node | /delete abcdef |
/ip | Search by IP | /ip 65 |
/community | Community links | |
/free | Countries without nodes | |
/company | Companies with node populations | |
/country | Countries with node population | |
/version | Version with node population | |
/stats | Stakers, cycle, version | |
/release | Grab release Massa from GitHub | |
/mirror | Telegram bot mirror links | |
/en | 🇺🇸 English language | |
/ru | 🇷🇺 Русский язык | |
/whoami | Your id |
Minimal server requirements
Hardware | Value |
---|---|
CPU | 2 core |
RAM | 1 Gb |
Storage | 1.2 Gb (images & database) |
Requires Docker. The main folder of this repository contains a functional docker-compose.yml file. Run the application using it as shown below:
curl -sSL https://raw.githubusercontent.com/qqmee/massa-telegram-bot/main/docker-compose.yml > docker-compose.yml
mkdir -p .data/hek-db/{lib,log}
Generate self signed certificate https://core.telegram.org/bots/self-signed
Replace YOUR_IP
openssl req -newkey rsa:2048 -sha256 -nodes -keyout .data/private.key -x509 -days 3650 -out .data/public.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=YOUR_IP"
chmod 444 .data/{private.key,public.pem}
Start services
# WARN: edit your env variables (goto configuration) before command below
## docker compose up -d
Set environment variables in docker-compose.yml
Env | Scope | Example | Description |
---|---|---|---|
MYSQL_HOST | db,bot,cron | massa | |
MYSQL_PORT | db,bot,cron | 3306 | |
MYSQL_USER | db,bot,cron | massa | |
MYSQL_PASSWORD | db,bot,cron | bVrsy | |
MYSQL_DATABASE | db,bot,cron | massa | |
REDIS_HOST | redis,bot,cron | redis | |
REDIS_PORT | redis,bot,cron | 6379 | |
REDIS_PASSWORD | redis,bot,cron | guest | |
MASSA_RPC | bot | https://buildnet.massa.net/api/v2,198.27.74.5:33035 | api endpoint, comma separated |
GEOIP_RPC | bot,cron | http://127.0.0.1:3050 | api endpoint |
BOTS | bot,cron | 1:PPrreevvee,32:DDMMeeDDVveEdd | keys from @BotFather |
BOT_ADMINS | bot,cron | 1,2 | admin id for cronjob notifications (/whoami command) |
PORT | bot | 3000 | webhook port |
WEBHOOK_URL | bot | https://abcdef.loca.lt | webhook domain |
git clone https://github.com/qqmee/massa-bot
cd massa-bot
# WARN: edit your env variables (goto configuration) before command below
# Launch database
## docker compose up -d db redis
# install deps
npm i
# run webhook listener
npm run dev &
# optional: launch cron tasks
npm run dev::cron
# launch https tunnel for webhook (replace 'abcdef' with your subdomain)
npx localtunnel --port 3000 --subdomain abcdef # aka https://abcdef.loca.lt