File size: 8,353 Bytes
618430a |
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# /usr/bin/python3
# Ultroid - UserBot
# Copyright (C) 2021-2025 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# Please read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
from datetime import datetime
from os import path, system
from time import sleep
from colorama import Back, Fore, Style
# clear screen
def clear():
system("clear")
MANDATORY_REQS = [
"https://github.com/New-dev0/Telethon/archive/Cartoon.zip",
"gitpython",
"enhancer",
"telegraph",
"requests",
"python-decouple",
"aiohttp",
]
OPT_PACKAGES = {
"bs4": "Used for site-scrapping (used in commands like - .gadget and many more)",
"yt-dlp": "Used for Youtuble Related Downloads...",
"youtube-search-python": "Used for youtube video search..",
"pillow": "Used for Image-Conversion related task. (size - approx 50mb ) (required for kang, convert and many more.)",
"psutil": "Used for .usage command.",
"lottie": "Used for animated sticker related conversion.",
"apscheduler": "Used in autopic/nightmode (scheduling tasks.)",
# "git+https://github.com/1danish-00/google_trans_new.git": "Used for translation purposes.",
}
APT_PACKAGES = ["ffmpeg", "neofetch", "mediainfo"]
DISCLAIMER_TEXT = ""
COPYRIGHT = f"Β©οΈ TeamUltroid {datetime.now().year}"
HEADER = f"""{Fore.MAGENTA}
ββ ββββ ββ ββ
ββ ββββ ββββ ββ
ββ ββββ βββββββββββββββββ
ββ ββββ ββ ββββββββ β£ββββ
ββββββββ βββββ ββββββββββ
ββββββββ βββββ ββββββββββ\n{Fore.RESET}
"""
INFO_TEXT = f"""
{Fore.GREEN}# Important points to know.
{Fore.YELLOW}1. This script will just install basic requirements because of which some command whose requirements are missing won't work. You can view all optional requirements in (./resources/startup/optional-requirements.txt)
2. You can install that requirement whenever you want with 'pip install' (a very basic python+bash knowledge is required.)
3. Some of the plugins are disabled for 'Termux Users' to save resources (by adding in EXCLUDE_OFFICIAL).
- Read More - https://t.me/UltroidUpdates/36
- Also, way to enable the disabled plugins is mentioned in that post.
# Disabled Plugins Name
- autocorrect - compressor
- Gdrive - instagram
- nsfwfilter - glitch
- pdftools - writer
- youtube - megadl
- autopic - nightmode
- blacklist - forcesubscribe
4. You can't use 'VCBOT' on Termux.
5. You can't use 'MongoDB' on Termux (Android).
{Fore.RESET}
* Hope you are smart enought to understand.
* Enter 'A' to Continue, 'E' to Exit..\n
"""
def ask_and_wait(text, header: bool = False):
if header:
text = with_header(text)
print(text + "\nPress 'ANY Key' to Continue or 'Ctrl+C' to exit...\n")
input("")
def with_header(text):
return HEADER + "\n\n" + text
def yes_no_apt():
yes_no = input("").strip().lower()
if yes_no in ["yes", "y"]:
return True
elif yes_no in ["no", "n"]:
return False
print("Invalid Input\nRe-Enter: ")
return yes_no_apt()
def ask_process_info_text():
strm = input("").lower().strip()
if strm == "e":
print("Exiting...")
exit(0)
elif strm != "a":
print("Invalid Input")
print("Enter 'A' to Continue or 'E' to exit...")
ask_process_info_text()
def ask_process_apt_install():
strm = input("").lower().strip()
if strm == "e":
print("Exiting...")
exit(0)
elif strm == "a":
for apt in APT_PACKAGES:
print(f"* Do you want to install '{apt}'? [Y/N] ")
if yes_no_apt():
print(f"Installing {apt}...")
system(f"apt install {apt} -y")
else:
print(f"- Discarded {apt}.\n")
elif strm == "i":
names = " ".join(APT_PACKAGES)
print("Installing all apt-packages...")
system(f"apt install {names} -y")
elif strm != "s":
print("Invalid Input\n* Enter Again...")
ask_process_apt_install()
def ask_and_wait_opt():
strm = input("").strip().lower()
if strm == "e":
print("Exiting...")
exit(0)
elif strm == "a":
for opt in OPT_PACKAGES.keys():
print(
f"* {Fore.YELLOW}Do you want to install '{opt}'? [Y/N]\n- {OPT_PACKAGES[opt]}"
)
if yes_no_apt():
print(f"Installing {opt}...")
system(f"pip install {opt}")
else:
print(f"{Fore.YELLOW}- Discarded {opt}.\n")
elif strm == "i":
names = " ".join(OPT_PACKAGES.keys())
print(f"{Fore.YELLOW}Installing all packages...")
system(f"pip install {names}")
elif strm != "s":
print("Invalid Input\n* Enter Again...")
ask_and_wait_opt()
def ask_make_env():
strm = input("").strip().lower()
if strm in ["yes", "y"]:
print(f"{Fore.YELLOW}* Creating .env file..")
with open(".env", "a") as file:
for var in ["API_ID", "API_HASH", "SESSION", "REDIS_URI", "REDIS_PASSWORD"]:
inp = input(f"Enter {var}\n- ")
file.write(f"{var}={inp}\n")
print("* Created '.env' file successfully! π")
else:
print("OK!")
# ------------------------------------------------------------------------------------------ #
clear()
print(
f"""
{Fore.BLACK}{Back.WHITE} _____________
ββ ββ βββ βββββββ ββββββ βββββββ βββ ββββββ
β β β β β β β β β β β β β
β β β β β ββ ββ β β β β β β β β β
β βββ β β β β β ββββββ β β β β β β β
β β ββββ β β β ββ β βββ β β βββ β
β β β β β β β β β β β β
βββββββββββββββββ βββββ βββββ ββββββββββββββββββββββ
{Style.RESET_ALL}
{Fore.GREEN}- ULTROID Termux Installation -
The Main Aim of this script is to deploy Ultroid with basic requirements and save your phone resources.
{Fore.RESET}
{COPYRIGHT}
"""
)
print("Press 'Any Key' to continue...")
input("")
clear()
print(with_header(INFO_TEXT))
ask_process_info_text()
clear()
print(with_header("Installing Mandatory requirements..."))
all_ = " ".join(MANDATORY_REQS)
system(f"pip install {all_}")
clear()
print(
with_header(
f"\n{Fore.GREEN}# Moving toward Installing Apt-Packages{Fore.RESET}\n\n"
)
)
print("---Enter---")
print(" - A = 'Ask Y/N for each'.")
print(" - I = 'Install all'")
print(" - S = 'Skip Apt installation.'")
print(" - E = Exit.\n")
ask_process_apt_install()
clear()
print(
with_header(
f"""
{Fore.YELLOW}# Installing other non mandatory requirements.
(You can Install them, if you want command using them to work!){Fore.RESET}
{'- '.join(list(OPT_PACKAGES.keys()))}
Enter [ A = Ask for each, I = Install all, S = Skip, E = Exit]"""
)
)
ask_and_wait_opt()
print(f"\n{Fore.RED}#EXTRA Features...\n")
print(f"{Fore.YELLOW}* Do you want to get Ultroid Logs in Colors? [Y/N] ")
inp = input("").strip().lower()
if inp in ["yes", "y"]:
print(f"{Fore.GREEN}*Spoking the Magical Mantras*")
system("pip install coloredlogs")
else:
print("Skipped!")
clear()
if not path.exists(".env"):
print(with_header("# Do you want to move toward creating .env file ? [y/N] "))
ask_make_env()
print(with_header(f"\n{Fore.GREEN}You are all Done! π₯³"))
sleep(0.2)
print(f"Use 'bash startup' to try running Ultroid.{Fore.RESET}")
sleep(0.5)
print(
"\nYou can head over to @UltroidSupportChat, if you get stuck somewhere, and need help."
)
sleep(0.5)
print("\nMade with β€οΈ by @TeamUltroid...")
system("pip3 uninstall -q colorama -y")
|