Skip to content

SquadPop is a simple Open-Source solution to display the population of your favorite Squad servers on any Discord server

License

Notifications You must be signed in to change notification settings

Nicolas-Colombier/SquadPop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

SquadPop

A JavaScript Discord bot to display the population of your favorite servers

OverviewRequirementsDependenciesDiscord bot identityInstallationRunning the botUsage & ManagementCredits

Logo

Overview

SquadPop is a Discord bot adapted to display the population of your favorite Squad servers on any Discord server. It does not require RCON access to the Squad server, and use the BattleMetrics API to get the information. You can display the population of multiple servers at the same time.

If you need help, contact me on Discord : nom4de


Requirements


Dependencies

Discord.js
Powerful Node.js module that allows you to easily interact with the Discord API. See on npm

axios
Promise based HTTP client for the browser and node.js. See on npm


Discord bot identity

  1. Go to the Discord Developer Portal and create a new application.
  2. 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.
  3. 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.
  4. You can now reset the token and copy it in the config.json file as the botToken for each server. DO NOT SHARE THIS TOKEN WITH ANYONE (if you do, regenerate it).
  5. 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.
  6. Copy the generated link and paste it in your browser. You can now add your bot to your server if you are admin.
  7. Create as many bots as you have servers to display the population.

Installation

  1. Clone the repository (or download the zip) :
git clone https://github.com/Nicolas-Colombier/SquadPop.git
  1. Go to the bot directory :
cd SquadPop
  1. Install npm dependencies :
npm install
  1. Create a config.json file using the config.json.example template :
cp config.json.example config.json
  1. Edit the config.json file and add your Discord bot token, your BattleMetrics API key, the server BattleMetrics ID and the server name :
  • 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.
  • botToken : The token of your bot.
  • battleMetricsToken : Your BattleMetrics API key (you can get it on the BattleMetrics website).
  • battleMetricsServerId : The BattleMetrics ID of the server (can be found in the URL of the server page).

Running the bot

  1. Create a systemd service to run the bot (from this point requires sudo access):
nano /etc/systemd/system/squadpop.service
  1. Add the following content :
[Unit]
Description=Squad Pop

[Service]
Type=simple
User=name_of_your_linux_user
WorkingDirectory=/home/****/path_to_the_bot
ExecStart=/usr/bin/node /home/****/path_to_the_bot/main.js
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=name_of_your_linux_user

[Install]
WantedBy=multi-user.target
  1. Reload the service files to include the new service (requires sudo access) :
sudo systemctl daemon-reload
  1. Start the bot (requires sudo access) :
sudo systemctl start squadpop
  1. Check the status of the bot (requires sudo access) :
sudo systemctl status squadpop
  1. Enable the bot to start on boot (requires sudo access) :
sudo systemctl enable squadpop

Usage & Management

To disable the bot to start on boot (requires sudo access) :

sudo systemctl disable squadpop

Stop the bot (requires sudo access) :

sudo systemctl stop squadpop

Take a look to the logs (requires sudo access) :

sudo journalctl -u squadpop
sudo journalctl -fu squadpop

Credits

  • Foxinou - For the original idea and the first version of the bot

About

SquadPop is a simple Open-Source solution to display the population of your favorite Squad servers on any Discord server

Resources

License

Stars

Watchers

Forks

Packages

No packages published