Small script I made in order to allow users on my Discord server to start/stop my Valheim server in order to reduce costs.
The bot, once running, can be interacted with via the !server command. Possible commands:
- start - Starts the EC2 instance
- stop - Stops the EC2 instance
- status - Prints whether or not the instance is currently
runningorstopped.
Install the dependencies:
$ pip3 install -r requirements.txtCopy .env file:
$ mv .env.sample .envAdjust the values in the .env file.
- The
TOKENvalue is the access token of your Discord bot. - The
SERVER_NAMEvalue needs to correspond this the value of theNametag of the EC2-Instance that is to be started/stopped. - The
AWSvalues are your usual AWS credentials and region.
Run the script:
$ python3 main.py