Add installer

This commit is contained in:
Michael De Roover 2021-11-28 00:34:40 +01:00
parent bd5eb5b951
commit 31d0fd7c51
Signed by: vim
GPG Key ID: 075496E232CE04CB

31
install Executable file
View File

@ -0,0 +1,31 @@
#!/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
read -p "Your user ID: " myid
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
echo "api_id = $api_id" >> config.py
echo "api_hash = '$api_hash'" >> config.py
echo "myid = $myid" >> config.py
echo "logchat = $logchat" >> config.py
}
# Preliminary sanity checks
[ $(id -u) = 0 ] && echo "Please do not run as root." && exit 1
[ ! -f log.py ] && echo "log.py not found, quitting." && exit 1
[ $0 != ./install ] && echo "Not launched from current directory." && exit 1
[ ! -f config.py ] && mkconfig
git pull
pip3 install -U telethon --user
return 0