DDNS and server operation Telegram bot.
Tested on Node.js version 8.9.4 LTS and Debian GNU/Linux 9.3.
©IP-API.com - for the provided JSON API
©fail2ban - for protecting my servers
- /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.
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.
Dont't forget to edit the file with your bot token and user ID!
{
"token": "123456789:ABCDEFGHIJKLMNOPQRSTUV_123WXYZAB-CDEF",
"ownerID": "111111111"
}
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
- Go to the directory /etc/systemd/system/
cd /etc/systemd/system/
- Create symbolic link to file omni.service in project root directory
sudo ln -s /var/www/omni/omni.service omni.service
- Reload systemd service for re-read settings
sudo systemctl daemon-reload
- Enable omni-bot like service
sudo systemctl enable omni.service
- Start omni-bot like service
sudo systemctl start omni.service