File size: 3,917 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 |
# /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/>.
# Standalone file for facilitating local deploys.
import os
a = r"""
_ _ _ _ _ _
| | | | | | (_) | |
| | | | | |_ _ __ ___ _ __| |
| | | | | __| '__/ _ \| |/ _ |
| |__| | | |_| | | (_) | | (_| |
\____/|_|\__|_| \___/|_|\__,_|
"""
def start():
clear_screen()
check_for_py()
print(f"{a}\n\n")
print("Welcome to Ultroid, lets start setting up!\n\n")
print("Cloning the repository...\n\n")
os.system("rm -rf Ultroid")
os.system("git clone https://github.com/TeamUltroid/Ultroid")
print("\n\nDone")
os.chdir("Ultroid")
clear_screen()
print(a)
print("\n\nLet's start!\n")
# generate session if needed.
sessionisneeded = input(
"Do you want to generate a new session, or have an old session string? [generate/skip]",
)
if sessionisneeded == "generate":
gen_session()
elif sessionisneeded != "skip":
print(
'Please choose "generate" to generate a session string, or "skip" to pass on.\n\nPlease run the script again!',
)
exit(0)
# start bleck megik
print("\n\nLets start entering the variables.\n\n")
varrs = [
"API_ID",
"API_HASH",
"SESSION",
"REDIS_URI",
"REDIS_PASSWORD",
]
all_done = "# Ultroid Environment Variables.\n# Do not delete this file.\n\n"
for i in varrs:
all_done += do_input(i)
clear_screen()
print(a)
print("\n\nHere are the things you've entered.\nKindly check.")
print(all_done)
isitdone = input("\n\nIs it all correct? [y/n]")
if isitdone == "y" or isitdone != "n":
# https://github.com/TeamUltroid/Ultroid/blob/31b9eb1f4f8059e0ae66adb74cb6e8174df12eac/resources/startup/locals.py#L35
f = open(".env", "w")
f.write(all_done)
else:
print("Oh, let's redo these then.")
start()
clear_screen()
print("\nCongrats. All done!\nTime to start the bot!")
print("\nInstalling requirements... This might take a while...")
os.system("pip3 install --no-cache-dir -r requirements.txt")
os.system("pip3 install -r requirements.txt --break-system-packages")
ask = input(
"Enter 'yes/y' to Install other requirements, required for local deployment."
)
if ask.lower().startswith("y"):
print("Started Installing...")
os.system(
"pip3 install --no-cache-dir -r resources/startup/optional-requirements.txt"
)
else:
print("Skipped!")
clear_screen()
print(a)
print("\nStarting Ultroid...")
os.system("sh startup")
def do_input(var):
val = input(f"Enter your {var}: ")
return f"{var}={val}\n"
def clear_screen():
# clear screen
_ = os.system("clear") if os.name == "posix" else os.system("cls")
def check_for_py():
print(
"Please make sure you have python installed. \nGet it from http://python.org/\n\n",
)
try:
ch = int(
input(
"Enter Choice:\n1. Continue, python is installed.\n2. Exit and install python.\n",
),
)
except BaseException:
print("Please run the script again, and enter the choice as a number!!")
exit(0)
if ch == 1:
pass
elif ch == 2:
print("Please install python and continue!")
exit(0)
else:
print("Weren't you taught how to read? Enter a choice!!")
return
def gen_session():
print("\nProcessing...")
# https://github.com/TeamUltroid/Ultroid/main/resources/startup/locals.py#L35
os.system("python3 resources/session/ssgen.py")
start()
|