Exemplo n.º 1
0
async def installer(client, message):
    pablo = await edit_or_reply(message, "`Processing...`")
    if not message.reply_to_message:
        await pablo.edit("`Reply To A Plugin File To Install Plugin`")
        return
    if not message.reply_to_message.document:
        await pablo.edit("`Is It A Even A Document?`")
        return
    file_name = message.reply_to_message.document.file_name
    ext = file_name.split(".")[1]
    if os.path.exists(os.path.join("./plugins/", file_name)):
        await pablo.edit("`This Plugin is Already Installed!👀`")
        return
    if not ext.lower() == "py":
        await pablo.edit("`Only Py Files :(`")
        return
    Escobar = await message.reply_to_message.download(file_name="./plugins/")
    base_name = os.path.basename(Escobar)
    file_n = base_name.split(".")[0]
    try:
        load_plugin(file_n)
    except Exception as e:
        await pablo.edit(f"Error Installing Plugin.\n**Error**😖😖 {e}")
        os.remove(Escobar)
        return
    await pablo.edit(f"`Sucessfully Installed {file_name}😁🔥!`")
Exemplo n.º 2
0
async def installer(client, message):
    engine = message.Engine
    pablo = await edit_or_reply(message, engine.get_string("PROCESSING"))
    if not message.reply_to_message:
        await pablo.edit(engine.get_string("NEEDS_REPLY").format("A Plugin"))
        return
    if not message.reply_to_message.document:
        await pablo.edit(engine.get_string("IS_NOT_DOC"))
        return
    file_name = message.reply_to_message.document.file_name
    ext = file_name.split(".")[1]
    if os.path.exists(os.path.join("./plugins/", file_name)):
        await pablo.edit(engine.get_string("ALREADY_INSTALLED"))
        return
    if ext.lower() != "py":
        await pablo.edit(engine.get_string("ONLY_PY_FILES"))
        return
    Escobar = await message.reply_to_message.download(file_name="./plugins/")
    base_name = os.path.basename(Escobar)
    file_n = base_name.split(".")[0]
    try:
        load_plugin(file_n)
    except Exception as e:
        await pablo.edit(engine.get_string("ERROR_INSTALLING").format(e))
        os.remove(Escobar)
        return
    await pablo.edit(engine.get_string("PLUGIN_INSTALLED").format(file_name))
Exemplo n.º 3
0
async def run_bot():
    logging.info("Starting Friday Userbot")
    logging.info(f"Friday Version: {friday_version}")
    logging.info("Please wait while Friday is booting up!")
    try:
        await update_it()
    except:
        pass
    """Run The Bot"""
    await mongo_check()
    if bot:
        await bot.start()
        bot.me = await bot.get_me()
        assistant_mods = plugin_collector("./assistant/")
        for mods in assistant_mods:
            try:
                load_plugin(mods, assistant=True)
            except Exception as e:
                logging.error("[ASSISTANT] - Failed To Load : " + f"{mods} - {str(e)}")
    await Friday.start()
    Friday.me = await Friday.get_me()
    Friday.selected_lang = await check_lang()
    LangEngine = Engine()
    LangEngine.load_language()
    Friday.has_a_bot = bool(bot)
    if Friday2:
        await Friday2.start()
        Friday2.me = await Friday2.get_me()
        Friday2.has_a_bot = True if bot else False
    if Friday3:
        await Friday3.start()
        Friday3.me = await Friday3.get_me()
        Friday3.has_a_bot = bool(bot)
    if Friday4:
        await Friday4.start()
        Friday4.me = await Friday4.get_me()
        Friday4.has_a_bot = bool(bot)
    if Config.PLUGIN_CHANNEL:
        await fetch_plugins_from_channel()
    needed_mods = plugin_collector("./plugins/")
    for nm in needed_mods:
        try:
            load_plugin(nm)
        except Exception as e:
            logging.error("[USER] - Failed To Load : " + f"{nm} - {str(e)}")
    if Config.LOAD_UNOFFICIAL_PLUGINS:
        await load_unofficial_modules()
    full_info = f"""Friday Based On Pyrogram V{__version__}
Python Version : {platform.python_version()}
Friday Version : {friday_version}
You Can Visit @FridaySupportOfficial For Updates And @FridayChat For Any Query / Help!
"""
    logging.info(full_info)
    await pyrogram.idle()
Exemplo n.º 4
0
async def run_bot():
    """Run The Bot"""
    await mongo_check()
    if bot:
        await bot.start()
        bot.me = await bot.get_me()
        assistant_mods = plugin_collecter("./assistant/")
        for mods in assistant_mods:
            try:
                load_plugin(mods, assistant=True)
            except Exception as e:
                logging.error("[ASSISTANT] - Failed To Load : " +
                              f"{mods} - {str(e)}")
    await Friday.start()
    Friday.me = await Friday.get_me()
    Friday.has_a_bot = True if bot else False
    if Friday2:
        await Friday2.start()
        Friday2.me = await Friday2.get_me()
        Friday2.has_a_bot = True if bot else False
    if Friday3:
        await Friday3.start()
        Friday3.me = await Friday3.get_me()
        Friday3.has_a_bot = True if bot else False
    if Friday4:
        await Friday4.start()
        Friday4.me = await Friday4.get_me()
        Friday4.has_a_bot = True if bot else False
    if Config.PLUGIN_CHANNEL:
        await fetch_plugins_from_channel()
    needed_mods = plugin_collecter("./plugins/")
    for nm in needed_mods:
        try:
            load_plugin(nm)
        except Exception as e:
            logging.error("[USER] - Failed To Load : " + f"{nm} - {str(e)}")
    if Config.LOAD_UNOFFICIAL_PLUGINS:
        await load_unofficial_modules()
    full_info = f"""Gabut-Userbot Based On Pyrogram V{__version__}
Python Version : {platform.python_version()}
Gabut Version : {friday_version}
You Can Visit @RimUserbot For Updates And @rimgans For Any Query / Help!
"""
    logging.info(full_info)
    await pyrogram.idle()