1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/royalpack/commands/debug.py

58 lines
1.5 KiB
Python
Raw Normal View History

2021-04-15 00:40:51 +00:00
import royalnet.engineer as engi
2021-04-17 02:19:11 +00:00
2021-04-15 00:40:51 +00:00
newline = "\n"
2021-04-17 02:19:11 +00:00
@engi.TeleportingConversation
2021-04-15 00:40:51 +00:00
async def debug(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, **__):
"""
Check the implementations currently running on the PDA.
"""
await _msg.reply(text=f"""
🐛 Sottocomandi di debug disponibili:
- impls
- commands
2021-04-17 02:19:11 +00:00
""")
2021-04-15 00:40:51 +00:00
2021-04-17 02:19:11 +00:00
@engi.TeleportingConversation
2021-04-15 00:40:51 +00:00
async def debug_impls(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, **__):
await _msg.reply(text=f"""
🐛 Implementazioni attive sul PDA:
{newline.join([f'🔵 {implementation!r}' for implementation in _pda.implementations.values()])}
""")
2021-04-17 02:19:11 +00:00
@engi.TeleportingConversation
2021-04-15 00:40:51 +00:00
async def debug_exts(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, impl: str, **__):
await _msg.reply(text=f"""
🐛 Estensioni attive sull'implementazione {impl}:
{newline.join([f'🔵 {extension!r}' for extension in _pda.implementations[impl].extensions])}
""")
2021-04-17 02:19:11 +00:00
@engi.TeleportingConversation
2021-04-15 00:40:51 +00:00
async def debug_convs(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, impl: str, **__):
implementation = _pda.implementations[impl]
if not isinstance(implementation, engi.ConversationListImplementation):
await _msg.reply(text="⚠️ Questa implementazione gestisce le conversazioni con un metodo sconosciuto.")
await _msg.reply(text=f"""
🐛 Conversazioni registrate sull'implementazione {impl}:
{newline.join([f'🔵 {command!r}' for command in implementation.conversations])}
""")
__all__ = (
"debug",
"debug_impls",
"debug_exts",
"debug_convs",
)