#
Game Server Watcher
A simple discord/telegram bot that can be hosted on a free service to monitor your game servers and players in style. 😎
# About the Project
The main goals of this repo:
1. create a (simple, but capable) service/bot to monitor game servers
1. get gamedig & steam api server info (_eg.: server name, map, players, etc._)
1. relay real time server information to various channels via APIs (_eg.: discord, telegram, slack etc._)
1. should be able to host on a free service (_target atm. is fly.io (node.js 16)_)
1. graciously add more features based on community feedback via [discord](https://discord.gg/4tsbftsGJz) and [github](https://github.com/a-sync/game-server-watcher/discussions/new?category=ideas-requests)
# Screenshots
# Project Status
The code itself is stable and continuously tested/deployed from the master branch.
The project is in a very early stage. More detailed customization options and features will be added as requested.
### Possible features and configuration options to add in the future
* optional player list
* with configurable fields. eg.: time,name,ping,score
* configurable field & order to sort by
* max length for player names & nr of players
* custom embed fields for discord
* ~~configurable time zone offset for graph x-axis~~
* refresh on reaction
* watched players (notify when a watched player enters/leaves the server)
* detect when the server goes offline, notify when player number crosses a threshold
* bot commands (reinit message, cleanup, start/stop, configure)
* more integrations: slack, ms teams, twillio (email, sms)
* ~~web ui to manage & configure the servers and bots~~
* put custom information in the channel name or bot status (online status indicator, number of players, map)
* github action workflows to deploy to other cloud providers (aws, linode, atlantic, vultr, pikapods, okteto, ibm cloud etc.)
* SQL, JSON or object store database support (postgres, redis etc.)
* run as stateless serverless function (aws lambda, azure function, heroku, vercel, fly.io machines etc.)
* [pterodactyl](https://pterodactyl.io) egg release
# Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See [deployment](#deployment) for notes on how to deploy the project on a live system.
## Requirements
[node.js](https://nodejs.org/) _(version 16.9.0 or later)_
## Getting the source
This project is [hosted on github](https://github.com/a-sync/game-server-watcher). You can clone this project directly using this command:
```
git clone git@github.com:a-sync/game-server-watcher.git
```
The latest source can also be downloaded as a [zip archive](https://github.com/a-sync/game-server-watcher/archive/refs/heads/master.zip).
## Installation
Use npm or yarn to install/update all the dependencies:
```
npm i
```
If you don't want to build from source, you can skip the development dependencies:
```
npm i --only=prod
```
## Usage
Build the artifacts from source (optional):
```
npm run build
```
Start the built artifacts:
```
npm start
```
Build, start and auto restart on source changes:
```
npm run dev
```
## Settings
The behaviour of the watcher service can be configured via environmental variables (env vars).
`.env` ([dotenv](https://www.npmjs.com/package/dotenv)) file is also supported, to look at the avaialable values and defaults check the [.env.example](./.env.example) file.
To get started, you can simply rename the `.env.example` file to `.env`.
Refer to the wiki on how to acquire tokens for:
* [steam](https://github.com/a-sync/game-server-watcher/wiki/Steam-Web-API-key)
* [discord](https://github.com/a-sync/game-server-watcher/wiki/Discord-bot-token)
* [telegram](https://github.com/a-sync/game-server-watcher/wiki/Telegram-bot-token)
## Managing the service
**GSW Control Panel** is a web based UI that let's you configure and control the Game Server Watcher instance.
The web app is served at `http://localhost:8080` by default.
_Make sure to configure the `SECRET` env var!_
### Configuration
Updates the configuration file and restarts the service.
### Flush data
#### Flush game servers data
Removes population history data. (configured by _Graph history time span_ server option)
#### Flush discord data
If the original message created by the bot gets deleted, you might need to flush the bot data to reinitialize the message.
_The bot has no cleanup functionality, left over messages must be removed manually._
#### Flush telegram data
If the original message created by the bot gets deleted, you need to flush the bot data to reinitialize the message.
_The bot has no cleanup functionality, left over messages must be removed manually._
# Deployment
Check the wiki page for detailed instructions on [how to setup a self deploying free cloud instance at fly.io](https://github.com/a-sync/game-server-watcher/wiki/Free-hosting-via-fly.io).