From 24f334437be7cdf3aaace9e6a07a74d64c97c67d Mon Sep 17 00:00:00 2001 From: cosmo Date: Mon, 13 Nov 2023 22:12:23 +0800 Subject: [PATCH] beta29 --- handlers/message_parser.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/handlers/message_parser.go b/handlers/message_parser.go index c136b1ed..7cd454e2 100644 --- a/handlers/message_parser.go +++ b/handlers/message_parser.go @@ -384,12 +384,11 @@ func ConvertToSegmentedMessage(data interface{}) []map[string]interface{} { newImagePattern := "[CQ:image,file=" + attachment.URL + "]" msg.Content = msg.Content + newImagePattern } - + // 将msg.Content里的BotID替换成AppID + msg.Content = strings.ReplaceAll(msg.Content, BotID, AppID) // 使用正则表达式查找所有的[@数字]格式 r := regexp.MustCompile(`<@!(\d+)>`) atMatches := r.FindAllStringSubmatch(msg.Content, -1) - // 将msg.Content里的BotID替换成AppID - msg.Content = strings.ReplaceAll(msg.Content, BotID, AppID) for _, match := range atMatches { userID := match[1]