fix(wecom): strip @mention from group chat messages to fix slash commands

WeCom AI Bot does not strip @mention from text.content in group chats,
causing all slash commands (/stop, /clear, /help) to fail — the content
arrives as "@BotName /stop" instead of "/stop".

- Add stripAtMentionBasic (stateless) and stripAtMention (with bot name
  caching) to handle multi-word bot display names
- Support bot_name in channel credentials for immediate precision
- Apply stripping in both WebSocket and webhook adapters, text and mixed
- Add mention_test.go with 21 test cases
This commit is contained in:
nullkey
2026-04-02 03:15:51 +08:00
committed by lyingbug
parent b66552749d
commit 39831fb61c
4 changed files with 254 additions and 9 deletions
+1
View File
@@ -1009,6 +1009,7 @@ func registerIMAdapterFactories(imService *imPkg.Service) {
client := wecom.NewLongConnClient(
getString(creds, "bot_id"),
getString(creds, "bot_secret"),
getString(creds, "bot_name"),
msgHandler,
)