Allow /stop without target argument

This commit is contained in:
2026-02-17 06:17:36 +09:00
parent 48c79c88c8
commit fa2dc0f295
4 changed files with 35 additions and 18 deletions

View File

@@ -96,11 +96,10 @@ class Bridge:
def _handle_command(self, action: str, target: str, channel: str) -> None:
"""슬래시 커맨드를 처리한다."""
if target not in {"claude", "codex"}:
self.slack.send_message(channel, ":warning: 지원하지 않는 대상입니다.")
return
if action == "start":
if target not in {"claude", "codex"}:
self.slack.send_message(channel, ":warning: 지원하지 않는 대상입니다.")
return
self._start_session(channel, target)
elif action == "stop":
self._stop_session(channel)

View File

@@ -86,23 +86,12 @@ class SlackHandler:
ack()
user_id = body.get("user_id", "")
channel_id = body.get("channel_id", "")
target = self._parse_target(body.get("text", ""))
if not self._is_authorized(user_id, channel_id):
return
if target is None:
self.send_message(
channel_id,
(
":warning: 대상은 `claude` 또는 `codex`여야 합니다. "
"예: `/stop claude`"
),
)
return
if self._on_command_callback:
self._on_command_callback("stop", target, channel_id)
self._on_command_callback("stop", "", channel_id)
@staticmethod
def _parse_target(text: str) -> str | None: