32 lines
851 B
Bash
Executable File
32 lines
851 B
Bash
Executable File
#!/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
|