This is a discord bot to watch your game server by utilizing node-gamedig and Discord.NET. It will report the game server status in a text channel. This bot is written in .NET (dotnet) for cross-platform and multi-threaded environment because it will watch many game servers. Game servers are stored in an SQLite database using Entity Framework (EF) Core.
I'm currently still in active study and can't actively improve this bot. Please contact me if you want to bring improvement to this bot.
There are some improvements currently in mind :
- Add more customizability for different games that reports different properties.
- Add more interactability for server status message.
This discord bot is self-hosted solution meaning this bot is run by you usually in a Virtual Private Server. It will support container-based system in the future.
To use this bot, download the latest release and run the bot. Upon running it, it will perform checks and tell you what needs to be done.
If you want step-by-step instruction to run this bot :
- Install NodeJS and gamedig,
- Get a discord bot token,
- Invite the bot to your discord server,
- Run the bot in service mode.
- Download NodeJS for your operating system,
- Use LTS or Latest versions depending on your other dependent app.
- Run
npm install gamedig
in terminal/command prompt in the same directory of the bot executableVerdanskGameBot.exe
.
- Run
npm install gamedig -g
in terminal/command prompt to install on global directory, - Run
npm list -g
in terminal/command prompt to find where your global directory is, - Edit your environment variable
NODE_PATH
to your global directory,- on Linux this is usually
/usr/local/lib
- on Windows this is usually
%APPDATA%\npm
- How to edit your environment variable
- on Linux this is usually
- Head to Discord Developer Portal, login your discord account, and create your application,
- Once your discord application's created, head to SETTINGS > Bot and Add a new bot,
- Reset Token to get a new Bot Token, save this token in private,
- Run the bot if you haven't. It will ask for a
BotToken
inside a file namedBotConfig.json
, - Put the Bot Token enclosed in double-quote
""
-
Head back to your discord developer application and go to SETTINGS > OAuth2 > URL Generator. Check to use the Scopes of
bot
with Bot Permissions :- Send Messages
-
Copy and visit the Generated URL in your browser to invite the bot to your server.
- Create a new file in
/etc/systemd/system
namedgameserverwatcher.service
or anything you'd like, remember this asTHE_BOT_SERVICE_NAME
, - Add :
[Unit]
Description=YOURBOT_DESCRIPTION
After=network.target
[Service]
User=YOUR_USER
WorkingDirectory=BOT_DIRECTORY
ExecStart=BOT_DIRECTORY/VerdanskGameBot service
KillSignal=SIGINT
[Install]
WantedBy=multi-user.target
Where :
Variable | Description | Example Value |
---|---|---|
YOURBOT_DESCRIPTION |
the description of the bot | Verdansk Game Server Watcher Bot |
YOUR_USER |
is the user you want to run this bot as, you can delete this line if not needed. | steam |
BOT_DIRECTORY |
is the directory where you put the bot executable | /home/steam/VerdanskGameBot |
- Save the service file and Run
sudo systemctl daemon-reload
to reload any service file changes for systemd, - Run
sudo systemctl enable THE_BOT_SERVICE_NAME
andsudo systemctl start THE_BOT_SERVICE_NAME
- Monitor the service using any monitoring tools you like.