2021-03-26 21:51:02 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Functions
|
|
|
|
mkconfig(){
|
|
|
|
echo "Please get your credentials from https://my.telegram.org."
|
|
|
|
read -p "App API ID (api_id): " api_id
|
|
|
|
read -p "App API hash (api_hash): " api_hash
|
|
|
|
echo "api_id = $api_id" >> config.py
|
|
|
|
echo "api_hash = '$api_hash'" >> config.py
|
|
|
|
}
|
|
|
|
|
|
|
|
# Preliminary sanity checks
|
2021-03-26 21:57:06 +01:00
|
|
|
[ $(id -u) = 0 ] && echo "Please do not run as root." && exit 1
|
2021-03-26 21:51:02 +01:00
|
|
|
[ ! -f ubot.py ] && echo "ubot.py not found, quitting." && exit 1
|
|
|
|
[ $0 != ./install ] && echo "Not launched from current directory." && exit 1
|
|
|
|
|
2021-03-26 23:01:07 +01:00
|
|
|
[ ! -f config.py ] && mkconfig
|
2021-03-26 21:57:06 +01:00
|
|
|
git pull
|
|
|
|
pip3 install -U telethon --user
|
|
|
|
|
2021-03-26 21:51:02 +01:00
|
|
|
return 0
|