Ducky is a domain specific Slack chatbot to help coders think through their coding challenges, but Ducky also seeks to address common ethical issues with bots such as discouraging abuse and responding appropriately to serious personal comments.
It's 2am and you've hit a roadblock in your code. What the Duck are you supposed to do? Rubber Ducky Slackbot to the rescue! Ducky can serve as a rubber duck for the purposes of thinking through your coding blockers. Ducky can ask you questions and provide links to relevant Stack Overflow questions based on your input. Ducky will help speed you to the epiphany you're looking for to solve your coding troubles!
Screen shots and explanations of Ducky's features
- Using Ducky's name signifies you are asking them a question a personal question.
- Adding "google", "help", "documentation", or "show me" to your input will cause Ducky to return a link to a Stack Overflow answer.
- Writing "Ducky, markov chain me" or including the word "Shakespeare" in user input will cause Ducky to generate a 100 word poem in the style of a Shakespeare Sonnet generated using a Markov Chain.
Visualization of Ducky's Decision Making Process in Developing Responses to User Input
- Clone the repo
- Create a bot user if you don't have one yet, and copy the API Token
- Set your Slack API token via the command line:
export SLACK_TOKEN="your-api-token"
- Download and start running ngrok. Helpful ngrok tips
- Once you're running ngrok in a terminal window, copy and paste the forwarding URL into the Slack Outgoing Webhooks page on the 'outgoing webhook integration' line.
- On the Slack Outgoing Webhooks page, scroll down to the Integration Settings section. Select “#general” (or whichever channel(s) you want to use Ducky in) as the channel to listen on. Copy your ngrok Forwarding URL plus “/slack” into the URL(s) text box. Copy the generated Token. Scroll down and press the “Save Settings” button. If deploying on AWS (for example Elastic Beanstalk) include that link (plus "/slack") instead or in addition.
- Set the Slack secret token via the command line:
export SLACK_OUTGOING_WEBHOOK_SECRET='your-copied-token'
- Visit the [Google APIs Console](https://console.developers.google.com/apis to get an API key for your application. Set the Google API Key variable via the command line:
export GOOGLE_API_KEY='your-copied-token'
- Obtain a Google Custom Search ID. When set, the custom search engine will be used instead of Google Web Search. Set the Google Custom Search ID via the command line:
export CSE_ID='your-copied-token'
pip install -r requirements.txt
flask run
- Invite Ducky into the channel(s) you designated on the Slack Outgoing Webhooks page. Ducky will respond to any message in that channel, so it's recommended to create a separate channel for just you and Ducky to talk.
These instructions can be used to develop, run, and test Ducky locally. To deploy Ducky set the necessary environment variables via the established patterns of your system. For example, if deploying on AWS, environment variables can be set through the Elastic Beanstalk console instead.
Using a virtualenv is recommended with Python applications.
The following tutorials were particularly helpful in the development of this project:
- Brobot by Liza Daly
- Getting Started With the Slack API Using Python and Flask by Matt Makai
- Implementing the Famous ELIZA chatbot in Python by Evan Dempsey
- Markov Chains: The Imitation Game
- ML Basics: Markov Models Write Fairy Tales
This project is licensed under the MIT License.