Discord application I created for a private gaming Server. Current runs on a personal EC2 instance with AWS.
To follow the development of this project, visit the Trello board here.
Winston is the name of the bot that users will interact with.
Command | Description | Parameters | Required | Example |
---|---|---|---|---|
!pick | Chooses a random game from the database. If a number of players is provided, the games to choose from will be filtered to support the amount of players. | [# of players] | No | !pick / !pick 4 |
!list | Returns all games listed in the database. If a number of players is provided, the listed games will be filtered to support the amount of players. | [# of players] | No | !list / !list 4 |
Currently, the bot is running on an EC2 instance, and must be uploaded to the instance and started manually. The steps to do are as follows:
- Launch an EC2 instance through the launch instance wizard
- Choose the following AMI "Ubuntu Server 18.04 LTS (HVM), SSD Volume Type - ami-0747bdcabd34c712a"
- Choose the t2.micro instance type.
- If you have an existing Key Pair, assign it to the new instance, otherwise create a new Key Pair.
- Make sure to download this Key Pair, as it will be needed soon.
- You'll need to update the permissions on the Key Pair (.pem) file before we can continue. Run the following commands in PowerShell (or the appropriate substitutes in a different command line interface), replacing "./path/to/keypair.pem" with the path to your .pem file.
icacls.exe "./path/to/keypair.pem" /reset icacls.exe "./path/to/keypair.pem" /GRANT:R "$($env:USERNAME):(R)" icacls.exe "./path/to/keypair.pem" /inheritance:r
- Using the newly updated pem file, we're going to ssh into the new EC2 instance.
ssh -i "./path/to/keypair.pem" ubuntu@12.34.567.890
- Make sure to replace the path with the correct path to your file, and replace 12.34.567.890 with the public IPv4 address of the new EC2 instance (viewable in the AWS EC@ console by selecting the instance).
- Run the following commands to set up the instance to run the bot:
sudo apt-get update sudo apt-get install nodejs sudo apt-get install npm sudo npm install -g pm2
- Create an environment variable on the instance called "TOKEN", which holds the Discord bot token needed to interact with Discord.
- Run
export TOKEN=insert-token-here
, replacing "insert-token-here" with the token contained in the Discord Developer Portal.
- Run
- Clone the GameBot repository.
- cd into the GameBot directory, and run npm install
- cd back to the root directory, and run pm2 startup systemd
- Copy the last line of this command and run it.
- Running this command will ensure pm2 will start up on boot, in case your EC2 instance is rebooted.
- Run
pm2 start ./GameBot/index.js
- The bot should now be running.
- Run the following command:
ssh -i "./path/to/keypair.pem" ubuntu@12.34.567.890
- Make sure to replace the path with the correct path to your file, and replace 12.34.567.890 with the public IPv4 address of the new EC2 instance (viewable in the AWS EC@ console by selecting the instance).
- Run pm2 kill to stop the bot from running.
- cd into the GameBot directory.
- Run
git pull
to make sure the local repo is up to date. - Run
pm2 start ./GameBot/index.js