mirror of
https://github.com/eryajf/chatgpt-dingtalk.git
synced 2025-10-07 09:01:03 +08:00
feat: 增加敏感词功能 (#204)
This commit is contained in:
@@ -146,6 +146,9 @@ func Do(mode string, rmsg *dingbot.ReceiveMsg) error {
|
||||
logger.Error("往MySQL新增数据失败,错误信息:", err)
|
||||
}
|
||||
logger.Info(fmt.Sprintf("🤖 %s得到的答案: %#v", rmsg.SenderNick, reply))
|
||||
if public.JudgeSensitiveWord(reply) {
|
||||
reply = public.SolveSensitiveWord(reply)
|
||||
}
|
||||
// 回复@我的用户
|
||||
_, err = rmsg.ReplyToDingtalk(string(dingbot.TEXT), reply)
|
||||
if err != nil {
|
||||
@@ -204,6 +207,9 @@ func Do(mode string, rmsg *dingbot.ReceiveMsg) error {
|
||||
// 将当前回答的ID放入缓存
|
||||
public.UserService.SetAnswerID(rmsg.SenderNick, rmsg.GetChatTitle(), aid)
|
||||
logger.Info(fmt.Sprintf("🤖 %s得到的答案: %#v", rmsg.SenderNick, reply))
|
||||
if public.JudgeSensitiveWord(reply) {
|
||||
reply = public.SolveSensitiveWord(reply)
|
||||
}
|
||||
// 回复@我的用户
|
||||
_, err = rmsg.ReplyToDingtalk(string(dingbot.TEXT), reply)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user