1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-26 21:14:19 +00:00
royalnet/royalpack/commands/man.py

35 lines
860 B
Python
Raw Normal View History

2021-04-18 15:47:44 +00:00
import royalnet.engineer as engi
2021-04-30 13:22:58 +00:00
import royalpack.bolts as rb
2021-04-18 15:47:44 +00:00
2021-04-30 13:22:58 +00:00
@rb.capture_errors
2021-04-18 15:47:44 +00:00
@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 = [
2021-04-20 00:43:48 +00:00
f" Manuale di \uE011{commandname}\uE001:",
2021-04-18 15:47:44 +00:00
f"{command.__doc__}",
]
await _msg.reply(text="\n".join(msg))
__all__ = ("man",)