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
running
orstopped
.
Install the dependencies:
$ pip3 install -r requirements.txt
Copy .env
file:
$ mv .env.sample .env
Adjust the values in the .env
file.
- The
TOKEN
value is the access token of your Discord bot. - The
SERVER_NAME
value needs to correspond this the value of theName
tag of the EC2-Instance that is to be started/stopped. - The
AWS
values are your usual AWS credentials and region.
Run the script:
$ python3 main.py