koishi-plugin-onebot-verifier 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -3
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -46,7 +46,8 @@ var Config = import_koishi.Schema.intersect([
|
|
|
46
46
|
import_koishi.Schema.object({
|
|
47
47
|
notifyTarget: import_koishi.Schema.string().description("通知目标(guild/private:number)").required(),
|
|
48
48
|
debugMode: import_koishi.Schema.boolean().description("输出调试日志").default(false),
|
|
49
|
-
kickBan: import_koishi.Schema.boolean().description("被踢自动处理").default(false)
|
|
49
|
+
kickBan: import_koishi.Schema.boolean().description("被踢自动处理").default(false),
|
|
50
|
+
blacklist: import_koishi.Schema.array(import_koishi.Schema.string()).description("群组黑名单").role("table")
|
|
50
51
|
}).description("基础配置"),
|
|
51
52
|
import_koishi.Schema.object({
|
|
52
53
|
friendTimeout: import_koishi.Schema.union([
|
|
@@ -208,6 +209,7 @@ function apply(ctx, config) {
|
|
|
208
209
|
const eventData = session.event?._data || {};
|
|
209
210
|
if (eventData.user_id) session.userId = String(eventData.user_id);
|
|
210
211
|
if (eventData.group_id) session.guildId = String(eventData.group_id);
|
|
212
|
+
if (session.guildId && config.blacklist?.includes(session.guildId)) return;
|
|
211
213
|
try {
|
|
212
214
|
if (config.debugMode) logger.info(`[请求] 类型: ${kind} 数据: ${JSON.stringify(eventData)}`);
|
|
213
215
|
if (kind === "friend") {
|
|
@@ -351,11 +353,11 @@ function apply(ctx, config) {
|
|
|
351
353
|
ctx.on("guild-member-request", hookEvent("member"));
|
|
352
354
|
ctx.on("guild-added", hookEvent("guild"));
|
|
353
355
|
ctx.on("guild-member-removed", async (session) => {
|
|
354
|
-
if (!session.guildId || !session.userId) return;
|
|
356
|
+
if (!session.guildId || !session.userId || config.blacklist?.includes(session.guildId)) return;
|
|
355
357
|
if (config.verifyRules?.some((r) => r.guildId === session.guildId)) historyMap.set(`${session.userId}:${session.guildId}`, Date.now());
|
|
356
358
|
});
|
|
357
359
|
ctx.on("guild-member-added", async (session) => {
|
|
358
|
-
if (!config.specialRules || !session.guildId || !session.userId) return;
|
|
360
|
+
if (!config.specialRules || !session.guildId || !session.userId || config.blacklist?.includes(session.guildId)) return;
|
|
359
361
|
const rule = config.specialRules.find((r) => r.guildId === session.guildId);
|
|
360
362
|
if (rule?.mode === "captcha") {
|
|
361
363
|
let a, b, op = "+", answer;
|
|
@@ -394,6 +396,7 @@ function apply(ctx, config) {
|
|
|
394
396
|
});
|
|
395
397
|
ctx.on("guild-removed", async (session) => {
|
|
396
398
|
if (session.guildId) {
|
|
399
|
+
if (config.blacklist?.includes(session.guildId)) return;
|
|
397
400
|
const eventData = session.event?._data || {};
|
|
398
401
|
if (config.debugMode) logger.info(`[事件] 退出: ${session.guildId} 数据: ${JSON.stringify(eventData)}`);
|
|
399
402
|
if (eventData.sub_type === "kick_me") {
|
package/package.json
CHANGED