koishi-plugin-onebot-verifier 1.2.5 → 1.2.6

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 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -113,10 +113,13 @@ function apply(ctx, config) {
113
113
  const eventData = session.event?._data || {};
114
114
  if (config.debugMode) logger.info(`[操作] 类型: ${kind} 结果: ${pass ? "同意" : "拒绝"} 原因: ${reason || "无"}`);
115
115
  if (pass && kind === "guild" && session.guildId && session.userId) inviterMap.set(session.guildId, session.userId);
116
- if (!pass && kind === "guild" && session.userId && session.bot) {
117
- const rejectMsg = `已拒绝该群组邀请${reason ? `,原因:${reason}` : ""}`;
118
- await session.bot.sendPrivateMessage(session.userId, rejectMsg).catch(() => {
119
- });
116
+ if (!pass && kind === "guild" && session.bot) {
117
+ const targetId = eventData.operator_id || session.event?.operator?.id || session.userId;
118
+ if (targetId) {
119
+ const rejectMsg = `已拒绝该群组邀请${reason ? `,原因:${reason}` : ""}`;
120
+ await session.bot.sendPrivateMessage(targetId, rejectMsg).catch(() => {
121
+ });
122
+ }
120
123
  }
121
124
  if (!pass && kind === "guild" && session.guildId && (session.event?.type === "guild-added" || eventData.notice_type === "group_increase")) {
122
125
  if (reason) await session.bot?.sendMessage(session.guildId, `${reason},将退出该群`).catch(() => {
@@ -148,7 +151,7 @@ function apply(ctx, config) {
148
151
  const groupInfo = kind !== "friend" && session.guildId ? await session.bot.getGuild?.(session.guildId).catch(() => null) : null;
149
152
  const adminId = String(eventData.operator_id || session.event?.operator?.id || "");
150
153
  const adminInfo = adminId && adminId !== session.userId ? await session.bot.getUser?.(adminId).catch(() => null) : null;
151
- const typeMap = { friend: "好友申请", member: "加群请求", guild: eventData.post_type === "notice" ? "群组邀请 (通过)" : "群组邀请 (请求)", removed: eventData.sub_type === "kick_me" ? "移出群组" : "退出群组" };
154
+ const typeMap = { friend: "好友申请", member: "加群请求", guild: eventData.post_type === "notice" ? "群组邀请 (审核)" : "群组邀请 (请求)", removed: eventData.sub_type === "kick_me" ? "移出群组" : "退出群组" };
152
155
  const statusMap = { auto_pass: " [自动通过]", auto_reject: " [自动拒绝]", waiting: " [等待处理]" };
153
156
  const infoLines = [];
154
157
  if (userInfo?.avatar) infoLines.push(`<image url="${userInfo.avatar}"/>`);
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.5",
4
+ "version": "1.2.6",
5
5
  "contributors": [
6
6
  "Yis_Rime <yis_rime@outlook.com>"
7
7
  ],