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}`"
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>"
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]