Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time


Scripts and code to make a slack bot that's almost, but not quite entirely unlike Libby.

This code is a couple of hours' work and therefore adapts others' code and may in places be shit. All the shit parts are mine. It uses python for the ML parts, node for the slackbot and ruby and bash for scripting.

see for more detail.

For a Pi 4

Burn a 16GB+ SD card using Etcher

then, on a laptop

touch /Volumes/boot/ssh
nano /Volumes/boot/wpa_supplicant.conf

set wifi contents

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Boot up the pi and log in.

Use virtualenv

sudo apt-get install python3-venv
python3 -m venv env
cd env/
source bin/activate

Download checkout the gpt-2 finetuning repo

git clone
cd gpt-2/
git checkout finetuning
pip3 install -r requirements.txt 
mkdir models

Add the fine-tuned model

'libby' is the name of my pre-built fine-tuned model - see the blog post or for more detail on how

mv ~/libby models/
mv ~/ src/
pip3 install flask
pip3 install numpy
sudo apt-get install libatlas-base-dev
curl -O
pip3 install tensorflow-1.13.1-cp37-none-linux_armv7l.whl
python3 src/

Add the slackbot

sudo apt-get install npm
npm install
SLACK_API_TOKEN="xxx" node real_libby_slackbot.js

real_libby_multi_slackbot.js is a special version for when there are several bots and you want them to communicate.

Add systemd scripts

Edit real_libby_slack.service to add the slack api token, then

sudo cp systemd/*.service /lib/systemd/system/
sudo systemctl enable /lib/systemd/system/real_libby_server.service
sudo systemctl start real_libby_server.service
sudo systemctl enable /lib/systemd/system/real_libby_slack.service
sudo systemctl start real_libby_slack.service

sudo tail -f /var/log/syslog 

Running more than one


BOT_NAME="real_tim" SLACK_API_TOKEN="xxxx" /usr/bin/node slackbots/real_libby_multi_slackbot.js

with a config file (see example)