koishi-plugin-onebot-verifier 1.2.1 → 1.2.2

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.
Files changed (2) hide show
  1. package/lib/index.js +8 -6
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -88,7 +88,7 @@ var Config = import_koishi.Schema.intersect([
88
88
  }).description("加群请求配置"),
89
89
  import_koishi.Schema.object({
90
90
  voteInSitu: import_koishi.Schema.boolean().description("[投票]原群投票模式").default(true),
91
- voteRatio: import_koishi.Schema.string().description("[投票]支持/反对人数").default("3:2"),
91
+ voteRatio: import_koishi.Schema.string().description("[投票]支持/反对人数").default("5:1"),
92
92
  captchaDiff: import_koishi.Schema.union([
93
93
  import_koishi.Schema.const("simple").description("简单"),
94
94
  import_koishi.Schema.const("medium").description("中等"),
@@ -133,7 +133,7 @@ function apply(ctx, config) {
133
133
  return false;
134
134
  }
135
135
  }, "executeAction");
136
- const sendNotice = /* @__PURE__ */ __name(async (session, kind, status = "waiting", overrideTarget) => {
136
+ const sendNotice = /* @__PURE__ */ __name(async (session, kind, status = "waiting", overrideTarget, specialMode) => {
137
137
  const notifyConfig = overrideTarget || config.notifyTarget || "";
138
138
  const [targetType, targetId] = notifyConfig.split(":");
139
139
  if (!targetId || !session.bot) return [];
@@ -152,7 +152,10 @@ function apply(ctx, config) {
152
152
  if (adminId) infoLines.push(`管理:${adminInfo?.name ? `${adminInfo.name}(${adminId})` : adminId}`);
153
153
  if (session.guildId) infoLines.push(`群组:${groupInfo?.name ? `${groupInfo.name}(${session.guildId})` : session.guildId}`);
154
154
  if (eventData.comment) infoLines.push(`验证信息:${eventData.comment}`);
155
- if (status === "waiting" && kind !== "removed") infoLines.push(`回复"y/n"以同意/拒绝该请求`);
155
+ if (status === "waiting" && kind !== "removed") {
156
+ if (specialMode === "vote") infoLines.push(`[投票模式]需${config.voteRatio.split(":")[0]}人同意或${config.voteRatio.split(":")[1]}人拒绝`);
157
+ infoLines.push(`使用"y/n"回复本消息以处理该请求`);
158
+ }
156
159
  const content = infoLines.join("\n");
157
160
  const msgIds = await (targetType === "private" ? session.bot.sendPrivateMessage(targetId, content) : session.bot.sendMessage(targetId, content)) || [];
158
161
  return msgIds;
@@ -165,7 +168,7 @@ function apply(ctx, config) {
165
168
  const timeoutCfg = kind === "member" ? config.memberTimeout : config.friendTimeout;
166
169
  let targetStr = config.notifyTarget || "";
167
170
  if (useInSitu && kind === "member" && session.guildId) targetStr = `guild:${session.guildId}`;
168
- const msgIds = await sendNotice(session, kind, "waiting", targetStr);
171
+ const msgIds = await sendNotice(session, kind, "waiting", targetStr, specialMode);
169
172
  if (!msgIds?.length) return;
170
173
  const task = { session, kind, messages: msgIds, specialMode, inSitu: useInSitu };
171
174
  if (specialMode === "vote") {
@@ -324,8 +327,7 @@ function apply(ctx, config) {
324
327
  if (task.timer) clearTimeout(task.timer);
325
328
  task.messages.forEach((msg) => activeTasks.delete(msg));
326
329
  const isSuccess = await executeAction(task.session, task.kind, finalVerdict, finalVerdict ? "" : extraInfo);
327
- const replyText = isSuccess ? `已${finalVerdict ? "通过" : "拒绝"}该投票` : `处理投票失败`;
328
- await session.send(replyText).catch(() => {
330
+ if (!task.inSitu) await session.send(isSuccess ? `已${finalVerdict ? "通过" : "拒绝"}该投票` : `处理投票失败`).catch(() => {
329
331
  });
330
332
  }, "handleSpecialVote");
331
333
  ctx.on("friend-request", hookEvent("friend"));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-onebot-verifier",
3
3
  "description": "[仅支持 Onebot 平台]支持好友申请/群组邀请/加群请求等的自动审核,可根据等级与正则进行筛选,并有入群验证码、投票表决、被踢清理等功能。",
4
- "version": "1.2.1",
4
+ "version": "1.2.2",
5
5
  "contributors": [
6
6
  "Yis_Rime <yis_rime@outlook.com>"
7
7
  ],