The club works by one person writing "anybody up for lunch?" in a messenger
thread, the people that want to join then reacts to the message with a 👍
emoji.
Run the following set of commands to get a local development environment
$ pip3 install virtualenv
$ virtualenv -p `which python3` virtualenv
$ source virtualenv/bin/activate
$ pip install -r requirements.txt
$ pip install git+https://github.com/carpedm20/fbchat.git@refs/pull/371/head
You also need two credential files, one must be located at src/config.ini
and
it must contain the following.
[FACEBOOK]
email = <email>
password = <password>
thread_id = <Thread_id>
The other credential file is for the google sheet, follow the setup guide to obtain the file.
The two main dependencies are FBchat which is the library used for interaction with messenger, and Gspread that interacts with Google Sheets.
The code is split into two parts, one part the does the balance sheet and keeps tracks of lunches. The other part is a chatbot that does fun/annoying things.
- src/FbBot.py and googleBot.py These files wrap around the apis for messenger and sheets. They are used for the balance sheet part of the code.
- src/main.py This files combines the two above parts to get the lunch balance, the file is made to be run about once per week with no state. Only place code that is Idempotent
- src/chatBot.py
This is the fun part of the code, here the bot actually writes in the
chat, this file extends the class described here. The code is
event driven so look at the functions of the form
onEventHappend
for instanceonMessage
. Additional Inspiration can be found here
- Write message about lunch on every weekday
- Welcome new members and add them to sheet
- Put in production
- Improve message detection
- Add jokes and shit to chatbot
- Any ideas?
-
Write function that gets all names -
Write function that gets all lunches -
Function that creates a the table of lunhces -
Environment setup