🆕 新增每日免费AI对话次数限制

This commit is contained in:
李寻欢 2024-08-17 13:16:05 +08:00
parent e08ad4b438
commit 88f4069c8e

View File

@ -19,6 +19,8 @@ import (
"time"
)
var notifyMap = make(map[string]bool)
// AI
// @description: AI消息
// @param m
@ -38,9 +40,15 @@ func AI(m *plugin.MessageContext) {
return
}
if friendInfo.AiUsedToday > 0 && friendInfo.AiUsedToday >= friendInfo.AiFreeLimit {
_ = utils.SendMessage(m.FromUser, "", fmt.Sprintf("本群今天的免费次数已经用完啦,明天再来找我聊天吧~\n每天限制%d次0点自动重置", friendInfo.AiFreeLimit), 0)
if notifyMap[m.FromUser] {
return
}
_ = utils.SendMessage(m.FromUser, "", fmt.Sprintf("本群今天的免费次数已经用完啦,明天再来找我聊天吧~\n每天限制%d次0点自动重置", friendInfo.AiFreeLimit), 0)
notifyMap[m.FromUser] = true
return
} else {
notifyMap[m.FromUser] = false
}
var err error
defer func() {