diff --git a/torchlight_changes_unloze/torchlight3/Torchlight/Commands.py b/torchlight_changes_unloze/torchlight3/Torchlight/Commands.py index d32821e..958fd8b 100755 --- a/torchlight_changes_unloze/torchlight3/Torchlight/Commands.py +++ b/torchlight_changes_unloze/torchlight3/Torchlight/Commands.py @@ -1619,7 +1619,7 @@ class Stop(BaseCommand): def __init__(self, torchlight) -> None: super().__init__(torchlight) - self.Triggers = ["!stop"] + self.Triggers = ["!stop", ("!stop(", 6)] self.Level = 0 async def _func(self, message: List[str], player) -> int: @@ -1628,12 +1628,25 @@ class Stop(BaseCommand): tl = self._get_torchlight() try: - tl.AudioManager.Stop(player, message[1] if len(message) > 1 else "") - tl.SayPrivate(player, "[STOP] Audio stopped") + extra = message[1].strip() if len(message) > 1 else "" + if not extra and len(message) > 0: + match = re.match(r"^!stop\((.*?)\)$", message[0], flags=re.IGNORECASE) + if match: + extra = match.group(1).strip() + + result = tl.AudioManager.Stop(player, extra) + + if not result or result.get("matched", 0) == 0: + if extra: + tl.SayPrivate(player, f"[STOP] No active audio matched \"{extra}\".") + else: + tl.SayPrivate(player, "[STOP] No active audio to stop.") + elif result.get("stopped", 0) > 0: + tl.SayPrivate(player, f"[STOP] Stopped {result['stopped']} audio clip(s).") except Exception as e: self.Logger.error(f"Stop command failed: {e}") tl.SayPrivate(player, f"[STOP] Error: {str(e)}") - return True + return 0 class VoteDisable(BaseCommand):