forked from tylarb/KarmaBoi-PCF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
executable file
·33 lines (25 loc) · 905 Bytes
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Creates an approproriate environment for the bot to run. Please
# ensure you set create a bot token file in $BOT_HOME
#
#
# Released under MIT license, copyright 2018 Tyler Ramer
DIR=`pwd`
export BOT_HOME=~/.KarmaBoi
token=$BOT_HOME/bot_token
if [ ! -d $DIR/KarmaBoi/env_KarmaBoi ]; then
echo 'setting up for the first time'
python3 -m venv $DIR/KarmaBoi/env_KarmaBoi
source $DIR/KarmaBoi/env_KarmaBoi/bin/activate
pip install -r $DIR/requirements.txt
fi
echo $token
if [ -f $token ]; then
echo "found bot token"
export SLACK_BOT_NAME=$(grep name $token| cut -d : -f 2)
export SLACK_BOT_TOKEN=$(grep token $token| cut -d : -f 2)
source $DIR/KarmaBoi/env_KarmaBoi/bin/activate
pip install -r $DIR/requirements.txt
else
echo "Please add your bot name and token at ~/.KarmaBoi/bot_token\nhttps://api.slack.com/bot-users\n\nFORMAT: \nname:[bot-name]\ntoken:[bot-token]"
fi