Skip to content

nikita-popov/telegram-omni-admin-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

omni-bot

DDNS and server operation Telegram bot.
Tested on Node.js version 8.9.4 LTS and Debian GNU/Linux 9.3.

Special thanks

©IP-API.com - for the provided JSON API
©fail2ban - for protecting my servers

Available commands

  • /getmyid - returns your Telegram ID
  • /getip - returns external IPv4 of the your server
  • /gettop - returns task count on your server
  • /getuptime - returns your server uptime and load average
  • /getdisk - returns disk space status
  • /getfail2ban - returns banned IP list in all fail2ban jails
  • /getbanned - returns a list of users who have many spam and have been blocked. Saves the state only until the bot is restarted.

You can change the name of the commands in the source package.

Setup and startup

First, install Node.js (if not already installed) via the link above.
After downloading, run npm in the project directory to download the dependencies and wait until the download is complete.

   $ npm i

Files private_info.json and omni.service should be located in the working directory.

private_info.json example

Dont't forget to edit the file with your bot token and user ID!

{
  "token": "123456789:ABCDEFGHIJKLMNOPQRSTUV_123WXYZAB-CDEF",
  "ownerID": "111111111"
}

omni.service example

Dont't forget to edit the file for your file system!

[Unit]
Description=NODE-Omni-Server

[Service]
Type=simple

WorkingDirectory=/var/www/omni

TimeoutStartSec=0
ExecStart=/usr/bin/node omni.js
ExecStop=/bin/kill $MAINPID

Restart=always

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=NODE-Omni-Server

User=web
Group=web

Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

Setup systemd for start omni-bot like service

  1. Go to the directory /etc/systemd/system/
  cd /etc/systemd/system/
  1. Create symbolic link to file omni.service in project root directory
  sudo ln -s /var/www/omni/omni.service omni.service
  1. Reload systemd service for re-read settings
  sudo systemctl daemon-reload
  1. Enable omni-bot like service
  sudo systemctl enable omni.service
  1. Start omni-bot like service
  sudo systemctl start omni.service

About

DynDNS and operation server

Resources

Stars

Watchers

Forks