Lunchbot is a Slack bot to help organise lunch ordering in teams. When ordering in a group, it is often troublesome to keep track of who wants to participate, what food do they want and if they paid the ordering person (the Lunchmaster). This bot's goal is to help make that process more efficient and organised.
(pmxbot makes a brief appearance here)
Build the artifact using sbt assembly
. In your target
directory you'll find an executable file - run it to start the app.
You'll need to set up a bot user for the bot.
Then, set your bot API token at SLACK_API_KEY
environment variable, so: export SLACK_API_KEY=my_bot_key
.
Bot reacts to mentions, so if you set it up at the @lunchbot handle, you direct commands to it. Bot assigns reactions to messages processed successfully or responds textually with errors.
The available commands are: (Copied output from the help
command)
usage: <@lunchbot> [command]
[args...]
create
<name or URL of the place>
- creates a new lunch at<name or URL of the place>
close
- closes current lunch for order changesopen
- opens current lunch for further order changesfinish
- finishes current lunchsummary
- returns lunch summarypoke
- pokes all eaters that are lazy with their orderkick
<eater to kick>
- kicks<eater to kick>
from the current lunchjoin
- joins the current lunchleave
- leaves the current lunchchoose
<food name>
- chooses food with<food name>
pay
- notifies about payment being madehelp
- prints this usage textstats
- prints historic orders statistics
The general state flow of a lunch is:
create -> (eaters join) -> (eaters choose food) -> close -> (eaters pay) -> finish
The user which issues the create
command becomes the Lunchmaster, which allows him to administer the lunch state.
All other users join
the lunch to indicate they're interested in participation, then choose
the food they want. You can choose
again to overwrite your previous choice or leave
the lunch if you've changed your mind.
As Lunchmaster, you can poke
eaters to have the bot @mention them to hurry up with their choice. You can also kick
eaters from the lunch instance.
When a lunch is closed no more eaters can join and this indicates that the Lunchmaster grabs the phone / app / website of the restaurant and proceeds with placing the order for everyone.
When the order is closed the eaters can issue pay
commands to notify the Lunchmaster about making the payment. At this state, poke
works on eaters, who have not yet paid.
At any point, any user can issue summary
to see the current lunch state in detail.
Finally, you conclude the process with a finish
.
The stats
command returns counts per user, of how many times have they been the Lunchmaster. This can potentially help you resolve quarrels on who should order the next time or just be there for fun.
Statistics are stored in a persistent manner, along with all of the lunch state and state history, so bot crashes won't have you lose your precious lunch order.
You can customise your bot messages in messages.conf
.
Other (less interesting) params are kept in application.conf
.
The bot uses Akka Persistence with LevelDB journal plugin and local snapshot store - it will create journal/
and snapshots/
directories in its home directory for that.
Copyright (c) 2016-2017 Maciej Turło
Published under The MIT License, see LICENSE