Skip to content

A Python-based Discord bot for checking and updating the online/offline status and traffic of your SoftEther VPN servers and clients.

Notifications You must be signed in to change notification settings

Pink210/SoftBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Bot Project

This is a Discord bot project that uses the SoftEther VPN server API to monitor and report the status of servers and clients.

Table of Contents

Installation

Automatically

for Install & Update automatically

To install automatically the bot, simply copy and paste it on your Linux server in terminal

wget -O se-install https://raw.githubusercontent.com/Pink210/SoftBot/main/install.bash  && chmod +x se-install && ./se-install

Manually

for Install manually

To install and run this project, you need to have Python 3.9 or higher installed on your system. You also need to install the following Python packages:

  • discord.py
  • discord.ext
  • json
  • time
  • pandas

You can install them using pip:

pip install discord.py
pip install pandas
pip install json
pip install time
pip install discord.ext

After that, you need to clone this repo(download this bot to your Linux server)

git clone https://github.com/Pink210/SoftBot.git

Now is better to move it to the better location

cd ..
sudo mkdir /bot/
sudo cp -rf /root/SoftBot/ /bot/

Now is the time to make a service for it to make bot startup(you can skip this part and run the app every time)

sudo nano /etc/systemd/system/softbot.service

And pass this code to the file

[Unit]
Description=SoftBot

[Service]
Type=simple
ExecStart=/usr/bin/python3 /bot/softbot/main.py
WorkingDirectory=/bot/softbot/
Restart=always

[Install]
WantedBy=sysinit.target

now running the service

sudo systemctl daemon-reload
sudo systemctl enable SoftBot.service
sudo systemctl start SoftBot.service

If you don't want to have service You can run the bot with this code in the bot directory:

python main.py

THE END ;) NOW You need to edit the setup file for config the bot

Configration

for Setup and Configration

You need a Discord account and create a bot token for your project. You can follow the instructions from here to create a bot token.

You need to edit the setup.py file and enter the following information:

  • Your bot token
  • The username and password of your SoftEther VPN server
  • The list of hubs and cascades that you want to monitor
  • The Discord channel name that you want the bot to respond to
  • The input commands for checking all servers or clients
  • The hour that the bot sends status updates
  • The cooldown time for responses
sudo nano /bot/SoftBot/setup.py

after that

sudo systemctl restart SoftBot.service

Infomation

The bot will connect to your Discord server and start listening for messages in the specified channel. You can use the following commands to interact with the bot:

  • Type the name of a server (e.g. hubnumber1) to get the status of that server (online or offline).
  • Type the name of a client (e.g. *hubnumber1) to get information about clients on that server (name, expiry date, traffic).
  • Type servers to get the status of all servers.
  • Type client to get information about clients on all servers.

The bot will respond with a formatted message containing the requested information. For example:

User list of all servers:
Name: user1 Expiry: 2023/12/31 Traffic: 1 GB
Name: user2 Expiry: No expiry Traffic: 2 GB

or

Server is Online
['hubnumber1', 'hubnumber2', 'hubnumber5', 'hubnumber6']
or
Server is Offline
['hubnumber3', 'hubnumber4']

or

hubnumber1 is online

or

User list of hubnumber1:
Name: user1 Expiry: 2023/12/31 Traffic: 1 GB
Name: user2 Expiry: No expiry Traffic: 2 GB

The bot will also send status updates every 8 hours (or as specified in the setup.py file) in the channel.

Translate

Click here for details
sudo nano /bot/SoftBot/msg.py

You may translate the message into any language or format you like.

Uninstall

Click here for details
wget -O se-install https://raw.githubusercontent.com/Pink210/SoftBot/main/uninstall.bash  && chmod +x se-install && ./se-install

Acknowledgements

This project was inspired by this tutorial on how to create a Discord bot using Python. I also used this documentation for the SoftEther VPN server API. I would like to thank the authors of these resources for their helpful guidance.

About

A Python-based Discord bot for checking and updating the online/offline status and traffic of your SoftEther VPN servers and clients.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published