@nestim/koishi-plugin-qq-group-manager 0.1.3
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/commands.d.ts +4 -0
- package/lib/commands.js +212 -0
- package/lib/index.d.ts +99 -0
- package/lib/index.js +187 -0
- package/lib/service.d.ts +167 -0
- package/lib/service.js +3160 -0
- package/lib/types.d.ts +23 -0
- package/lib/types.js +2 -0
- package/package.json +37 -0
- package/readme.md +203 -0
package/lib/service.d.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Context, Service, Session } from 'koishi';
|
|
2
|
+
import type { Config } from './index';
|
|
3
|
+
import type { ActionResult, AuthorizationResult, MuteParseResult } from './types';
|
|
4
|
+
declare module 'koishi' {
|
|
5
|
+
interface Context {
|
|
6
|
+
nestimQqGroupManager: QQGroupManagerService;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare class QQGroupManagerService extends Service {
|
|
10
|
+
ctx: Context;
|
|
11
|
+
config: Config;
|
|
12
|
+
private _logger;
|
|
13
|
+
private unauthorizedMuteAttempts;
|
|
14
|
+
private menuPairings;
|
|
15
|
+
private aiBuffers;
|
|
16
|
+
private aiCounters;
|
|
17
|
+
private aiLastReplyAt;
|
|
18
|
+
private aiInFlight;
|
|
19
|
+
private aiHandledEvents;
|
|
20
|
+
private aiFollowups;
|
|
21
|
+
private aiUserMemory;
|
|
22
|
+
private repeatStates;
|
|
23
|
+
private aiTopicMemory;
|
|
24
|
+
private pendingJoinRequests;
|
|
25
|
+
private pendingJoinRequestFlags;
|
|
26
|
+
private violationRecords;
|
|
27
|
+
constructor(ctx: Context, config: Config);
|
|
28
|
+
isPlatformAllowed(platform?: string): boolean;
|
|
29
|
+
private sessionTag;
|
|
30
|
+
private styleText;
|
|
31
|
+
private escapeHtml;
|
|
32
|
+
private collectCategories;
|
|
33
|
+
private resolveMenuCategory;
|
|
34
|
+
private pairingKey;
|
|
35
|
+
armMenuPairing(session?: Session, ttlMs?: number): void;
|
|
36
|
+
private getMessageText;
|
|
37
|
+
private aiGroupKey;
|
|
38
|
+
private resolveAiEnabled;
|
|
39
|
+
private extractAiMessageText;
|
|
40
|
+
private getDisplayName;
|
|
41
|
+
private isHomeUser;
|
|
42
|
+
private rememberUser;
|
|
43
|
+
private getFollowupSession;
|
|
44
|
+
private tokenizeTopic;
|
|
45
|
+
private scoreTopicRelevance;
|
|
46
|
+
private startFollowupSession;
|
|
47
|
+
private bumpFollowupSession;
|
|
48
|
+
private shouldContinueFollowup;
|
|
49
|
+
private getActivePersona;
|
|
50
|
+
private getActiveAgentName;
|
|
51
|
+
private getActiveSystemPrompt;
|
|
52
|
+
private containsAgentName;
|
|
53
|
+
private isMentionBot;
|
|
54
|
+
private isCommandLikeMessage;
|
|
55
|
+
private isDuplicateAiEvent;
|
|
56
|
+
private pushAiRecord;
|
|
57
|
+
private appendAiContextNote;
|
|
58
|
+
private shouldTriggerAiReply;
|
|
59
|
+
private parseInterestDecision;
|
|
60
|
+
private buildInterestContextPrompt;
|
|
61
|
+
private decideInterestByOpenAI;
|
|
62
|
+
private decideInterestByGemini;
|
|
63
|
+
private shouldReplyByInterest;
|
|
64
|
+
private buildAiUserPrompt;
|
|
65
|
+
private normalizeAiOutput;
|
|
66
|
+
private sanitizeAiOutputForSend;
|
|
67
|
+
private splitAiReplyParts;
|
|
68
|
+
private waitHumanLikeDelay;
|
|
69
|
+
private isAddressingOtherThanBot;
|
|
70
|
+
private extractAiImageUrls;
|
|
71
|
+
private callOpenAiCompatible;
|
|
72
|
+
private callGemini;
|
|
73
|
+
private extractImageUrls;
|
|
74
|
+
private extractMessageImageUrls;
|
|
75
|
+
private extractImageFingerprintKeys;
|
|
76
|
+
private normalizeRepeatText;
|
|
77
|
+
private buildRepeatPayload;
|
|
78
|
+
private parseCqImageParams;
|
|
79
|
+
private extractImageRefsFromRawMessage;
|
|
80
|
+
private extractImageSegmentsFromRawMessage;
|
|
81
|
+
private extractImageSendRefs;
|
|
82
|
+
private fetchMessageImagePayload;
|
|
83
|
+
private sendImageRef;
|
|
84
|
+
private handleRepeater;
|
|
85
|
+
private callOpenAiCompatibleWithImages;
|
|
86
|
+
private generateAiReply;
|
|
87
|
+
private maybeReplyWithAi;
|
|
88
|
+
private fetchOneBotStatus;
|
|
89
|
+
private fetchOnlineClientsCount;
|
|
90
|
+
private formatRssKbToMb;
|
|
91
|
+
private fetchProcessUsageByHints;
|
|
92
|
+
private fetchDockerUsageByHints;
|
|
93
|
+
private fetchLlbotClientUsage;
|
|
94
|
+
private fetchQqClientUsage;
|
|
95
|
+
private handleMenuPairing;
|
|
96
|
+
private getPuppeteer;
|
|
97
|
+
private formatBytes;
|
|
98
|
+
private sampleCpuUsage;
|
|
99
|
+
renderStatusCard(session?: Session): Promise<string>;
|
|
100
|
+
private renderCategoryHtml;
|
|
101
|
+
renderMenu(keyword?: string, session?: Session): Promise<string>;
|
|
102
|
+
private logAuth;
|
|
103
|
+
logCommandResult(command: string, result: ActionResult, session?: Session, extra?: Record<string, unknown>): void;
|
|
104
|
+
authorizeCommand(command: string, session?: Session): Promise<AuthorizationResult>;
|
|
105
|
+
authorize(session?: Session): Promise<AuthorizationResult>;
|
|
106
|
+
canUseAdminCommand(session?: Session): Promise<AuthorizationResult>;
|
|
107
|
+
private isBotOwnerInGroup;
|
|
108
|
+
private resolveMemberRole;
|
|
109
|
+
private normalizeRole;
|
|
110
|
+
private parseTargetId;
|
|
111
|
+
private randomMinutes;
|
|
112
|
+
private extractAtIds;
|
|
113
|
+
private parseDurationToken;
|
|
114
|
+
private extractMuteTokens;
|
|
115
|
+
private looksLikeMemberInGroup;
|
|
116
|
+
parseMuteArguments(session?: Session): Promise<MuteParseResult>;
|
|
117
|
+
private getMemoryFilePath;
|
|
118
|
+
private readMemoryFile;
|
|
119
|
+
private writeMemoryFile;
|
|
120
|
+
private extractMemoryBlocks;
|
|
121
|
+
private saveMemoryToFile;
|
|
122
|
+
private searchMemory;
|
|
123
|
+
private decoratePromptWithMemory;
|
|
124
|
+
private handleMemoryCommand;
|
|
125
|
+
private isImageSendableUrl;
|
|
126
|
+
describeImageMessage(session?: Session): {
|
|
127
|
+
hasCqImage: boolean;
|
|
128
|
+
rawCq: string[];
|
|
129
|
+
elementImages: any[];
|
|
130
|
+
extractableUrls: string[];
|
|
131
|
+
};
|
|
132
|
+
private logImageDebug;
|
|
133
|
+
private isPrivilegedUser;
|
|
134
|
+
private recordUnauthorizedMuteAttempt;
|
|
135
|
+
private isRegularMember;
|
|
136
|
+
shouldSelfGag(session?: Session, target?: string): Promise<boolean>;
|
|
137
|
+
selfGag(session: Session, reason?: string): Promise<ActionResult>;
|
|
138
|
+
punishUnauthorizedMuteAttempt(session?: Session, target?: string): Promise<ActionResult | null>;
|
|
139
|
+
private toGroupId;
|
|
140
|
+
private getOneBotApi;
|
|
141
|
+
private extractTextForFilter;
|
|
142
|
+
private hasCardMessage;
|
|
143
|
+
private hasForwardMessage;
|
|
144
|
+
private normalizeGuildId;
|
|
145
|
+
private resolveModerationPolicy;
|
|
146
|
+
private detectViolation;
|
|
147
|
+
private deleteMessage;
|
|
148
|
+
private shouldExemptViolationPunish;
|
|
149
|
+
private recordViolation;
|
|
150
|
+
private clearViolationRecord;
|
|
151
|
+
private autoModerationPunish;
|
|
152
|
+
private handleGroupModeration;
|
|
153
|
+
private cleanupPendingJoinRequests;
|
|
154
|
+
private generateJoinRequestCode;
|
|
155
|
+
private parseJoinRequestReviewText;
|
|
156
|
+
private handleJoinRequestReviewMessage;
|
|
157
|
+
private handleGuildMemberRequest;
|
|
158
|
+
reviewJoinRequestDecision(session: Session, code: string, approve: boolean, reason?: string): Promise<ActionResult>;
|
|
159
|
+
formatTargetDisplay(session: Session | undefined, targetId?: string, rawTarget?: string): Promise<string>;
|
|
160
|
+
private getTargetRole;
|
|
161
|
+
private createDryRunResult;
|
|
162
|
+
planDemoAction(groupId: string, reason?: string): Promise<ActionResult>;
|
|
163
|
+
kick(session: Session, target: string, rejectAddRequest?: boolean, reason?: string): Promise<ActionResult>;
|
|
164
|
+
mute(session: Session, target: string, minutes: number, reason?: string): Promise<ActionResult>;
|
|
165
|
+
unmute(session: Session, target: string, reason?: string): Promise<ActionResult>;
|
|
166
|
+
setAdmin(session: Session, target: string, enable: boolean, reason?: string): Promise<ActionResult>;
|
|
167
|
+
}
|