diff --git a/userge/plugins/help.py b/userge/plugins/help.py index e3fc6c8f4..ffcdd4d94 100644 --- a/userge/plugins/help.py +++ b/userge/plugins/help.py @@ -72,15 +72,16 @@ async def helpme(message: Message) -> None: # pylint: disable=missing-function- f" 📚 info: {cmd.doc}\n\n") out_str += f"""📕 Usage: {Config.CMD_TRIGGER}help [command_name]""" else: - commands = userge.manager.enabled_commands - key = key.lstrip(Config.CMD_TRIGGER) - key_ = Config.CMD_TRIGGER + key - if key in commands: - out_str = f"{key}\n\n{commands[key].about}" - elif key_ in commands: - out_str = f"{key_}\n\n{commands[key_].about}" - else: - out_str = f"No Module or Command Found for: {message.input_str}" + triggers = (Config.CMD_TRIGGER, Config.SUDO_TRIGGER, Config.PUBLIC_TRIGGER) + for _ in triggers: + key = key.lstrip(_) + out_str = f"No Module or Command Found for: {message.input_str}" + for name, cmd in userge.manager.enabled_commands.items(): + for _ in triggers: + name = name.lstrip(_) + if key == name: + out_str = f"{cmd.name}\n\n{cmd.about}" + break await message.edit(out_str, del_in=0, parse_mode='html', disable_web_page_preview=True) if userge.has_bot: diff --git a/userge/plugins/tools/sudo.py b/userge/plugins/tools/sudo.py index d916a79ce..343652bdb 100644 --- a/userge/plugins/tools/sudo.py +++ b/userge/plugins/tools/sudo.py @@ -123,8 +123,11 @@ async def add_sudo_cmd(message: Message): await SUDO_CMDS_COLLECTION.drop() Config.ALLOWED_COMMANDS.clear() tmp_ = [] + restricted = ('addsudo', 'addscmd', 'exec', 'eval', 'term') for c_d in list(userge.manager.enabled_commands): t_c = c_d.lstrip(Config.CMD_TRIGGER) + if t_c in restricted: + continue tmp_.append({'_id': t_c}) Config.ALLOWED_COMMANDS.add(t_c) await asyncio.gather(