Overview • Requirements • Dependencies • Discord bot identity • Running the bot • Usage & Management • Credits
SSDM is a Discord bot adapted to manage your LinuxGSM Squad server.
It provides essential features like:
- Start/Stop/Restart server
- Update server
- Get server status
- Manage server configuration
- Install/Update/Delete mods
If you need help, contact me on Discord : nom4de
- Git
- Node.js
- LinuxGSM Squad server
- SteamCMD
- SSH access to the server
Discord.js
Powerful Node.js module that allows you to easily interact with the Discord API.
See on npm
fs
Node.js file system module.
See on npm
ssh2
SSH2 client and server modules written in pure JavaScript for node.js.
See on npm
- Go to the Discord Developer Portal and create a new application.
- In the general information tab, enter the name of your bot (this is only the developer portal's name) and the description you want. You can also add a profile picture.
- Copy the application ID and enter it in the
config.json
file as theclientID
- Then go the the bot tab and add the name you want to display inside Discord. If you need a banner, this is also the place to do it.
- You can now reset the token and copy it in the
config.json
file as thetoken
. DO NOT SHARE THIS TOKEN WITH ANYONE (if you do, regenerate it). - Go to the OAuth2 tab and select
bot
in the OAuth2 URL Generator. Then select the permissions you want to give to your bot (I suggest giving it administrator permissions for your server). Select Guild Install as the integration type. You can generate a different link for each server you want to add the bot to. - Copy the generated link and paste it in your browser. You can now add your bot to your server if you are admin.
- Clone the repository (or download the zip) :
git clone https://github.com/Nicolas-Colombier/SquadSDM.git
- Install
npm
dependencies :
npm install
- Create a
config.json
file using theconfig.json.example
template :
cp config.json.example config.json
- Edit the
config.json
file with your Discord bot token and your Squad server SSH credentials :
token
: Your Discord bot tokenactivity
: The activity the bot will display (eg. "Watching your activity")clientID
: Your Discord bot client IDguildID
: Your Discord server IDmods
: The list of mods that will be in the 'updatemod' and 'deletemod' commands (DO NOT DELETE THE LAST ONE).server
: Each object is a server, if you have more then just add more object (be careful of the syntaxe). Each server can be on a different machine or user but need SSH access.
- Create a systemd service to run the bot (from this point requires sudo access):
nano /etc/systemd/system/squad_sdm.service
- Add the following content :
[Unit]
Description=Squad SDM
[Service]
Type=simple
User=name_of_your_linux_user
WorkingDirectory=/home/****/path_to_the_bot
ExecStart=/usr/bin/node /home/****/path_to_the_bot/index.js
Restart=always
RestartSec=3
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=name_of_your_linux_user
[Install]
WantedBy=multi-user.target
- Reload the service files to include the new service (requires sudo access) :
sudo systemctl daemon-reload
- Start the bot (requires sudo access) :
sudo systemctl start squad_sdm
- Check the status of the bot (requires sudo access) :
sudo systemctl status squad_sdm
- Enable the bot to start on boot (requires sudo access) :
sudo systemctl enable squad_sdm
To disable the bot to start on boot (requires sudo access) :
sudo systemctl disable squad_sdm
Stop the bot (requires sudo access) :
sudo systemctl stop squad_sdm
Take a look to the logs (requires sudo access) :
sudo journalctl -u squad_sdm
sudo journalctl -fu squad_sdm
- Foxinou - For the original idea and his help during development