Overview • Requirements • Dependencies • Discord bot identity • Installation • Running the bot • Usage & Management • Credits
SSDM is a Discord bot adapted to manage your LinuxGSM Squad servers.
It provides essential features like:
- Start/Stop/Restart server
- Update server
- Get server details
- Manage multiple server configuration
- Install/Update/Delete mods
- Limit the usage to specific discord channels
- Limit the usage to specific discord roles
- Manage multiple servers that have independent permissions
If you need help or you want to share an idea for this bot, contact me on Discord : nom4de
- Linux machine only
- Git
- Node.js v20.16.0
- LinuxGSM Squad server
- SteamCMD
- SSH & Sudo access to the server hosting the Squad 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
- Go to the bot directory :
cd SquadSDM
- 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.allowedChannels
: The ID of the channels where the bot can be used for this specific server (if empty, the bot can be used in all channels).roles
: Each key is a command and the value is the ID of the role that can use this command (if empty, the command cannot be used).
- Deploy the commands on the bot :
node utils/deployCommandsUtils.js
DISCLAIMER : This command need to be executed each time SquadSDM is updated.
- 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/path_to_node /home/****/path_to_the_bot/index.js
Restart=always
RestartSec=3
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 status and logs (requires sudo access) :
sudo systemctl status squad_sdm
sudo journalctl -u squad_sdm
sudo journalctl -fu squad_sdm
- Foxinou - For the original idea and his help during development