mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:47:41 +00:00
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:
@@ -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(/^\/+/, "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user