🎨 AI新增指定群不启用

This commit is contained in:
李寻欢
2023-11-24 09:44:13 +08:00
parent 997ad806f0
commit 3b4862d5bc
3 changed files with 16 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ package handler
import (
"context"
"fmt"
"github.com/duke-git/lancet/v2/slice"
"github.com/sashabaranov/go-openai"
"go-wechat/config"
"go-wechat/entity"
@@ -20,6 +21,11 @@ func handleAtMessage(m entity.Message) {
return
}
// 如果在禁用的群组里面,就不处理
if slice.Contain(config.Conf.Ai.DisableGroup, m.FromUser) {
return
}
// 预处理一下发送的消息,用正则去掉@机器人的内容
re := regexp.MustCompile(`@([^]+)`)
matches := re.FindStringSubmatch(m.Content)