AntiVirus software may stop the executable from running.
In order to get a steam API key, you will need a domain to link it to. Trying looking into Google's domain site. After you have gotten a domain navigate to Steam'd Web API Key Register, and get your Steam API Key. Copy your Key
and put it in your config file by replacing SteamAPIKeyHere
with your Steam API Key.
You must repeat this step for each server you wish to track.
First, navigate to Discord's Developer Portal, and create a new Application by selecting New Application
in the top right of the page, and give you application a name:
After you have created an Application for your discord bot, you will need to navigate to the Bot tab, and click Add Bot
:
After you have created your bot and named it, you will need to copy the bots Token
into your config by replacing DiscordTokenHere
with your bots token.
After you have added your Steam API key, and your bot's token you must add the botAddress
, this address is your query address for the server. This is so we know what game server's player count to display in the status of each bot. In order to configure the bot to display the player count, you must add the IP, and the Port in the format Address:Port
ex. 23.23.233.233:27015
where 127.0.0.1:2532
is located. This address is NOT the connection address.
After all configuration steps have been taken, we must start the bot and invite them into our discord. The bot needs no special permissions due to it's responsibility being to update it's status. In order to invite your discord bot, you must replace {clientID}
with your bots client ID in the URL below, this means you must also remove the curly braces too. If you do not know where to obtain your bot's client ID, navigate to General Information
tab on the Discord Developer Portal the bot you wish, and copy your Client ID from there.
https://discord.com/oauth2/authorize?client_id={clientID}&scope=bot
-
You may use
localhost
orhostname
as your server address for the application to automatically resolve the hosts IP. -
You may add the ChannelID variable to any bot to have the bot update the name of a text channel, or voice channel.
- ChanelID does not need to be specified in either Docker, or Executable instances. (If you don't want it don't include it in configuration files.)
- Note: Channel updates are rate limited to 2 requests per 10 mins. No matter how often your bot updates it's activity it will never update the channel as often.
- This rate limit is enforced by Discord, and not the library used Discord.Net
Voice Channel Format:
Text Channel Format:
Note: Text Channel names are limited to [a-z0-9-_]{2,100}
Tag | Description |
---|---|
latest | Latest stable releases |
Beta | May be unstable and contain unfinished features |
There are two ways to deploy bots with Docker.
- Create
docker-compose.yml
file - Copy into the file
version: "3.7"
services:
discord-bot:
image: specker/discordplayercountbot
environment:
BOT_NAMES: "Bot1;Bot2"
BOT_PUBADDRESSES: "127.0.0.1;127.0.0.1"
BOT_PORTS: "16261;16262"
BOT_DISCORD_TOKENS: "DiscordToken1;DiscordToken2"
BOT_UPDATE_TIME: "30"
BOT_STATUSES: "1;2"
BOT_USENAMETAGS: "false;false"
STEAM_API_KEY: "your steam api key"
- Edit variables and save the File
- Open terminal in a location of
docker-compose.yml
file and typedocker-compose up
- Press Enter
- Open Terminal
- Type:
docker run \
--name=PlayerCounterDiscordBot \
-e BOT_NAMES='Bot1;Bot2' \
-e BOT_PUBADDRESSES='127.0.0.1;127.0.0.1' \
-e BOT_PORTS='16261;16262' \
-e BOT_DISCORD_TOKENS='DiscordToken1;DiscordToken2' \
-e BOT_UPDATE_TIME='30' \
-e BOT_STATUSES='1;2' \
-e BOT_USENAMETAGS='false;false' \
-e STEAM_API_KEY='your steam api key' \
specker/discordplayercountbot
- Edit values in single quotes and press enter
Container images are configured with help of those variables.
Variable | Function |
---|---|
BOT_NAMES |
Names of bots |
BOT_PUBADDRESSES |
Addresses of gameservers |
BOT_PORTS |
Query ports of gameservers |
BOT_DISCORD_TOKENS |
Discord Bots tokens |
BOT_STATUSES |
Discord Bots statuses |
BOT_USENAMETAGS |
"TBD" |
STEAM_API_KEY |
Steam Api Key |
BOT_UPDATE_TIME |
How often bot should refresh |
To declare Multiple bots in docker separate values in BOT_NAMES
, BOT_PUBADDRESSES
, BOT_PORTS
, BOT_DISCORD_TOKENS
, BOT_STATUSES
and BOT_USENAMETAGS
with ;
Example:
One bot:
BOT_NAMES='Bot1'
Two bots:
BOT_NAMES='Bot1;Bot2'
All logging is tied behind _isDebug variable in the Config.json. Please report any issues to Issues tab.
Please fork this repository, and make a pull request for the changes you'd like to see to the project.