fix(slack): detect control commands when message starts with @mention (#14142)

Merged via /review-pr-v2 -> /prepare-pr-v2 -> /merge-pr-v2.

Prepared head SHA: cb0b4f6a3b
Co-authored-by: beefiker <55247450+beefiker@users.noreply.github.com>
Co-authored-by: gumadeiras <gumadeiras@gmail.com>
Reviewed-by: @gumadeiras
This commit is contained in:
J young Lee
2026-02-12 01:41:48 +09:00
committed by GitHub
parent 50a60b8be6
commit 2aa9570465
5 changed files with 94 additions and 2 deletions

View File

@@ -1,5 +1,16 @@
import type { SlackSlashCommandConfig } from "../../config/config.js";
/**
* Strip Slack mentions (<@U123>, <@U123|name>) so command detection works on
* normalized text. Use in both prepare and debounce gate for consistency.
*/
export function stripSlackMentionsForCommandDetection(text: string): string {
return (text ?? "")
.replace(/<@[^>]+>/g, " ")
.replace(/\s+/g, " ")
.trim();
}
export function normalizeSlackSlashCommandName(raw: string) {
return raw.replace(/^\/+/, "");
}