While trying to decide on a project, we were joking about building an app to roast your friends. Saturday morning after one idea failed, we decided to work on the bot as something fun until we found a 'real' idea. Eventually it became the real project.
What it does
@roastmebot will reply to any user that says "roast me" or the name of the bot. It replies with a roast that has been scraped from r/roastme on reddit, as well as a roast that has been generated through Markov chains. Additionally, a sentiment analysis is performed on each statement and their respective scores are printed.
How we built it
The bot is built using the 'slackbots' api in node.js. A custom web scaper scrapes the top posts in the roastme subreddit for comments, finds all the comments with a score greater than 4, then sorts them but upvotes. The 'markov-chains' npm module was used to generate the custom roasts. One of our team members wrote a custom wrapper that uses Slack's api for mentions, because the slackbots api does not support mentioning.
Challenges we ran into
Many of our functions are asynchronous, so handling their successful (and expected) operations was a huge challenge. We definitely learned a lot about how callbacks work. Finding a library for the Markov Chains that worked was difficult, and assembling the necessary data in the proper format (an array of single dimension arrays containing roasts) was challenging. Implementing a mention system was difficult as well, due to the lack of support from our chosen bot-building API. Small changes to bot properties, such as the name, led to hard to debug errors as well.
Accomplishments that we're proud of
We turned a silly project that could have been called finished at the first message sent into something meaningful that took a lot of effort and has hilarious results. The Markov Chain roasts are often harsher than the reddit roasts, leading to shocking, yet amusing, results.
What we learned
Nested callbacks are hell. Not every npm module is created equal. Reddit's denizens are incredibly witty and acerbic, making for very interesting roasts and generated roasts. According to our sentiment analysis, (very) sarcastic posts are generally about as positive as the (very) mean posts are negative. While the algorithm has trouble differentiating sincerity from sarcasm, this interesting correlation helps us notice it in the data.
What's next for Roastbot
Assuming that the Slack integration app store is ok with non-PC topics, we would love to submit it and allow other teams to roast each other. Another goal is setting up more user-friendly configuration, and also creating a custom command (/roast @John for example) that will directly roast a user, without involving the bot. Our scraper, Markov Chain algorithm, and sentiment analysis are also not tied to Slack, so we could extend the project to Twitter, Facebookm etc. as well.