ubot/install

30 lines
788 B
Plaintext
Raw Normal View History

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
2021-03-28 23:17:31 +02:00
read -p "Do you wish to use a log chat? (y/n): " logrpl
if [ "$logrpl" = "y" ]
then
read -p "Log chat ID (logchat): " logchat
else
logchat="'me'"
fi
2021-03-26 21:51:02 +01:00
echo "api_id = $api_id" >> config.py
echo "api_hash = '$api_hash'" >> config.py
2021-03-28 23:17:31 +02:00
echo "logchat = $logchat" >> config.py
2021-03-26 21:51:02 +01:00
}
# 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