koishi-plugin-group-control 1.0.0-alpha.7 → 1.0.0

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 (3) hide show
  1. package/lib/index.js +16 -20
  2. package/package.json +1 -4
  3. package/LICENSE +0 -21
package/lib/index.js CHANGED
@@ -349,8 +349,8 @@ __name(getGroupName, "getGroupName");
349
349
  function apply2(ctx, config) {
350
350
  const quittingGuilds = /* @__PURE__ */ new Map();
351
351
  const processedKicks = /* @__PURE__ */ new Map();
352
- const QUITTING_EXPIRE_MS = 5 * 60 * 1e3;
353
- const KICK_DEDUP_MS = 5 * 60 * 1e3;
352
+ const QUITTING_EXPIRE_MS = 60 * 1e3;
353
+ const KICK_DEDUP_MS = 60 * 1e3;
354
354
  setInterval(() => {
355
355
  const now = Date.now();
356
356
  for (const [key, time] of quittingGuilds) {
@@ -459,7 +459,6 @@ function apply2(ctx, config) {
459
459
  ctx.on("guild-removed", async (session) => {
460
460
  const { guildId, platform } = session;
461
461
  const quittingKey = `${platform}:${guildId}`;
462
- ctx.logger("group-control-basic").info(`[guild-removed] 触发!guildId=${guildId}, platform=${platform}, isQuitting=${quittingGuilds.has(quittingKey)}, isProcessed=${processedKicks.has(quittingKey)}`);
463
462
  if (quittingGuilds.has(quittingKey)) {
464
463
  return;
465
464
  }
@@ -582,20 +581,21 @@ function apply3(ctx, config) {
582
581
  } catch (error) {
583
582
  console.error(`发送等待审核提示给 ${rawUserId} 失败:`, error);
584
583
  }
585
- if (!config.admin.adminQQs || config.admin.adminQQs.length === 0) {
586
- if (config.invite.autoApprove) {
587
- try {
588
- await session.bot.internal.setGroupAddRequest(flag, "invite", true, "");
589
- approvedGroups.add(rawGroupId);
590
- if (config.invite.showDetailedLog) {
591
- console.log(`自动同意群聊邀请: 群号 ${rawGroupId}, 邀请者 ${rawUserId}`);
592
- }
593
- } catch (error) {
594
- console.error("自动同意群聊邀请失败:", error);
584
+ if (config.invite.autoApprove) {
585
+ try {
586
+ await session.bot.internal.setGroupAddRequest(flag, "invite", true, "");
587
+ approvedGroups.add(rawGroupId);
588
+ if (config.invite.showDetailedLog) {
589
+ console.log(`自动同意群聊邀请: 群号 ${rawGroupId}, 邀请者 ${rawUserId}`);
595
590
  }
591
+ } catch (error) {
592
+ console.error("自动同意群聊邀请失败:", error);
596
593
  }
597
594
  return;
598
595
  }
596
+ if (!config.admin.adminQQs || config.admin.adminQQs.length === 0) {
597
+ return;
598
+ }
599
599
  await addPendingInvite(ctx, {
600
600
  groupId: rawGroupId,
601
601
  userId: rawUserId,
@@ -921,12 +921,8 @@ function apply5(ctx, config) {
921
921
  if (errorMsg) return errorMsg;
922
922
  const guildId = parseGuildId(input);
923
923
  if (!guildId) return `输入格式错误。`;
924
- const existing = await getBlacklistedGuild(ctx, guildId);
925
- if (existing.length === 0) return `群聊 ${guildId} 不在黑名单中。`;
926
- await removeBlacklistedGuild(ctx, guildId);
927
- const check = await getBlacklistedGuild(ctx, guildId);
928
- if (check.length > 0) return `群聊 ${guildId} 移除失败,请重试。`;
929
- return `已移除群聊 ${guildId},当前黑名单中已不存在该群。`;
924
+ const removed = await removeBlacklistedGuild(ctx, guildId);
925
+ return removed ? `已移除群聊 ${guildId}` : `群聊 ${guildId} 不在黑名单中。`;
930
926
  });
931
927
  ctx.command("gc.banlist", "查看黑名单").action(async ({ session }) => {
932
928
  if (!hasGlobalPermission(session, config)) return "权限不足,只有全局管理员可以执行此操作。";
@@ -1187,7 +1183,7 @@ var Config = import_koishi.Schema.intersect([
1187
1183
  import_koishi.Schema.object({
1188
1184
  invite: import_koishi.Schema.object({
1189
1185
  enabled: import_koishi.Schema.boolean().default(false).description("启用群聊邀请审核"),
1190
- autoApprove: import_koishi.Schema.boolean().default(false).description("自动同意邀请(仅在未指定管理员时生效)"),
1186
+ autoApprove: import_koishi.Schema.boolean().default(false).description("自动同意邀请"),
1191
1187
  inviteWaitMessage: import_koishi.Schema.string().default("已收到您的群聊邀请,正在等待管理员审核,请耐心等待。").description("发给邀请者的等待提示"),
1192
1188
  inviteRequestMessage: import_koishi.Schema.string().default("收到新的群聊邀请请求:\n群名称:{groupName}\n群号:{groupId}\n邀请者:{userName} (QQ: {userId})\n\n请使用指令 gc.approve {groupId} 同意或 gc.reject {groupId} 拒绝。").description("发给管理员的请求消息模板,支持变量 {groupName}, {groupId}, {userName}, {userId}"),
1193
1189
  inviteExpireDays: import_koishi.Schema.number().default(3).description("邀请记录过期天数"),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-group-control",
3
3
  "description": "Koishi 插件,一个多功能的群聊自管理工具。支持被踢出自动拉黑、刷屏自动屏蔽、开关控制等功能。(仅支持 OneBot 适配器)",
4
- "version": "1.0.0-alpha.7",
4
+ "version": "1.0.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -22,8 +22,5 @@
22
22
  ],
23
23
  "peerDependencies": {
24
24
  "koishi": "^4.18.7"
25
- },
26
- "devDependencies": {
27
- "@types/node": "^22.19.7"
28
25
  }
29
26
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 muyni
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.