|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from . import * |
|
|
|
|
|
def main(): |
|
import os |
|
import sys |
|
import time |
|
|
|
from .fns.helper import bash, time_formatter, updater |
|
from .startup.funcs import ( |
|
WasItRestart, |
|
autopilot, |
|
customize, |
|
fetch_ann, |
|
plug, |
|
ready, |
|
startup_stuff, |
|
) |
|
from .startup.loader import load_other_plugins |
|
|
|
try: |
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler |
|
except ImportError: |
|
AsyncIOScheduler = None |
|
|
|
|
|
if ( |
|
udB.get_key("UPDATE_ON_RESTART") |
|
and os.path.exists(".git") |
|
and ultroid_bot.run_in_loop(updater()) |
|
): |
|
ultroid_bot.run_in_loop(bash("bash installer.sh")) |
|
|
|
os.execl(sys.executable, sys.executable, "-m", "pyUltroid") |
|
|
|
ultroid_bot.run_in_loop(startup_stuff()) |
|
|
|
ultroid_bot.me.phone = None |
|
|
|
if not ultroid_bot.me.bot: |
|
udB.set_key("OWNER_ID", ultroid_bot.uid) |
|
|
|
LOGS.info("Initialising...") |
|
|
|
ultroid_bot.run_in_loop(autopilot()) |
|
|
|
pmbot = udB.get_key("PMBOT") |
|
manager = udB.get_key("MANAGER") |
|
addons = udB.get_key("ADDONS") or Var.ADDONS |
|
vcbot = udB.get_key("VCBOT") or Var.VCBOT |
|
if HOSTED_ON == "okteto": |
|
vcbot = False |
|
|
|
if (HOSTED_ON == "termux" or udB.get_key("LITE_DEPLOY")) and udB.get_key( |
|
"EXCLUDE_OFFICIAL" |
|
) is None: |
|
_plugins = "autocorrect autopic audiotools compressor forcesubscribe fedutils gdrive glitch instagram nsfwfilter nightmode pdftools profanityfilter writer youtube" |
|
udB.set_key("EXCLUDE_OFFICIAL", _plugins) |
|
|
|
load_other_plugins(addons=addons, pmbot=pmbot, manager=manager, vcbot=vcbot) |
|
|
|
suc_msg = """ |
|
---------------------------------------------------------------------- |
|
Ultroid has been deployed! Visit @TheUltroid for updates!! |
|
---------------------------------------------------------------------- |
|
""" |
|
|
|
|
|
plugin_channels = udB.get_key("PLUGIN_CHANNEL") |
|
|
|
|
|
ultroid_bot.run_in_loop(customize()) |
|
|
|
|
|
if plugin_channels: |
|
ultroid_bot.run_in_loop(plug(plugin_channels)) |
|
|
|
|
|
if not udB.get_key("LOG_OFF"): |
|
ultroid_bot.run_in_loop(ready()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ultroid_bot.run_in_loop(WasItRestart(udB)) |
|
|
|
try: |
|
cleanup_cache() |
|
except BaseException: |
|
pass |
|
|
|
LOGS.info( |
|
f"Took {time_formatter((time.time() - start_time)*1000)} to start •ULTROID•" |
|
) |
|
LOGS.info(suc_msg) |
|
|
|
|
|
if __name__ == "__main__": |
|
main() |
|
|
|
asst.run() |
|
|