Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Install – Self Hosting

Patrix87 edited this page Jan 17, 2022 · 27 revisions

Prerequisites

Setup Windows

  1. Download source code from https://github.com/DiscordGSM/DiscordGSM/releases and extract it.
  2. Install Python dependencies: From the bot folder us the cmd: pip install -r requirements.txt
  3. Install Node dependencies: From the bot folder us the cmd: npm install -g gamedig
  4. Rename servers_template.json to servers.json and configure it
  5. Rename dot_env to .env and configure it
  6. Edit both files with your configurations, details about the config files are in this wiki.
  7. Run the bot with command python bot.py

Setup Linux

  1. Connect as root.
  2. Create a user called discordgsm and switch to that user:
adduser discordgsm
su discordgsm
  1. Install Python 3.10:
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt-get update
apt-get install python3.10
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2

2.1 Select Python version 3.10:

update-alternatives --config python3

2.2 Confirm the version:

python3 -V

2.3 Install pip:

apt-get install python3-pip
  1. Install NodeJS 17:
sudo apt -y update && sudo apt -y upgrade
curl -sL https://deb.nodesource.com/setup_17.x | sudo bash -
sudo apt-get install -y nodejs
node -v
  1. Download source code from https://github.com/DiscordGSM/DiscordGSM/releases:
git clone https://github.com/DiscordGSM/DiscordGSM.git
  1. Install Python dependencies:
python3 -m pip install -r requirements.txt
  1. Install Node dependencies as root:
exit
npm install -g gamedig
su discordgsm
  1. Rename servers_template.json to servers.json and configure it
  2. Rename dot_env to .env and configure it
  3. Edit both files with your configurations, details about the config files are in this wiki.
  4. Run the bot with command python bot.py or python3 bot.py on linux.
  5. Create a service to run the bot automatically on boot and auto-restart it.
nano /etc/systemd/system/discordgsm.service

11.1 Paste the following content and save:

[Unit]
Description=DiscordGSM
After=network.service

[Service]
Type=simple
WorkingDirectory=/home/discordgsm/DiscordGSM
ExecStart=sh /home/discordgsm/DiscordGSM/bot.sh
User=discordgsm
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

11.2 Reload the service daemon:

systemctl daemon-reload

11.3 Enable your service:

systemctl enable discordgsm.service

11.4 Start your service:

systemctl start discordgsm.service

11.5 Check that it works:

systemctl status discordgsm.service

Invite DiscordGSM to your server

The bot will output it's invite link to the console on startup.

https://discord.com/api/oauth2/authorize?client_id={clientid}&permissions=93184&scope=bot