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

33 lines
859 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import royalnet.engineer as engi
import royalpack.bolts as rb
@rb.capture_errors
@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 \uE011{commandname}\uE001:",
f"{command.__doc__}",
]
await _msg.reply(text="\n".join(msg))
__all__ = ("man",)