diff --git a/src/mudlib/commands/__init__.py b/src/mudlib/commands/__init__.py index 46e5cbc..4484b4d 100644 --- a/src/mudlib/commands/__init__.py +++ b/src/mudlib/commands/__init__.py @@ -3,6 +3,7 @@ import logging from collections.abc import Awaitable, Callable from dataclasses import dataclass, field +from typing import cast from mudlib.player import Player @@ -130,7 +131,8 @@ async def dispatch(player: Player, raw_input: str) -> None: if len(names) == 2: msg = f"{names[0]} or {names[1]}?\r\n" else: - msg = f"{', '.join(names[:-1])}, or {names[-1]}?\r\n" + prefix = ", ".join(cast(list[str], names[:-1])) + msg = f"{prefix}, or {names[-1]}?\r\n" player.writer.write(msg) await player.writer.drain() return diff --git a/src/mudlib/commands/help.py b/src/mudlib/commands/help.py index 63b3576..5d2961d 100644 --- a/src/mudlib/commands/help.py +++ b/src/mudlib/commands/help.py @@ -1,6 +1,6 @@ """Help and command listing commands.""" -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, cast from mudlib.commands import CommandDefinition, _registry, register, resolve_prefix from mudlib.commands.movement import DIRECTIONS @@ -28,7 +28,8 @@ async def _show_command_detail(player: Player, command_name: str) -> None: if len(names) == 2: msg = f"{names[0]} or {names[1]}?\r\n" else: - msg = f"{', '.join(names[:-1])}, or {names[-1]}?\r\n" + prefix = ", ".join(cast(list[str], names[:-1])) + msg = f"{prefix}, or {names[-1]}?\r\n" await player.send(msg) return else: