-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsetup.py
More file actions
54 lines (40 loc) · 1.66 KB
/
Copy pathsetup.py
File metadata and controls
54 lines (40 loc) · 1.66 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import subprocess
import sys
import os.path
from os import path
######## This script is only for educational purpose ########
######## use it on your own RISK ########
######## I'm not responsible for any loss or damage ########
######## caused to you using this script ########
######## Github Repo - https://github.com/Dark-Princ3/DTU-Alert-Bot/ ########
def install(name):
subprocess.check_call([sys.executable, '-m', 'pip', 'install', name])
def main():
my_packages = ['Pyrogram', 'TgCrypto', 'psycopg2-binary', 'python-dotenv',
'lxml', 'bs4', 'requests', 'urllib3', 'pymongo', 'dnspython']
env_vars = ['TG_BOT_TOKEN', 'API_ID',
'API_HASH', 'AUTH_CHANNEL', 'MONGO_URL']
for package in my_packages:
install(package)
print('\n')
print("\n[*] Setting up Environment Variables. Please get the values ready.",
"\n!!! Please read the repo's README for details on Enivronment variables.")
if path.exists("config.env"):
os.remove("config.env")
fp = open('config.env', 'a+')
for index, pr in enumerate(env_vars, start=1):
print('\n[*] ' + str(index) + ' ' + pr)
inpErr = True
while inpErr != False:
userInput = input()
if not userInput:
print("No input detected. Terminating.")
sys.exit()
else:
var_key = env_vars[index - 1]
var_value = userInput
fp.write(var_key + '="{}"\n'.format(var_value))
inpErr = False
print('\n[*]Setup Completed! To add optional vars, copy from sample_config.env .')
if __name__ == '__main__':
main()