Beispiel #1
0
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(),
                    "userbot/plugins/",  # pylint:disable=E0602
                ))
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                shortname = path1.stem
                load_module(shortname.replace(".py", ""))
                await event.edit(
                    "Plugin successfully installed\n @blacklightningot `{}`".
                    format(os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await event.edit(
                    "**Error!**\nPlugin cannot be installed!\n Or may have been pre-installed."
                )
        except Exception as e:  # pylint:disable=C0103,W0703
            await event.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await event.delete()
Beispiel #2
0
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(),
                "userbot/plugins/"  # pylint:disable=E0602
            )
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                shortname = path1.stem
                load_module(shortname.replace(".py", ""))
                await event.edit(
                    "**✅ Plugin installato!**\n📚 **Plugin:** `{}`".format(
                        os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await event.edit(
                    "❌** Errore:** `Questo plugin è già installato.`")
        except Exception as e:  # pylint:disable=C0103,W0703
            await event.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await event.delete()
Beispiel #3
0
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), "userbot/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, "Eklenti `{}` başarıyla yüklendi.".format(
                    os.path.basename(downloaded_file_name)))
        else:
            await borg.send_message(
                event.chat_id,
                "Eklenti `{}` önceden yüklendi ve yüklenemez.".format(
                    os.path.basename(downloaded_file_name)))
Beispiel #4
0
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(),
                    "userbot/plugins/",  # pylint:disable=E0602
                ))
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                shortname = path1.stem
                load_module(shortname.replace(".py", ""))
                await event.edit(
                    "UPGRADING THE NEW PLUGIN.....\n  `{}`".format(
                        os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await event.edit(
                    "**ERROR DETECTED..!**\nPLUGIN WRONG... SED...!\n Or may have been pre-installed."
                )
        except Exception as e:  # pylint:disable=C0103,W0703
            await event.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await event.delete()
Beispiel #5
0
 async def install():
     documentss = await bot.get_messages(Config.EXTRA_HELLBOT,
                                         None,
                                         filter=InputMessagesFilterDocument)
     total = int(documentss.total)
     for module in range(total):
         plugin_to_install = documentss[module].id
         downloaded_file_name = await bot.download_media(
             await bot.get_messages(Config.EXTRA_HELLBOT,
                                    ids=plugin_to_install),
             "userbot/plugins/",
         )
         if "(" not in downloaded_file_name:
             path1 = Path(downloaded_file_name)
             shortname = path1.stem
             load_module(shortname.replace(".py", ""))
             await bot.send_message(
                 BOTLOG_CHATID,
                 f"Installed Plugin `{os.path.basename(downloaded_file_name)}` successfully.",
             ),
         else:
             await bot.send_message(
                 BOTLOG_CHATID,
                 f"Plugin `{os.path.basename(downloaded_file_name)}` has been pre-installed and cannot be installed.",
             )
             os.remove(downloaded_file_name)
Beispiel #6
0
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)

        await event.edit(f"Successfully loaded {shortname}")

    except Exception as e:

        await event.edit(
            f"Could not load {shortname} because of the following error.\n{str(e)}"
        )
Beispiel #7
0
async def install(event):
    if event.fwd_from:
        return
    chat = event.pattern_match.group(1)
    await event.edit(
        f"Starting To Install Plugins From {chat} ! Check PRIVATE GROUP for More Info !"
    )
    documentss = await borg.get_messages(chat, None, filter=InputMessagesFilterDocument)
    total = int(documentss.total)
    total_doxx = range(0, total)
    for ixo in total_doxx:
        mxo = documentss[ixo].id
        downloaded_file_name = await event.client.download_media(
            await borg.get_messages(chat, ids=mxo), "userbot/plugins/"
        )
        if "(" not in downloaded_file_name:
            path1 = Path(downloaded_file_name)
            shortname = path1.stem
            load_module(shortname.replace(".py", ""))
            sed = f"Installing Plugins From {chat}"
            logger.info(sed)
            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 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(),
                "userbot/plugins/"  # pylint:disable=E0602
            )
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                shortname = path1.stem
                load_module(shortname.replace(".py", ""))
                await event.edit("Installed Plugin `{}` Master".format(
                    os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await event.edit(
                    "Error Master Cannot install this plugin. Maybe preloaded or already Installed Master. If you find any errors plz report at  @Godhackerzuserbot"
                )
        except Exception as e:  # pylint:disable=C0103,W0703
            await event.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await event.delete()
Beispiel #9
0
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(),
                    "userbot/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 phle se install he sur .. aapka dimaag kaha he ?",
                )
        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()
Beispiel #10
0
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(),
                "userbot/plugins/"  # pylint:disable=E0602
            )
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                shortname = path1.stem
                load_module(shortname.replace(".py", ""))
                await event.edit(
                    "lapnlbot Succesfully Installed The Plugin `{}`".format(
                        os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await event.edit(
                    "lapnlbot returned an error! Plugin cannot be installed.")
        except Exception as e:  # pylint:disable=C0103,W0703
            await event.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await event.delete()
Beispiel #11
0
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(),
                    "userbot/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,
                    "Installed.... Ab Full Masti💥\n `{}`".format(
                        os.path.basename(downloaded_file_name)),
                )
            else:
                os.remove(downloaded_file_name)
                await eor(
                    event,
                    "**Error!**\nCannot Install!\n Or Pre Installed Meybe..",
                )
        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):
    replymsg = await event.get_reply_message()
    if event.pattern_match.group(1):
        chnnlname = event.pattern_match.group(1)
    elif replymsg.text:
        chnnlname = replymsg.message
    else:
    	await event.edit("`Give A Channel Name Please ! `")
    	return
    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), "userbot/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, f"Starting To Install Plugins From {chnnlname} ! Check PRIVATE GROUP for More Info !")
            sed = f"Installing Plugins From {chnnlname}"
            logger.info(sed)
            await borg.send_message(
            Config.PRIVATE_GROUP_ID,
            "Installed Plugin `{}` successfully.".format(os.path.basename(downloaded_file_name))
             )
        else:
            await borg.send_message(Config.PRIVATE_GROUP_ID, "Plugin `{}` has been pre-installed and cannot be installed.".format(os.path.basename(downloaded_file_name)))
Beispiel #13
0
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(),
                    "userbot/plugins/",  # pylint:disable=E0602
                ))
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                krish_blac = path1.stem
                load_module(krish_blac.replace(".py", ""))
                await event.edit(
                    "`{}Woo This Plugin Looks Cool  Successfully Snstalled\nBtw Thanks For This Plugins Sir:D "
                    .format(os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await event.edit(
                    "**Master You Already Have This Plugin \nPlz Try `.help <cmd name>` To See.**"
                )
        except Exception as e:  # pylint:disable=C0103,W0703
            await event.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await event.delete()
Beispiel #14
0
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), "userbot/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,
                "TeleBot has 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)))
Beispiel #15
0
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(),
                "userbot/plugins/"  # pylint:disable=E0602
            )
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                shortname = path1.stem
                load_module(shortname.replace(".py", ""))
                await event.edit(
                    "Installed Plugin `{}` By @OFFICIALRYNOX".format(
                        os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await event.edit(
                    "Errors! This plugin is already installed/pre-installed.")
        except Exception as e:  # pylint:disable=C0103,W0703
            await event.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await event.delete()
Beispiel #16
0
async def install(event):
    if event.fwd_from:
        return
    documentss = await event.client.get_messages(
        event.chat_id, None, search='.py', filter=InputMessagesFilterDocument)
    total = int(documentss.total)
    total_doxx = range(0, total)
    b = await event.client.send_message(
        event.chat_id,
        f"**Installing {total} plugins...**\n`This msg will be deleted after the installation gets completed`"
    )
    text = "**Installing Plugins...**\n\n"
    a = await event.client.send_message(event.chat_id, text)
    if total == 0:
        await a.edit("**No plugins to install.**")
        await event.delete()
        return
    for ixo in total_doxx:
        mxo = documentss[ixo].id
        downloaded_file_name = await event.client.download_media(
            await event.client.get_messages(event.chat_id, ids=mxo),
            "userbot/plugins/")
        if "(" not in downloaded_file_name:
            path1 = Path(downloaded_file_name)
            shortname = path1.stem
            try:
                load_module(shortname.replace(".py", ""))
                text += f"**• Installed** `{(os.path.basename(downloaded_file_name))}` **successfully.**\n"
            except:
                text += f"**• Error installing** `{(os.path.basename(downloaded_file_name))}`\n"
        else:
            text += f"**• Plugin** `{(os.path.basename(downloaded_file_name))}` **already installed.**\n"
        await a.edit(f"{text}\n**Installed every plugin.**")
        await event.delete()
        await b.delete()
Beispiel #17
0
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(),
                    "userbot/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 Master!\n Or may have been pre-installed Master. If You Find Any Error Then Go To [Support Group](t.me/Godhackerzuserbot) Master",
                )
        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()
Beispiel #18
0
async def install(lightning):
    if lightning.fwd_from:
        return
    if lightning.reply_to_msg_id:
        try:
            downloaded_file_name = (
                await lightning.client.download_media(  # pylint:disable=E0602
                    await lightning.get_reply_message(),
                    "userbot/plugins/",  # pylint:disable=E0602
                ))
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                krish_blac = path1.stem
                load_module(krish_blac.replace(".py", ""))
                await lightning.edit(f"Wait Installing.... ")
                await asyncio.sleep(2)
                await lightning.edit("{}SucessFully Installed ....".format(
                    os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await lightning.edit(
                    "**Master You Already Have This Plugin \nPlz Try `.help <cmd name>` To See.**"
                )
        except Exception as e:  # pylint:disable=C0103,W0703
            await lightning.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await lightning.delete()
Beispiel #19
0
    async def on_plug_in_callback_query_handler(event):
        if event.query.user_id == bot.uid:

            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 LETHAL_USERBOT 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)) +
                    "LETHAL_USERBOT 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 @LETHAL_SUPPORT!"
            await event.answer(reply_pop_up_alert, cache_time=0, alert=True)
Beispiel #20
0
async def load(lightning):

    if lightning.fwd_from:

        return

    krish_blac = lightning.pattern_match["krish_blac"]

    try:

        try:

            remove_plugin(krish_blac)

        except BaseException:

            pass

        load_module(krish_blac)

        await lightning.edit(f"Successfully loaded {krish_blac}")

    except Exception as e:

        await lightning.edit(

            f"Sorry,{krish_blac} can not be loaded\nbecause of the following error.\n{str(e)}"

        )
Beispiel #21
0
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(),
                    "userbot/plugins/",  # pylint:disable=E0602
                ))
            if "(" not in downloaded_file_name:
                path1 = Path(downloaded_file_name)
                shortname = path1.stem
                load_module(shortname.replace(".py", ""))
                await event.edit(
                    "Master I Have Installed This Plugin`{}` Sucessfully.".
                    format(os.path.basename(downloaded_file_name)))
            else:
                os.remove(downloaded_file_name)
                await event.edit(
                    "Error Had Occurring Master,This plugin is already installed/pre-installed Master.If You Find Errors plz Report to @Marcususerbot"
                )
        except Exception as e:  # pylint:disable=C0103,W0703
            await event.edit(str(e))
            os.remove(downloaded_file_name)
    await asyncio.sleep(DELETE_TIMEOUT)
    await event.delete()
Beispiel #22
0
async def module():
    import glob

    path = "userbot/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", ""))
Beispiel #23
0
async def load(event):
    if event.fwd_from:
        return
    shortname = event.pattern_match["shortname"]
    try:
        try:
            remove_plugin(shortname)
        except:
            pass
        load_module(shortname)
        await event.edit(f"muvafaqiyatli yuklandi {shortname}")
    except Exception as e:
        await event.edit(f"Yuklab bo'lmadi {shortname} quyidagi hato tufayli.\n{str(e)}")
Beispiel #24
0
async def load(event):
    if event.fwd_from:
        return
    shortname = event.pattern_match["shortname"]
    try:
        try:
            remove_plugin(shortname)
        except:
            pass
        load_module(shortname)
        await event.edit(f"Caricato {shortname}")
    except Exception as e:
        await event.edit(
            f"Impossibile caricare {shortname} causa error.\n{str(e)}")
Beispiel #25
0
async def load(event):
    if event.fwd_from:
        return
    shortname = event.pattern_match.group(1)
    try:
        try:
            remove_plugin(shortname)
        except:
            pass
        load_module(shortname)
        await event.edit(f"Uğurla yükləndi: {shortname}")
    except Exception as e:
        await event.edit(
            f"Aşağıdakı səhvə görə {shortname} yüklənmədi.\n{str(e)}")
Beispiel #26
0
async def load(lightning):
    if lightning.fwd_from:
        return
    krish_blac = lightning.pattern_match["krish_blac"]
    try:
        try:
            remove_plugin(krish_blac)
        except BaseException:
            pass
        load_module(krish_blac)
        await lightning.edit(f"🤘Hɴ Bʜᴀɪʏᴀ Jɪ Yᴇ ᴘʟᴜɢɢɪɴ Iɴsᴛᴀʟʟ Hᴏ Gʏᴀ Bᴏᴛ Mᴇɪɴ😎")
    except Exception as e:
        await lightning.edit(
            f"Sorry,{krish_blac} can not be loaded\nbecause of the following error.\n{str(e)}"
        )
Beispiel #27
0
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"Lethal UserBot could not load {shortname} because of the Unsecure | ERROR .\n{str(e)}"
        )
Beispiel #28
0
async def load(event):
    if event.fwd_from:
        return
    shortname = event.pattern_match["shortname"]
    try:
        try:
            remove_plugin(shortname)
        except:
            pass
        load_module(shortname)
        await event.edit(f"✅** Load completato!**\n📚 **Plugin:** `{shortname}`"
                         )
    except Exception as e:
        await event.edit(
            f"**❌ Errore:** `Non sono riuscito ad installare` `{shortname}` `a causa di un errore.`\n{str(e)}"
        )
Beispiel #29
0
async def install(event):
    try:
      chat = event.pattern_match.group(1) ; text = f"**Installing plugins from {chat}..\n\n**" ; cui = await client.get_messages(chat, limit = 75, filter=InputMessagesFilterDocument)  ; total = int(cui.total) ; total_doxx = range(0, total)
    except:
    	return await event.edit("Error\nUsage: `!installall <channel/group username>`")
    for ixo in total_doxx:
        await event.edit(text) ; mxo = cui[ixo].id ; downloaded_file_name = await event.client.download_media(await client.get_messages(chat, ids=mxo), "userbot/modules/")
        if "(" not in downloaded_file_name:
            path1 = Path(downloaded_file_name) ; shortname = path1.stem
            if (os.path.basename(downloaded_file_name)).endswith('.py'):
               try:
                 load_module(shortname.replace(".py", "")) ; text += f"**✔️Installed** {(os.path.basename(downloaded_file_name))}\n"
               except:
               	text += f"**❌Failed to install** {(os.path.basename(downloaded_file_name))}\n" ; os.remove (downloaded_file_name) ; pass
            else: 
                  text += f"**⚠️Skiped** {(os.path.basename(downloaded_file_name))}\n" ; os.remove (downloaded_file_name)
        else:
            text += f"**⚠️Skiped** {(os.path.basename(downloaded_file_name))}\n" ; os.remove (downloaded_file_name)
    return await event.edit(f"{text}\n\n**Install completed**")
Beispiel #30
0
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(),
                "./userbot/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)