This is a very simple bot to keep an eye on an our SGE instance (for now).
# create a Python virtual environment anywhere you like:
virtualenv /groups/merenlab/virtual-envs/barhalbot/
# activate it:
source /groups/merenlab/virtual-envs/barhalbot/bin/activate
# install slackclient for python:
pip install slackclient
# add an alias to activate it:
echo 'alias barhal-bot-activate="source /groups/merenlab/virtual-envs/barhalbot/bin/activate"' >> ~/.bash_profile
source ~/.bash_profile
# get a copy of the repository
cd /groups/merenlab/github/
git clone https://github.com/merenlab/barhal-bot.git
# activate the bot and get into the source code dir
barhal-bot-activate
cd /groups/merenlab/github/
# run it
export SLACK_BOT_TOKEN='SLACK TOKEN HERE'
./bot
If you get an certificate error, it is due to a bug upstream. In which case you can download this file once:
wget https://www.tbs-certificats.com/issuerdata/DigiCertGlobalRootCA.crt
And you can export the following environmental variable before you run it:
export WEBSOCKET_CLIENT_CA_BUNDLE=DigiCertGlobalRootCA.crt
When the --test-command
parameter is given, the bot will not try to connect to Slack and will simply run the command and return the response to the terminal:
./bot --test-command test
./bot --test-command queue
./bot --test-command queue user oesen
The very initial version of this bot was inspired from the tutorial by Matt Makai.