Skip to content

Commit

Permalink
fix: 新增如果黑白名单未启用会进行提示
Browse files Browse the repository at this point in the history
  • Loading branch information
yusheng929 committed Aug 27, 2024
1 parent 121cbcf commit 3c462d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/Assistant.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { karin, YamlEditor } from 'node-karin'
import { karin, YamlEditor, config } from 'node-karin'

/**
* 更新群组通知状态
Expand Down Expand Up @@ -35,8 +35,10 @@ const Edit = async (e, type, isRemoval, targetType, id) => {
if (!isRemoval) {
if (targetType === 'Group') {
yaml.append(`${type === 'White' ? 'WhiteList.groups' : 'BlackList.groups'}`, String(id))
if ((type === 'White' && !config.App.WhiteList.groups) || type === 'Black' && !config.App.WhiteList.groups) e.reply(`当前${type === 'White' ? "白" : "黑"}名单中的群配置未开启,黑白名单将无效,可前往config/config/App.yaml中启用`)
} else {
yaml.append(`${type === 'White' ? 'WhiteList.users' : 'BlackList.users'}`, String(id))
if ((type === 'White' && !config.App.WhiteList.users) || type === 'Black' && !config.App.WhiteList.users) e.reply(`当前${type === 'White' ? "白" : "黑"}名单中的用户配置未开启,黑白名单将无效,可前往config/config/App.yaml中启用`)
}
await e.reply(`已经将${targetType === 'Group' ? "群" : "用户"}${id}${type === 'White' ? "拉白" : "拉黑"}掉了`)
} else {
Expand Down

0 comments on commit 3c462d9

Please sign in to comment.