A bot coded in Node JS for Discord as part of the Subterfuge Remake project.
-
Install Node JS and NPM
- Go to https://nodejs.org/ and download and install v16.6.2 for your platform.
- Verify the install by running
node -v
andnpm -v
.
-
Clone the Remake-Discord Repository
- Enter
git clone https://github.com/Subterfuge-Revived/Remake-Discord.git
- Navigate into the folder with
cd Remake-Discord
- Enter
-
Install Packages with NPM
- Run
npm install
to install all required packages.
- Run
-
Configuring the tokens.json file.
- Find your discord bot token by going to https://discordapp.com/developers/applications and selecting your bot.
- Rename
tokens.json.example
totokens.json
and fill it out as follows,- Replace
"YOUR_UNIQUE_BOT_ID"
with the discord token. - Replace
"YOUR_DISCORD_BOT_ID
with the bot's ID (Can be done with right clicking the bot in Discord and copying ID) - OPTIONAL: You can replace
YOUR_TEST_SERVER_ID
with your server ID to get faster command refreshes
- Replace
-
Test out the bot.
- Run
npm run bot
and you should see the bot come online.
- Run
- Install docker for your device
- Install VSCode
- Clone/fork this repository
- Enter
git clone https://github.com/Subterfuge-Revived/Remake-Discord.git
- Enter
- Open the project in Visual studio code. A message should say "This workspace has recommended extensions"
- Install the recommended extensions.
- These include:
Docker
,Eslint
The following scripts are avaliable for this repository:
npm run lint
- Checks your code for syntax and style. For example, ensures all strings are double quotes, correct spacing, no unused imports, etc.
npm run debug
- Runs the bot in a debugger process within visual studio code. Pressing F5
will start and attach the VS Code debugger so that you can debug your code.
npm run bot
- Runs the bot.
npm run test
- Not yet implemented.
To run the bot:
- Ensure docker has started
- Right click the
docker-compose.yml
file and clickCompose Up
To view the bot console:
- Click the docker whale icon on the left of VSCode
- In the
Containers
section, find the running container (likely namedremake-discord_discord
) - Right click the container and click
View Logs
To stop the bot:
- Right click the
docker-compose.yml
file and clickCompose Down
- You can alternatively stop the container from the container list in the docker extensions
Ensure that when contributing files you adhere to Eslint
.
To ensure your code meets the required style standards, run the command npm run lint