Discord is a platform that supports a community of curious individuals, ranging from businesses all the way to gamers. There is an overwhelming amount of knowledge, expertise, and advice being shared in the channels every second, including some topics that you might need more insight on. Speaking firsthand as programmers that are constantly exchanging technical information, we noticed that it gets cumbersome to have to leave discord everytime you want to do more research on the topic being discussed. To tackle this problem, we decided to implement an interface to the popular howdoi python tool through a discord bot to provide more information on a given topic right there in the discord channel.
What it does
Given an user prompt of "howdoi" followed by a question or topic and user specified parameters, our bot returns a helpful answer by leveraging howdoi.py. We also have support for different types of user queries, i.e, if they just want to get the link(s) to the answer or the full content of the answer. In the case that howdoi is not able to find anything or if the user has indicated that they are dissatisfied with the answer, we save these logs and prompt WikiHow to possibly provide more information on the topic.
How we built it
We built a custom bot through our discord account and sent it to our server. We used Python to write and specify code that handles our bots behaviour, such as listening and responding to events like when the 'howdoi' prompt is detected. We customized discord's Embed constructor to improve the overall UI and results. We set all this up on a Flask server running on Heroku. We created a parser helper script to set custom parameters based on user input that controls what type of response they want to be returned. We log details of the user query when feedback is detected into a JSON file to be used for later analysis. In the case of negative feedback, we query WikiHow through the pywikihow API to increase chances of finding a relevant answer. We also built support for unit testing by leveraging HTTPie and pytest. When testing is set to true, our Flask server accepts HTTP requests to run through the test cases we specified in our test file.
Challenges we ran into
- Parsing and dealing with command line arguments
- Setting up Heroku
Accomplishments that we're proud of
- Succeeded in creating a helpful tool for a platform that we use often. Simply by sharing an invite link anyone can use this bot.
- Planned and collaborated on tasks really well
What we learned
- Learned more about different kinds of open source technologies that we hadn't worked with before
- Learned how to implement Github best practices in a working scenario such as using issues to track features that needed to be implemented and PRs to make sure code being added was up to standard and didn't break anything.
What's next for howDoIDiscord
- Accumulating the logs with the user feedback and analysing this data to implement machine learning models (i.e. show less responses that users have identified negative)
- Possibly implementing some more cli flags from howdoi to give even more flexibility in the output of the bot.