This repository contains the source code for the mini-course Building Discord Bots with Twilio Autopiot. The course walks through creating a Discord bot that uses Twilio Autopilot to answer frequently asked questions.
To follow along, you'll need at least a free account with the following services:
The course walks through building a Discord bot that lets users get answers to frequently asked questions. Twilio Autopilot provides the AI for answering the questions, and Replit.com is used for hosting a web service to proxy requests between Discord and Autopilot.
At high level, there are five topics covered.
- Creating a Twilio Autopilot FAQ bot
- Setting up a Discord server
- Configuring a Discord bot application and bot user
- Authorizing bot access to a Discord server
- Creating a bot handler service using replit.com
- Login at twilio.com
- Create a new bot from the FAQs pre-trained template
- Create tasks to handel questions
- Test the bot using the autopilot simulator
- Note the
ACCOUNT SID
,AUTH TOKEN
, andASSISTANT SID
- Login at discord.com
- Create a new Discord server
- Login at discord.com
- Create a new discord application
- Create a Discord bot user
- Setup OAuth2
- Note the Discord bot
TOKEN
- Copy the Discord OAuth2 authorization URL
- Authorize access to the Discord server
- Login to replit.com
- Visit the GitHub repo with the handler code
- Click the
run on replit
button to copy the code to replit.com - Setup the following secrets/environment variable in Replit
TWILIO_ACCOUNT_SID
TWILIO_AUTH_TOKEN
TWILIO_BOT_SID
DISCORD_BOT_TOKEN
- Run the bot handler service
To test the Discord bot access the Discord server and ask a question in the following format.
!support {question}
- for example, !support Can i move my service?
You should see a response from the bot.
Done!