What is it?
Tea roulette is a random selector tool that fairly decides who’s making tea from an inputted set of choices.
Why did we create it?
At Drew, we all LOVE tea but we always fuss about who’s making the next brew. We came up with a fairer way of deciding who should be the one to get up and make the round.
Originally planned to be just for tea, we decided to make this a general random picker of things out of a list.
How did we create it?
This was one of our 30 minute builds, where we see if we can come up with a solution from conception to completion in 30 minutes.
After a 5 minute brainstorm we decided on a Slack slash command. We use Slack heavily in the office and this meant we could ensure everyone could get in on the tea making action.
Within Slack, we created a custom slash command called /pickem and had it send a GET request to our server.
On our server we created a receiver that took in what was written in Slack.
In order to use the command, users needed to used the following convention:
/pickem [question]? [choice 1] [choice 2] [choice 3] [choice n]
/pickem Who should make tea? Nadeem Joe Shannon Elle
/pickem Where should we eat for lunch? Chicken Burgers Pizza
When the server receives the question, we split by the ‘?’ in order to separate the question from the various choices:
$split_question = explode(‘? ‘, $message);
We then randomised the choices in the array and made a choice:
Once the choice is picked we then posted the message back to slack:
As with everything at Drew, we always look to build on and improve our projects as needed.
After using this for a couple of months, everything was going very well but it was mentioned that somebody (who will remain nameless) didn’t exactly make the best cup of tea.
So we added the following to ensure that the tea making quality was kept to a certain standard…
array_diff($choices, array(‘rachel’, ‘Rachel’));