koishi-plugin-onebot-verifier 1.2.6 → 1.2.8
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 +2 -1
- package/lib/index.js +7 -4
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ export declare const name = "onebot-verifier";
|
|
|
3
3
|
export declare const inject: {
|
|
4
4
|
optional: string[];
|
|
5
5
|
};
|
|
6
|
-
export declare const usage = "\n<div style=\"border-radius: 10px; border: 1px solid #ddd; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);\">\n <h2 style=\"margin-top: 0; color: #4a6ee0;\">\uD83D\uDCCC \u63D2\u4EF6\u8BF4\u660E</h2>\n <p>\uD83D\uDCD6 <strong>\u4F7F\u7528\u6587\u6863</strong>\uFF1A\u8BF7\u70B9\u51FB\u5DE6\u4E0A\u89D2\u7684 <strong>\u63D2\u4EF6\u4E3B\u9875</strong> \u67E5\u770B\u63D2\u4EF6\u4F7F\u7528\u6587\u6863</p>\n <p>\uD83D\uDD0D <strong>\u66F4\u591A\u63D2\u4EF6</strong>\uFF1A\u53EF\u8BBF\u95EE <a href=\"https://github.com/YisRime\" style=\"color:#4a6ee0;text-decoration:none;\">\u82E1\u6DDE\u7684 GitHub</a> \u67E5\u770B\u672C\u4EBA\u7684\u6240\u6709\u63D2\u4EF6</p>\n</div>\n<div style=\"border-radius: 10px; border: 1px solid #ddd; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);\">\n <h2 style=\"margin-top: 0; color: #e0574a;\">\u2764\uFE0F \u652F\u6301\u4E0E\u53CD\u9988</h2>\n <p>\uD83C\uDF1F \u559C\u6B22\u8FD9\u4E2A\u63D2\u4EF6\uFF1F\u8BF7\u5728 <a href=\"https://github.com/YisRime\" style=\"color:#e0574a;text-decoration:none;\">GitHub</a> \u4E0A\u7ED9\u6211\u4E00\u4E2A Star\uFF01</p>\n <p>\uD83D\uDC1B \u9047\u5230\u95EE\u9898\uFF1F\u8BF7\u901A\u8FC7 <strong>Issues</strong> \u63D0\u4EA4\u53CD\u9988\uFF0C\u6216\u52A0\u5165 QQ \u7FA4 <a href=\"https://qm.
|
|
6
|
+
export declare const usage = "\n<div style=\"border-radius: 10px; border: 1px solid #ddd; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);\">\n <h2 style=\"margin-top: 0; color: #4a6ee0;\">\uD83D\uDCCC \u63D2\u4EF6\u8BF4\u660E</h2>\n <p>\uD83D\uDCD6 <strong>\u4F7F\u7528\u6587\u6863</strong>\uFF1A\u8BF7\u70B9\u51FB\u5DE6\u4E0A\u89D2\u7684 <strong>\u63D2\u4EF6\u4E3B\u9875</strong> \u67E5\u770B\u63D2\u4EF6\u4F7F\u7528\u6587\u6863</p>\n <p>\uD83D\uDD0D <strong>\u66F4\u591A\u63D2\u4EF6</strong>\uFF1A\u53EF\u8BBF\u95EE <a href=\"https://github.com/YisRime\" style=\"color:#4a6ee0;text-decoration:none;\">\u82E1\u6DDE\u7684 GitHub</a> \u67E5\u770B\u672C\u4EBA\u7684\u6240\u6709\u63D2\u4EF6</p>\n</div>\n<div style=\"border-radius: 10px; border: 1px solid #ddd; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);\">\n <h2 style=\"margin-top: 0; color: #e0574a;\">\u2764\uFE0F \u652F\u6301\u4E0E\u53CD\u9988</h2>\n <p>\uD83C\uDF1F \u559C\u6B22\u8FD9\u4E2A\u63D2\u4EF6\uFF1F\u8BF7\u5728 <a href=\"https://github.com/YisRime\" style=\"color:#e0574a;text-decoration:none;\">GitHub</a> \u4E0A\u7ED9\u6211\u4E00\u4E2A Star\uFF01</p>\n <p>\uD83D\uDC1B \u9047\u5230\u95EE\u9898\uFF1F\u8BF7\u901A\u8FC7 <strong>Issues</strong> \u63D0\u4EA4\u53CD\u9988\uFF0C\u6216\u52A0\u5165 QQ \u7FA4 <a href=\"https://qm.qq.com/q/PdLMx9Jowq\" style=\"color:#e0574a;text-decoration:none;\"><strong>855571375</strong></a> \u8FDB\u884C\u4EA4\u6D41</p>\n</div>\n";
|
|
7
7
|
export interface Config {
|
|
8
8
|
notifyTarget?: string;
|
|
9
9
|
debugMode?: boolean;
|
|
10
10
|
kickBan?: boolean;
|
|
11
|
+
blacklist?: string[];
|
|
11
12
|
friendTimeout: false | number;
|
|
12
13
|
friendLevel?: number;
|
|
13
14
|
friendRegex?: string;
|
package/lib/index.js
CHANGED
|
@@ -39,14 +39,15 @@ var usage = `
|
|
|
39
39
|
<div style="border-radius: 10px; border: 1px solid #ddd; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);">
|
|
40
40
|
<h2 style="margin-top: 0; color: #e0574a;">❤️ 支持与反馈</h2>
|
|
41
41
|
<p>🌟 喜欢这个插件?请在 <a href="https://github.com/YisRime" style="color:#e0574a;text-decoration:none;">GitHub</a> 上给我一个 Star!</p>
|
|
42
|
-
<p>🐛 遇到问题?请通过 <strong>Issues</strong> 提交反馈,或加入 QQ 群 <a href="https://qm.
|
|
42
|
+
<p>🐛 遇到问题?请通过 <strong>Issues</strong> 提交反馈,或加入 QQ 群 <a href="https://qm.qq.com/q/PdLMx9Jowq" style="color:#e0574a;text-decoration:none;"><strong>855571375</strong></a> 进行交流</p>
|
|
43
43
|
</div>
|
|
44
44
|
`;
|
|
45
45
|
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