koishi-plugin-group-control 1.0.5 → 1.1.0-alpha.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.
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.5",
4
+ "version": "1.1.0-alpha.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Koishi 插件,多功能群聊自管理工具。仅支持 OneBot 适配器。
6
6
 
7
- > 使用 Qwen3-Coder & Gemini-3.1-Pro-Preview & Claude Sonnet/Opus 4.6 协助完成
7
+ > 使用 AI Agent 协助完成
8
8
 
9
9
  ---
10
10
 
@@ -189,9 +189,9 @@ Koishi 插件,多功能群聊自管理工具。仅支持 OneBot 适配器。
189
189
  | `gc.approve <群号>` | 同意加入指定群 |
190
190
  | `gc.reject <群号>` | 拒绝加入指定群 |
191
191
  | `gc.pending` | 查看待处理的群聊邀请列表 |
192
- | `gc.fa <QQ号>` | 同意好友申请 |
193
- | `gc.fr <QQ号>` | 拒绝好友申请 |
194
- | `gc.fp` | 查看待处理的好友申请列表 |
192
+ | `gc.friend-approve <QQ号>` | 同意好友申请(兼容别名:`gc.fa`) |
193
+ | `gc.friend-reject <QQ号>` | 拒绝好友申请(兼容别名:`gc.fr`) |
194
+ | `gc.friend-pending` | 查看待处理的好友申请列表(兼容别名:`gc.fp`) |
195
195
 
196
196
  ### 群聊管理
197
197
 
package/lib/config.d.ts DELETED
@@ -1,88 +0,0 @@
1
- import { Schema } from 'koishi';
2
- export interface GroupConfig {
3
- welcomeMessage: string;
4
- quitMessage: string;
5
- quitCommandEnabled: boolean;
6
- enableBlacklist: boolean;
7
- blacklistMessage: string;
8
- notifyAdminOnKick: boolean;
9
- kickNotificationMessage: string;
10
- smallGroupAutoQuit: boolean;
11
- smallGroupThreshold: number;
12
- smallGroupQuitMessage: string;
13
- smallGroupNotifyAdmin: boolean;
14
- smallGroupCheckDelay: number;
15
- smallGroupExcludeOfficialBots: boolean;
16
- smallGroupRealtimeMonitor: boolean;
17
- smallGroupRecheckCooldown: number;
18
- smallGroupQualifiedNotifyAdmin: boolean;
19
- smallGroupQualifiedMessage: string;
20
- notifyAdminOnMute: boolean;
21
- muteNotificationMessage: string;
22
- muteAutoQuit: boolean;
23
- muteAutoQuitThreshold: number;
24
- muteQuitNotificationMessage: string;
25
- }
26
- export interface AdminConfig {
27
- adminQQs: string[];
28
- notificationGroupId: string;
29
- }
30
- export interface GroupInviteConfig {
31
- enabled: boolean;
32
- inviteWaitMessage: string;
33
- inviteRequestMessage: string;
34
- autoApprove: boolean;
35
- notifyAdminOnApprove: boolean;
36
- inviteApproveMessage: string;
37
- inviteApproveNotificationMessage: string;
38
- showDetailedLog: boolean;
39
- inviteExpireDays: number;
40
- }
41
- export interface FrequencyConfig {
42
- enabled: boolean;
43
- limit: number;
44
- window: number;
45
- warnDelay: number;
46
- blockDur: number;
47
- whitelist: string[];
48
- privateEnabled: boolean;
49
- privateLimit: number;
50
- privateWindow: number;
51
- privateWarnDelay: number;
52
- privateBlockDur: number;
53
- privateWhitelist: string[];
54
- blockExpBase: number;
55
- blockExpWindow: number;
56
- blockNotifyCooldown: number;
57
- warnMsg: string;
58
- blockMsg: string;
59
- blockedMsg: string;
60
- }
61
- export interface FriendConfig {
62
- enabled: boolean;
63
- autoApprove: boolean;
64
- notifyAdminOnApprove: boolean;
65
- requestExpireDays: number;
66
- requestMessage: string;
67
- approveNotificationMessage: string;
68
- }
69
- export interface BotSwitchConfig {
70
- enabled: boolean;
71
- defaultState: boolean;
72
- disabledMessage: string;
73
- }
74
- export interface PermissionConfig {
75
- mode: 'koishi' | 'builtin';
76
- koishiAuthority: number;
77
- protectedCommands: string[];
78
- }
79
- export interface Config {
80
- admin: AdminConfig;
81
- permission: PermissionConfig;
82
- basic: GroupConfig;
83
- invite: GroupInviteConfig;
84
- friend: FriendConfig;
85
- frequency: FrequencyConfig;
86
- botSwitch: BotSwitchConfig;
87
- }
88
- export declare const Config: Schema<Config>;
package/lib/database.d.ts DELETED
@@ -1,105 +0,0 @@
1
- import { Context } from 'koishi';
2
- export interface BlacklistedGuild {
3
- platform: string;
4
- guildId: string;
5
- timestamp: number;
6
- reason: string;
7
- }
8
- export interface CommandFrequencyRecord {
9
- platform: string;
10
- guildId: string;
11
- commandCount: number;
12
- lastCommandTime: number;
13
- warningSent: boolean;
14
- blockExpiryTime: number;
15
- firstWarningTime: number;
16
- blockCount: number;
17
- lastBlockNotifyTime: number;
18
- }
19
- export interface GroupBotStatus {
20
- platform: string;
21
- guildId: string;
22
- botEnabled: boolean;
23
- }
24
- export interface SmallGroupWhitelist {
25
- platform: string;
26
- guildId: string;
27
- }
28
- export interface ApprovedGuild {
29
- platform: string;
30
- guildId: string;
31
- timestamp: number;
32
- }
33
- export interface SelfLeftGuild {
34
- platform: string;
35
- guildId: string;
36
- timestamp: number;
37
- }
38
- export interface PendingInvite {
39
- platform: string;
40
- groupId: string;
41
- userId: string;
42
- userName: string;
43
- groupName: string;
44
- time: number;
45
- flag: string;
46
- }
47
- export interface PendingFriendRequest {
48
- platform: string;
49
- userId: string;
50
- nickname: string;
51
- comment: string;
52
- flag: string;
53
- time: number;
54
- }
55
- declare module 'koishi' {
56
- interface Tables {
57
- blacklisted_guild: BlacklistedGuild;
58
- command_frequency_record: CommandFrequencyRecord;
59
- group_bot_status: GroupBotStatus;
60
- small_group_whitelist: SmallGroupWhitelist;
61
- self_left_guild: SelfLeftGuild;
62
- approved_guild: ApprovedGuild;
63
- pending_invite: PendingInvite;
64
- pending_friend_request: PendingFriendRequest;
65
- }
66
- }
67
- export declare const name = "group-control-database";
68
- export declare function apply(ctx: Context): void;
69
- export declare const BLACKLIST_PLATFORM = "onebot";
70
- export declare function getBlacklistedGuild(ctx: Context, guildId: string): Promise<BlacklistedGuild[]>;
71
- export declare function removeBlacklistedGuild(ctx: Context, guildId: string): Promise<import("minato").Driver.WriteResult>;
72
- export declare function createBlacklistedGuild(ctx: Context, guildId: string, reason: string): Promise<import("minato").Driver.WriteResult>;
73
- export declare function getAllBlacklistedGuilds(ctx: Context): Promise<BlacklistedGuild[]>;
74
- export declare function clearBlacklistedGuilds(ctx: Context): Promise<import("minato").Driver.WriteResult>;
75
- /** 统一写入被踢黑名单行,保证 platform = BLACKLIST_PLATFORM */
76
- export declare function blacklistKicked(ctx: Context, guildId: string): Promise<import("minato").Driver.WriteResult>;
77
- /** 在主动退群前写入标记,让 guild-removed 能区分「自己退的」和「被踢的」*/
78
- export declare function markSelfLeft(ctx: Context, guildId: string): Promise<void>;
79
- /** 消费标记(单次读取后删除),返回是否在 maxAgeSec 内。用于 guild-removed 判断是自己退的 */
80
- export declare function consumeSelfLeft(ctx: Context, guildId: string, maxAgeSec?: number): Promise<boolean>;
81
- /** 清理标记(退群失败时回滚,或 unban 时清理)*/
82
- export declare function clearSelfLeft(ctx: Context, guildId: string): Promise<void>;
83
- /** 定期清理过期的主动退群标记(超过 maxAgeSec 秒未消费的)*/
84
- export declare function clearExpiredSelfLeft(ctx: Context, maxAgeSec?: number): Promise<void>;
85
- export declare function getCommandFrequencyRecord(ctx: Context, platform: string, guildId: string): Promise<CommandFrequencyRecord>;
86
- export declare function updateCommandFrequencyRecord(ctx: Context, platform: string, guildId: string, data: Partial<CommandFrequencyRecord>): Promise<void>;
87
- export declare function getGroupBotStatus(ctx: Context, platform: string, guildId: string): Promise<GroupBotStatus | null>;
88
- export declare function setGroupBotStatus(ctx: Context, platform: string, guildId: string, botEnabled: boolean): Promise<void>;
89
- export declare function isInSmallGroupWhitelist(ctx: Context, guildId: string): Promise<boolean>;
90
- export declare function addToSmallGroupWhitelist(ctx: Context, guildId: string): Promise<void>;
91
- export declare function removeFromSmallGroupWhitelist(ctx: Context, guildId: string): Promise<void>;
92
- export declare function getAllSmallGroupWhitelist(ctx: Context): Promise<SmallGroupWhitelist[]>;
93
- export declare function markApprovedGuild(ctx: Context, guildId: string): Promise<void>;
94
- export declare function isApprovedGuild(ctx: Context, guildId: string): Promise<boolean>;
95
- export declare function clearApprovedGuild(ctx: Context, guildId: string): Promise<void>;
96
- export declare function getPendingInvite(ctx: Context, groupId: string): Promise<PendingInvite>;
97
- export declare function addPendingInvite(ctx: Context, inviteUser: Omit<PendingInvite, 'platform'>): Promise<void>;
98
- export declare function removePendingInvite(ctx: Context, groupId: string): Promise<void>;
99
- export declare function getAllPendingInvites(ctx: Context): Promise<PendingInvite[]>;
100
- export declare function clearExpiredPendingInvites(ctx: Context, expireTimeMs: number): Promise<void>;
101
- export declare function getPendingFriendRequest(ctx: Context, platform: string, userId: string): Promise<PendingFriendRequest>;
102
- export declare function addPendingFriendRequest(ctx: Context, platform: string, data: Omit<PendingFriendRequest, 'platform'>): Promise<void>;
103
- export declare function removePendingFriendRequest(ctx: Context, platform: string, userId: string): Promise<void>;
104
- export declare function getAllPendingFriendRequests(ctx: Context, platform: string): Promise<PendingFriendRequest[]>;
105
- export declare function clearExpiredPendingFriendRequests(ctx: Context, platform: string, expireTimeMs: number): Promise<void>;
package/lib/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Context } from 'koishi';
2
- import { Config } from './config';
3
- export * from './config';
4
- export declare const name = "group-control";
5
- export declare const inject: string[];
6
- export declare function apply(ctx: Context, config: Config): void;