azils3/bash
0
1# Ultroid - UserBot2# Copyright (C) 2021-2025 TeamUltroid3#4# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >5# PLease read the GNU Affero General Public License in6# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.7 8from . import *9 10 11def main():12 import os13 import sys14 import time15 16 from .fns.helper import bash, time_formatter, updater17 from .startup.funcs import (18 WasItRestart,19 autopilot,20 customize,21 fetch_ann,22 plug,23 ready,24 startup_stuff,25 )26 from .startup.loader import load_other_plugins27 28 try:29 from apscheduler.schedulers.asyncio import AsyncIOScheduler30 except ImportError:31 AsyncIOScheduler = None32 33 # Option to Auto Update On Restarts..34 if (35 udB.get_key("UPDATE_ON_RESTART")36 and os.path.exists(".git")37 and ultroid_bot.run_in_loop(updater())38 ):39 ultroid_bot.run_in_loop(bash("bash installer.sh"))40 41 os.execl(sys.executable, sys.executable, "-m", "pyUltroid")42 43 ultroid_bot.run_in_loop(startup_stuff())44 45 ultroid_bot.me.phone = None46 47 if not ultroid_bot.me.bot:48 udB.set_key("OWNER_ID", ultroid_bot.uid)49 50 LOGS.info("Initialising...")51 52 ultroid_bot.run_in_loop(autopilot())53 54 pmbot = udB.get_key("PMBOT")55 manager = udB.get_key("MANAGER")56 addons = udB.get_key("ADDONS") or Var.ADDONS57 vcbot = udB.get_key("VCBOT") or Var.VCBOT58 if HOSTED_ON == "okteto":59 vcbot = False60 61 if (HOSTED_ON == "termux" or udB.get_key("LITE_DEPLOY")) and udB.get_key(62 "EXCLUDE_OFFICIAL"63 ) is None:64 _plugins = "autocorrect autopic audiotools compressor forcesubscribe fedutils gdrive glitch instagram nsfwfilter nightmode pdftools profanityfilter writer youtube"65 udB.set_key("EXCLUDE_OFFICIAL", _plugins)66 67 load_other_plugins(addons=addons, pmbot=pmbot, manager=manager, vcbot=vcbot)68 69 suc_msg = """70 ----------------------------------------------------------------------71 Ultroid has been deployed! Visit @TheUltroid for updates!!72 ----------------------------------------------------------------------73 """74 75 # for channel plugins76 plugin_channels = udB.get_key("PLUGIN_CHANNEL")77 78 # Customize Ultroid Assistant...79 ultroid_bot.run_in_loop(customize())80 81 # Load Addons from Plugin Channels.82 if plugin_channels:83 ultroid_bot.run_in_loop(plug(plugin_channels))84 85 # Send/Ignore Deploy Message..86 if not udB.get_key("LOG_OFF"):87 ultroid_bot.run_in_loop(ready())88 89 # TODO: Announcement API IS DOWN90 # if AsyncIOScheduler:91 # scheduler = AsyncIOScheduler()92 # scheduler.add_job(fetch_ann, "interval", minutes=12 * 60)93 # scheduler.start()94 95 # Edit Restarting Message (if It's restarting)96 ultroid_bot.run_in_loop(WasItRestart(udB))97 98 try:99 cleanup_cache()100 except BaseException:101 pass102 103 LOGS.info(104 f"Took {time_formatter((time.time() - start_time)*1000)} to start •ULTROID•"105 )106 LOGS.info(suc_msg)107 108 109if __name__ == "__main__":110 main()111 112 asst.run()113 