A Discord bot that let's you start, stop, restart etc. a LinuxGSM server. It's basically just a way to access the LinuxGSM (Linux Game Server Managers) scripts trough Discord.
This bot relies on your GameServer being installed using LinuxGSM_. The bot uses LGSM scripts to execute it's commands.
You also need NodeJS and NPM installed.
_NOTE! Make sure you're doing this as the user with the LinuxGSM installation.
1 Start by cloning the repository and installing the packages
git clone https://github.com/King007t/dc_lgsm_interface.git
cd dc_lgsm_interface
npm install
2 to be able to connect to a Discord server you will need a bot token.
Here's a guide on how to get a token. Store your token as a string called token
inside config.json
. Fill out the rest of your config file too.
Your config file (config.json) will look something like this:
{
"server_name": "MyServer", //name of the server
"serverpath": "/home/[user]/arkserver", //path to LinuxGSM installation
"msgsec": "5", //seconds a message from the bot will be displayed
"locked": false, //true or false defines if bot accepts new commands
"prefix": "!", //prefix for recognition of bot commands
"token": "random_characters", //discord bot token to connect to
"channel" :"", //can be left blank (can be added by sending the **setchannel** command into the desired channel)
"required_role" : {
"use": true, //true or false defines if a role is required to use the bot
"name": "ServerManager" //name of the required role
}
}
3 Start the bot by running the following command within the dc_lgsm_interface directory
node bot.js
OR Make the bot run in the background and on system startup by creating a systemd service
Step 1: Create a new systemd service for dc_lgsm_interface
sudo nano /lib/systemd/system/dc_lgsm_interface.service
Step 2: Paste the following content and replace User and Group with your own username
[Unit]
Description=dc_lgsm_interface
[Service]
Type=simple
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
User=[username]
Group=[username]
Environment=TERM=xterm
ExecStart=node /home/[username]/dc_lgsm_interface/
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
Step 3: Press Ctrl + x,y (to save), Enter (to save with the same name)
Step 4: Enable the new dc_lgsm_interface service (optional but will make the bot start on boot)
sudo systemctl enable dc_lgsm_interface.service
Step 5: Reload the Systemd Daemon (Do this every time you modify a server file)
sudo systemctl daemon-reload
Step 6: start the dc_lgsm_interface service. You can use start, stop, restart or status. You don't have to run it manually again if it's enabled to start on boot (Step 4).
sudo systemctl start dc_lgsm_interface.service
NOTE! The default prefix is !. The prefix must be used before the command for it to work.
MANAGEMENT COMMANDS
- start
- stop
- restart
- backup
- update
- force-update
INFO COMMANDS
- info - info about the server
- help - will give you a list of all available commands
SETUP COMMANDS
- setchannel - will set bot command channel to current channel