CyanoFresh / TI81-queue-bot

Telegram Bot for creating queues from students list

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telegram Queue Bot

Telegram Bot for creating randomized queue from students list from group TI-81

You can find bot here: @ti81_queue_bot

By Alex Solomaha (@CyanoFresh)

Feel free to contribute :)

Features

  • Randomized Queue
  • Persistence - save and load queues from json database file
  • Stickers - reply with stickers (triggered by name or random) for fun (java = держи жабу)
  • Authentication by chat_id for admin and users commands
  • Telegram WebHooks - CPU and network optimization
  • /done command for users
  • Use Telegram's inline buttons for navigation
  • Better architecture - separate index.js into smaller files
  • Use telegraf/micro for lambda-like services
  • KPI rozklad parser
  • Universal students list

You can help by submitting a PR

Installation

  1. Clone repo && cd to it
  2. Configure environmental variables:
    • For development: cp .env.example
    • For production: see .env.example for available parameters
  3. npm start

Nginx and Webhooks

  1. Configure environmental variables for webhooks: domain and port

  2. Configure domain in nginx

  3. Obtain a certificate from Let's Encrypt

  4. Configure nginx for the bot. Example config:

    server {
       if ($host = tg.solomaha.com) {
           return 301 https://$host$request_uri;
       } # managed by Certbot
    
       listen 80;
       server_name tg.solomaha.com;
       
       return 404; # managed by Certbot
    }
    
    server {
       server_name tg.solomaha.com;
    
       location / {
           proxy_pass http://127.0.0.1:4000;
           proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection 'upgrade';
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_cache_bypass $http_upgrade;
       }
    
       listen 443 ssl; # managed by Certbot
       ssl_certificate /etc/letsencrypt/live/tg.solomaha.com/fullchain.pem; # managed by Certbot
       ssl_certificate_key /etc/letsencrypt/live/tg.solomaha.com/privkey.pem; # managed by Certbot
       include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
       ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    }
    

About

Telegram Bot for creating queues from students list


Languages

Language:JavaScript 100.0%