- Bundle (preferably)
- Dialogflow account & project
Running the bot
- Clone this repository
bundle installto install the dependencies (or
gem install discordrband
gem install api-ai-ruby)
- Set environment variables:
BOT_TOKENto the bot's token
BOT_GAMEto the game you want the bot to be "playing"
ActualChannelIdHere_CLIENT_TOKENto the DialogFlow Client Access Token to be used for each channel you want the bot to respond in (replace ActualChannelIdHere with the actual channel ID).
- Run with
DialogFlow is an API that is very similar in functionality to Siri, Alexa, Cortana, Ok Google, etc. For this project, we're using the text-based, machine-learning portion to detect topics and when to produce replies. Conveniently, a DialogFlow agent can be edited collaboratively and updates immediately, so multiple people can provide topics and responses for the bot without having to restart the bot nor have access to the bot's hosting.
- Create an agent (and set the token to the environment as listed above)
- Delete the default fallback and welcome intents!
- Create an intent (name doesn't matter but should reflect the topic of the autoreply)
- Provide example phrases in the Training phrases and one or more replies in the Responses section (see image below)
- Repeat steps 3-4 for every topic you want the bot to cover
Can I add Phoenix (your copy) to my server?
Probably not. I might take requests from people that frequently interact with my servers, but generally you should just host your own copy.
Why did you do this on a per-channel basis instead of per-server?
First of all, you can use the same DialogFlow token multiple times if you wish; just set multiple CHANNELID-ClientToken environment variables to the same token. Secondly, this bot is meant for more in-depth replies; if you want more-basic autoreply functionality I'm sure there are other bots out there that already do this.
Why use DialogFlow instead of looking for keywords?
Less work for more gain. DialogFlow is (generally) going to produce more-accurate results than simple keyword detection, and has the added benefit of already having an easy-to-use, collaborative interface.
Why did you use Ruby for this?
I felt like trying something new; I'd never written/run Ruby before, so why not?