1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 11:34:18 +00:00
royalnet/royalpack/commands/man.py

32 lines
799 B
Python
Raw Normal View History

2021-04-18 15:47:44 +00:00
import royalnet.engineer as engi
@engi.TeleportingConversation
async def man(*, _msg: engi.Message, _router: engi.Router, commandname: str, **__):
"""
Visualizza aiuto per un comando.
Non funziona ancora correttamente per i multicomandi, come /dog: https://github.com/Steffo99/royalnet/issues/11 !
"""
# TODO: Change this when royalnet/#11 is fixed!
if not (command := _router.by_name.get(commandname)):
await _msg.reply(text="⚠️ Il comando che hai specificato non esiste.")
return
try:
command = command.__getattribute__("bare_function")
except AttributeError:
pass
msg = [
f" Manuale di {commandname}:",
f"{command.__doc__}",
]
await _msg.reply(text="\n".join(msg))
__all__ = ("man",)