Fix prompt command to show correct active template

This commit is contained in:
Jared Miller 2026-02-14 21:14:03 -05:00
parent 7ae82480bc
commit 9a4ceca74b
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -1,7 +1,7 @@
"""Prompt customization command."""
from mudlib.player import Player
from mudlib.prompt import DEFAULT_TEMPLATES
from mudlib.prompt import ADMIN_TEMPLATES, DEFAULT_TEMPLATES
async def cmd_prompt(player: Player, args: str) -> None:
@ -15,9 +15,17 @@ async def cmd_prompt(player: Player, args: str) -> None:
if not args:
# Show current template and available variables
current = player.prompt_template or DEFAULT_TEMPLATES.get(
player.mode, "{stamina_gauge} {pl} > "
)
if player.prompt_template:
current = player.prompt_template
elif player.paint_mode:
current = DEFAULT_TEMPLATES["paint"]
elif player.is_admin:
current = ADMIN_TEMPLATES.get(
player.mode,
DEFAULT_TEMPLATES.get(player.mode, "{stamina_gauge} {pl} > "),
)
else:
current = DEFAULT_TEMPLATES.get(player.mode, "{stamina_gauge} {pl} > ")
msg = f"Current prompt: {current}\r\n\r\n"
msg += "Available variables:\r\n"
msg += " stamina_pct - stamina percentage (0-100)\r\n"