def add_help_menu(
    cmd,
    stack,
    is_official=True,
    cmd_help="No One Gonna Help You",
    example="{ch}what",
    file_name=None,
):
    if not file_name:
        previous_stack_frame = stack[1]
        if "xtraplugins" in previous_stack_frame.filename:
            is_official = False
        file_name = os.path.basename(previous_stack_frame.filename.replace(".py", ""))
    cmd_helpz = example.format(ch=Config.COMMAND_HANDLER)
    cmd_helper = f"**Module Name :** `{file_name.replace('_', ' ').title()}` \n\n**Command :** `{Config.COMMAND_HANDLER}{cmd}` \n**Help :** `{cmd_help}` \n**Example :** `{cmd_helpz}`"
    if is_official:
        if file_name not in CMD_LIST.keys():
            CMD_LIST[file_name] = cmd_helper
        else:
            CMD_LIST[
                file_name
            ] += f"\n\n**Command :** `{Config.COMMAND_HANDLER}{cmd}` \n**Help :** `{cmd_help}` \n**Example :** `{cmd_helpz}`"
    else:
        if file_name not in XTRA_CMD_LIST.keys():
            XTRA_CMD_LIST[file_name] = cmd_helper
        else:
            XTRA_CMD_LIST[
                file_name
            ] += f"\n\n**Command :** `{Config.COMMAND_HANDLER}{cmd}` \n**Help :** `{cmd_help}` \n**Example :** `{cmd_helpz}`"
Exemple #2
0
def add_help_menu(
    cmd,
    stack,
    is_official=True,
    cmd_help="No One Gonna Help You",
    example="{ch}what",
    file_name=None,
):
    if not file_name:
        previous_stack_frame = stack[1]
        if "xtraplugins" in previous_stack_frame.filename:
            is_official = False
        file_name = os.path.basename(
            previous_stack_frame.filename.replace(".py", ""))
    cmd_help_note = f"<b>Module Name :</b> <code>{file_name.replace('_', ' ').title()}</code> \n\n<b>Command :</b> <code>{Config.COMMAND_HANDLER}{cmd}</code> \n<b>Help :</b> <code>{cmd_help}</code> \n<b>Example :</b> <code>{example.format(ch=Config.COMMAND_HANDLER)}</code>"
    if is_official:
        if file_name not in CMD_LIST.keys():
            CMD_LIST[file_name] = cmd_help_note
        else:
            CMD_LIST[
                file_name] += f"\n\n<b>Command :</b> <code>{Config.COMMAND_HANDLER}{cmd}</code> \n<b>Help :</b> <code>{cmd_help}</code> \n<b>Example :</b> <code>{example.format(ch=Config.COMMAND_HANDLER)}</code>"
    elif file_name not in XTRA_CMD_LIST.keys():
        XTRA_CMD_LIST[file_name] = cmd_help_note
    else:
        XTRA_CMD_LIST[
            file_name] += f"\n\n<b>Command :</b> <code>{Config.COMMAND_HANDLER}{cmd}</code> \n<b>Help :</b> <code>{cmd_help}</code> \n<b>Example :</b> <code>{example.format(ch=Config.COMMAND_HANDLER)}</code>"
Exemple #3
0
async def help(client, message):
    f_ = await edit_or_reply(message, "`Please Wait!`")
    help_t = "<b>Command Names :</b> \n\n"
    if bot:
        starkbot = bot.me
        bot_username = starkbot.username
        try:
            nice = await client.get_inline_bot_results(bot=bot_username,
                                                       query="help")
            await client.send_inline_bot_result(message.chat.id,
                                                nice.query_id,
                                                nice.results[0].id,
                                                hide_via=True)
        except BaseExpection as e:
            return await f_.edit(
                f"`Unable To Open Help Menu Here.` \n**ERROR :** `{e}`")
        await f_.delete()
    else:
        cmd_ = get_text(message)
        if not cmd_:
            for i in CMD_LIST:
                if i:
                    help_t += f"▶ <code>{i}</code> \n"
            help_t += f"If You Wanna Check Command Info And List About A Specfic Plugin, Use <code>{Config.COMMAND_HANDLER}help (file_name)</code>"
            await f_.edit(help_t)
        else:
            if cmd_ not in CMD_LIST.keys():
                await f_.edit("`404: Plugin Not Found!`")
                return
            await f_.edit(CMD_LIST[cmd_])
Exemple #4
0
async def help_(client, message):
    help_t = "<b>Command Names :</b> \n\n"
    f_ = await edit_or_reply(message, "`Please Wait!`")
    cmd_ = get_text(message)
    if not cmd_:
        for i in CMD_LIST:
            if i:
                help_t += f"▶ <code>{i}</code> \n"
        help_t += f"\nIf You Wanna Check Command Info And List About A Specfic Plugin, Use <code>{Config.COMMAND_HANDLER}ahelp (file_name)</code>"
        await f_.edit(help_t)
    else:
        if cmd_ not in CMD_LIST.keys():
            await f_.edit("`404: Plugin Not Found!`")
            return
        await f_.edit(CMD_LIST[cmd_])
Exemple #5
0
def get_help_str(string):
    if string not in CMD_LIST.keys():
        if string not in XTRA_CMD_LIST.keys():
            return None
        return XTRA_CMD_LIST[string]
    return CMD_LIST[string]