from Hellbot.core.config import Config, Symbols class HelpMenu: def __init__(self, file: str) -> None: self.filename = file self.command_dict = {} self.command_info = "" def add( self, command: str, parameters: str = None, description: str = None, example: str = None, note: str = None, ): self.command_dict[command] = { "command": command, "parameters": parameters, "description": description, "example": example, "note": note, } return self def info(self, command_info: str): self.command_info = command_info return self def get_menu(self) -> str: result = f"**π–―π—…π—Žπ—€π—‚π—‡ π–₯𝗂𝗅𝖾:** `{self.filename}`" if self.command_info: result += f"\n**π–―π—…π—Žπ—€π—‚π—‡ π–¨π—‡π–Ώπ—ˆ:** __{self.command_info} πŸ€__" result += "\n\n" for command in self.command_dict: command = self.command_dict[command] result += f"**{Symbols.radio_select} π–’π—ˆπ—†π—†π–Ίπ—‡π–½:** `{Config.HANDLERS[0]}{command['command']}" if command["parameters"]: result += f" {command['parameters']}`\n" else: result += "`\n" if command["description"]: result += ( f"**{Symbols.arrow_right} π–£π–Ύπ—Œπ–Όπ—‹π—‚π—‰π—π—‚π—ˆπ—‡:** __{command['description']}__\n" ) if command["example"]: result += f"**{Symbols.arrow_right} 𝖀𝗑𝖺𝗆𝗉𝗅𝖾:** `{Config.HANDLERS[0]}{command['example']}`\n" if command["note"]: result += f"**{Symbols.arrow_right} π–­π—ˆπ—π–Ύ:** __{command['note']}__\n" result += "\n" Config.CMD_INFO[command["command"]] = { "command": f"{command['command']} {command['parameters'] if command['parameters'] else ''}", "description": command["description"], "example": command["example"], "note": command["note"], "plugin": self.filename, } return result def done(self) -> None: Config.HELP_DICT[self.filename] = { "commands": self.command_dict, "info": self.command_info, } Config.CMD_MENU[self.filename] = self.get_menu() class BotHelp: def __init__(self, file: str) -> None: self.category = file self.command_dict = {} self.command_info = "" def add(self, command: str, description: str): self.command_dict[command] = {"command": command, "description": description} return self def info(self, command_info: str): self.command_info = command_info return self def get_menu(self) -> str: result = f"**π–―π—…π—Žπ—€π—‚π—‡ π–’π–Ίπ—π–Ύπ—€π—ˆπ—‹π—’:** `{self.category}`" if self.command_info: result += f"\n**π–―π—…π—Žπ—€π—‚π—‡ π–¨π—‡π–Ώπ—ˆ:** __{self.command_info}__" result += "\n\n" for command in self.command_dict: command = self.command_dict[command] result += f"**{Symbols.radio_select} π–’π—ˆπ—†π—†π–Ίπ—‡π–½:** `/{command['command']}`\n" if command["description"]: result += ( f"**{Symbols.arrow_right} π–£π–Ύπ—Œπ–Όπ—‹π—‚π—‰π—π—‚π—ˆπ—‡:** __{command['description']}__\n" ) result += "\n" Config.BOT_CMD_INFO[command["command"]] = { "command": command["command"], "description": command["description"], "category": self.category, } return result def done(self) -> None: Config.BOT_HELP[self.category] = { "commands": self.command_dict, "info": self.command_info, } Config.BOT_CMD_MENU[self.category] = self.get_menu() # example usage of HelpMenu class """ HelpMenu("example").add( "example", "", "description of command", "example of command", "note of command" ).info( "information of plugin" ).done() """ # example usage of BotHelp class """ BotHelp("example").add( "example", "description of command" ).info( "information of category" ).done() """