Configuration
Before anything else, head over to your bot config and enable the API server and Websocket client.
Client
- Copy the
client/.env.example - Fill in all the variables
info
You can find your bot's secret in your Discord Developer Portal. Click on your application and then go to the OAuth2 tab. You will find it under the Client Secret section.
- Go on your Discord Developer Portal
- Click on your application
- Go to the
OAuth2tab - Add the following redirect URIs:
- http://localhost:3000/api/auth/callback/discord
- <your_domain>/api/auth/callback/discord (if you are running the app on a domain in production)
- Copy the
Client Idand theClient Secret - Paste them in the
.env.examplefile, as well as your bot API admin token. - Rename the file
.env - Go to the
client/src/core/config/bots.ts - Fill in your bot info (here is a sample)
{
id: '943804890143133736',
name: 'TSCord',
iconUrl: 'https://cdn.discordapp.com/avatars/943804890143133736/c08ad02818b89d43210a232094b32215.webp',
apiUrl: process.env['TSCORD_API_URL']!,
apiToken: process.env['TSCORD_API_TOKEN']!,
secret: process.env['TSCORD_SECRET']!
}tipAs you may have noticed, the bots config is an array, so you can setup multiple bots!
- Run
npm run buildin theclientfolder - Then, run
npm run start
Websocket
In order to make the Monitoring dashboard page working, you must spin up the Websocket proxy server on which your bot and your Next.js app will connect.
- Edit the
proxy/.env.exampleat your convenance - Rename it
.env - Put the correct websocket url to access the proxy server both in the Next.js app and TSCord bot env files
- Go to the
proxyfolder - Run
npm run build - Run
npm run start - Now, if your bot is running in parallel, you should see in the console:
New client connected: <name_of_your_bot>