调整群CD设置

This commit is contained in:
Kokomi 2023-04-01 13:34:20 +08:00
parent 076e7de60f
commit 1adf043b21
3 changed files with 27 additions and 27 deletions

View File

@ -1,7 +1,7 @@
# 默认设置
default:
groupCD: 500 # 群聊中所有指令操作冷却时间,单位毫秒,0则无限制
singleCD: 2000 # 群聊中个人操作冷却时间,单位毫秒
groupGlobalCD: 0 # 群聊中所有指令操作冷却时间,单位毫秒,0则无限制
singleCD: 1000 # 群聊中个人操作冷却时间,单位毫秒
onlyReplyAt: 0 # 是否只仅关注主动@机器人的消息, 0-否 1-是
botAlias: # 开启后则只回复@机器人的消息及特定前缀的消息,支持多个
@ -22,5 +22,5 @@ default:
# 群单独设置,自动覆盖默认值
123456:
groupCD: 500 # 群聊中所有指令操作冷却时间,单位毫秒,0则无限制
singleCD: 2000 # 群聊中个人操作冷却时间,单位毫秒
groupGlobalCD: 0 # 群聊中所有指令操作冷却时间,单位毫秒,0则无限制
singleCD: 1000 # 群聊中个人操作冷却时间,单位毫秒

View File

@ -25,7 +25,7 @@ class PluginsLoader {
this.dir = './plugins'
/** 命令冷却cd */
this.groupCD = {}
this.groupGlobalCD = {}
this.singleCD = {}
/** 插件监听 */
@ -620,7 +620,7 @@ class PluginsLoader {
let config = cfg.getGroup(e.group_id)
if (config.groupCD && this.groupCD[e.group_id]) {
if (config.groupGlobalCD && this.groupGlobalCD[e.group_id]) {
return false
}
if (config.singleCD && this.singleCD[`${e.group_id}.${e.user_id}`]) {
@ -635,11 +635,11 @@ class PluginsLoader {
if (!e.message || e.isPrivate) return
let config = cfg.getGroup(e.group_id)
if (config.groupCD) {
this.groupCD[e.group_id] = true
if (config.groupGlobalCD) {
this.groupGlobalCD[e.group_id] = true
setTimeout(() => {
delete this.groupCD[e.group_id]
}, config.groupCD)
delete this.groupGlobalCD[e.group_id]
}, config.groupGlobalCD)
}
if (config.singleCD) {
let key = `${e.group_id}.${e.user_id}`