The corest of Discord bots
!quotes
: To get a dump of all available quotes, in JSON format.!quotes add <text>
: To add a new quote to the bot. You can enclose the input in double quotes if you prefer, but it is not necessary. This command will return the quote ID.!quotes remove <id>
: To remove an existing quote from the bot.
!triggers
: To get a dump of all current trigger words, in JSON format.!triggers add <text>
: To add a new trigger word to the bot. You can enclose the input in double quotes if you prefer, but it is not necessary. This command will return the trigger ID.!triggers remove <id>
: To remove an existing trigger from the bot.
- NodeJS
- Active Discord application with bot user capability, go here to register one
- Either an Azure Cosmos DB account, or the Azure Cosmos DB emulator
- Active Google Cloud account (for natural language APIs)
- Any Discord server to invite the bot to, for testing purposes
The bot uses Cosmos DB to manage its trigger words and messages. On startup, it creates a corebot
database (if not created already) with two containers, quotes
and triggers
.
To debug the bot locally, you must set these environment variables:
BOT_TOKEN
(you can grab it from the Discord developer portal, in the Bot section of your application)COSMOS_ENDPOINT
COSMOS_KEY
NODE_TLS_REJECT_UNAUTHORIZED
(only when using Azure Cosmos DB emulator; set to 0 if you have issues with the self-signed certificate from the emulator)GOOGLE_APPLICATION_CREDENTIALS
(must point to a local JSON file containing your service account key, more info here https://cloud.google.com/natural-language/docs/setup#auth)
Once configured, run:
$ npm i
$ npm start
You can invite the bot to your server with this link https://discord.com/oauth2/authorize?scope=bot&client_id=<BOT_ID>
. The bot ID can be retrieved from the Discord developer portal, in the Application section (it's called Application ID
).