Discord Bot Integration
SnailyCAD now has a bot which can be used to call emergency, tow and taxi services.
All the items listed below are required to use the bot.
- Node.js (16.13.x or 18.x is required.) (Windows Guide) (Linux Guide)
- yarn (
npm install --global yarn) (Windows Guide) (Linux Guide)
- PostgreSQL (version 14 or higher) (Video Guide)
1. Cloning the GitHub repository
To fix this, run the following command:
Firstly, we need to clone the GitHub repository to our local machine:
git clone https://github.com/SnailyCAD/snailycad-bot.git
Once the files have been cloned from GitHub, we can enter that folder:
2. Installing dependencies
Now we will install the dependencies that are required for the bot to function properly.
Configuration can be a bit complicated, so pay close attention. The following steps will help you configure the bot's environment variables. These variables are used by the bot to connect to the database.
Tip: In support channels, this will be referenced as the
3.1 Copy .env.example to .env
We must first copy the
.env.example file to
copy .env.example .env
cp .env.example .env
Now we can start configuring the variables in the
.env file. See next step 3.2 .env file.
3.2 .env info
POSTGRES_PASSWORD: The password to the PostgreSQL database.
POSTGRES_USER: The username to the PostgreSQL database.
DB_HOST: The database host. Most likely
DB_PORT: The port to the database.
POSTGRES_DB: The database name.
BOT_TOKEN: The token to your bot application.
4. Build the bot
5. Starting the bot
After completing all the steps above, we are ready to start the bot. To do this run the following command:
You can also start the SnailyCAD bot with
pm2. Make sure to install it first.
npm install -g pm2
Then run the following command:
pm2 start yarn --name "snailycad-bot" -- start
6. Using the bot
Head over to the the next section to learn how to use the bot.