Improved name conflict handling in custom commands.
CI / Formatting (push) Successful in 9s
CI / Linting (push) Successful in 8s
CI / Tests (Python 3.12) (push) Failing after 25s
CI / Tests (Python 3.13) (push) Failing after 14s
CI / Tests (Python 3.14) (push) Failing after 13s
CI / Type Checking (push) Successful in 11s
CI / Spelling (push) Successful in 9s

This commit is contained in:
2026-04-22 17:39:05 -04:00
parent 078e02d1c0
commit 32e21a6f9d
3 changed files with 88 additions and 8 deletions
@@ -25,6 +25,7 @@ from .types import (
CannotDeleteByAliasError,
CommandAlreadyExistsError,
CommandNotFoundError,
InactiveCommandError,
InvalidNameError,
NotCustomCommandError,
)
@@ -112,6 +113,12 @@ async def editcommand(ctx: CommandContext) -> None:
"That command is not a custom command and cannot be modified."
)
return
except InactiveCommandError as e:
await ctx.owncast_client.send_message(
f"Custom command {prefix}{e.name} is disabled because another module "
f"registered the same name. Delete it or resolve the conflict to re-enable."
)
return
await ctx.owncast_client.send_message(f"Command {prefix}{cmd.name} updated.")
@@ -192,6 +199,12 @@ async def commandmodonly(ctx: CommandContext) -> None:
"That command is not a custom command and cannot be modified."
)
return
except InactiveCommandError as e:
await ctx.owncast_client.send_message(
f"Custom command {prefix}{e.name} is disabled because another module "
f"registered the same name. Delete it or resolve the conflict to re-enable."
)
return
status = "moderator-only" if cmd.requires_moderator else "public"
await ctx.owncast_client.send_message(
@@ -227,6 +240,12 @@ async def resetcommand(ctx: CommandContext) -> None:
"That command is not a custom command and cannot be modified."
)
return
except InactiveCommandError as e:
await ctx.owncast_client.send_message(
f"Custom command {prefix}{e.name} is disabled because another module "
f"registered the same name. Delete it or resolve the conflict to re-enable."
)
return
await ctx.owncast_client.send_message(f"Command {prefix}{cmd.name} counter reset.")
@@ -323,6 +342,12 @@ async def commandcooldown(ctx: CommandContext) -> None:
"That command is not a custom command and cannot be modified."
)
return
except InactiveCommandError as e:
await ctx.owncast_client.send_message(
f"Custom command {prefix}{e.name} is disabled because another module "
f"registered the same name. Delete it or resolve the conflict to re-enable."
)
return
if cmd.cooldown == 0:
await ctx.owncast_client.send_message(
@@ -363,6 +388,12 @@ async def addalias(ctx: CommandContext) -> None:
"That command is not a custom command and cannot be modified."
)
return
except InactiveCommandError as e:
await ctx.owncast_client.send_message(
f"Custom command {prefix}{e.name} is disabled because another module "
f"registered the same name. Delete it or resolve the conflict to re-enable."
)
return
except InvalidNameError:
await ctx.owncast_client.send_message(
"Invalid alias name. Only letters, numbers, and underscores are allowed."