koishi-plugin-bind-bot 2.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.
- package/lib/export-utils.d.ts +49 -0
- package/lib/export-utils.js +305 -0
- package/lib/force-bind-utils.d.ts +40 -0
- package/lib/force-bind-utils.js +242 -0
- package/lib/handlers/base.handler.d.ts +61 -0
- package/lib/handlers/base.handler.js +22 -0
- package/lib/handlers/binding.handler.d.ts +45 -0
- package/lib/handlers/binding.handler.js +285 -0
- package/lib/handlers/buid.handler.d.ts +71 -0
- package/lib/handlers/buid.handler.js +694 -0
- package/lib/handlers/index.d.ts +6 -0
- package/lib/handlers/index.js +22 -0
- package/lib/handlers/mcid.handler.d.ts +101 -0
- package/lib/handlers/mcid.handler.js +1045 -0
- package/lib/handlers/tag.handler.d.ts +14 -0
- package/lib/handlers/tag.handler.js +382 -0
- package/lib/handlers/whitelist.handler.d.ts +84 -0
- package/lib/handlers/whitelist.handler.js +1011 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +2693 -0
- package/lib/managers/rcon-manager.d.ts +24 -0
- package/lib/managers/rcon-manager.js +308 -0
- package/lib/repositories/mcidbind.repository.d.ts +105 -0
- package/lib/repositories/mcidbind.repository.js +288 -0
- package/lib/repositories/schedule-mute.repository.d.ts +68 -0
- package/lib/repositories/schedule-mute.repository.js +175 -0
- package/lib/types/api.d.ts +135 -0
- package/lib/types/api.js +6 -0
- package/lib/types/common.d.ts +40 -0
- package/lib/types/common.js +6 -0
- package/lib/types/config.d.ts +55 -0
- package/lib/types/config.js +6 -0
- package/lib/types/database.d.ts +47 -0
- package/lib/types/database.js +6 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/index.js +28 -0
- package/lib/utils/helpers.d.ts +76 -0
- package/lib/utils/helpers.js +275 -0
- package/lib/utils/logger.d.ts +75 -0
- package/lib/utils/logger.js +134 -0
- package/lib/utils/message-utils.d.ts +46 -0
- package/lib/utils/message-utils.js +234 -0
- package/lib/utils/rate-limiter.d.ts +26 -0
- package/lib/utils/rate-limiter.js +47 -0
- package/lib/utils/session-manager.d.ts +70 -0
- package/lib/utils/session-manager.js +120 -0
- package/package.json +39 -0
- package/readme.md +281 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./base.handler"), exports);
|
|
18
|
+
__exportStar(require("./tag.handler"), exports);
|
|
19
|
+
__exportStar(require("./binding.handler"), exports);
|
|
20
|
+
__exportStar(require("./whitelist.handler"), exports);
|
|
21
|
+
__exportStar(require("./buid.handler"), exports);
|
|
22
|
+
__exportStar(require("./mcid.handler"), exports);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Context, Session } from 'koishi';
|
|
2
|
+
import { LoggerService } from '../utils/logger';
|
|
3
|
+
import { GroupExporter } from '../export-utils';
|
|
4
|
+
import type { Config, ServerConfig, MCIDBIND, MojangProfile } from '../types';
|
|
5
|
+
interface McidHandlerDeps {
|
|
6
|
+
config: Config;
|
|
7
|
+
logger: LoggerService;
|
|
8
|
+
mcidbindRepo: any;
|
|
9
|
+
groupExporter: GroupExporter;
|
|
10
|
+
normalizeQQId: (userId: string) => string;
|
|
11
|
+
formatCommand: (cmd: string) => string;
|
|
12
|
+
formatUuid: (uuid: string) => string;
|
|
13
|
+
checkCooldown: (lastModified: Date) => boolean;
|
|
14
|
+
getCrafatarUrl: (uuid: string) => string | null;
|
|
15
|
+
getStarlightSkinUrl: (username: string) => string | null;
|
|
16
|
+
getMcBindByQQId: (qqId: string) => Promise<MCIDBIND | null>;
|
|
17
|
+
getMcBindByUsername: (username: string) => Promise<MCIDBIND | null>;
|
|
18
|
+
createOrUpdateMcBind: (userId: string, username: string, uuid: string, isAdmin?: boolean) => Promise<boolean>;
|
|
19
|
+
deleteMcBind: (userId: string) => Promise<boolean>;
|
|
20
|
+
checkUsernameExists: (username: string, currentUserId?: string) => Promise<boolean>;
|
|
21
|
+
checkAndUpdateUsername: (bind: MCIDBIND) => Promise<MCIDBIND>;
|
|
22
|
+
validateUsername: (username: string) => Promise<MojangProfile | null>;
|
|
23
|
+
validateBUID: (uid: string) => Promise<any>;
|
|
24
|
+
updateBuidInfoOnly: (qqId: string, buidUser: any) => Promise<boolean>;
|
|
25
|
+
isAdmin: (userId: string) => Promise<boolean>;
|
|
26
|
+
isMaster: (userId: string) => boolean;
|
|
27
|
+
sendMessage: (session: Session, content: any[]) => Promise<void>;
|
|
28
|
+
autoSetGroupNickname: (session: Session, mcName: string | null, buidUsername: string, targetUserId?: string, specifiedGroupId?: string) => Promise<void>;
|
|
29
|
+
checkNicknameFormat: (nickname: string, buidUsername: string, mcName: string | null) => boolean;
|
|
30
|
+
removeBindingSession: (userId: string, channelId: string) => void;
|
|
31
|
+
getServerConfigById: (serverId: string) => ServerConfig | null;
|
|
32
|
+
getFriendlyErrorMessage: (error: any) => string;
|
|
33
|
+
}
|
|
34
|
+
export declare class McidCommandHandler {
|
|
35
|
+
private ctx;
|
|
36
|
+
private deps;
|
|
37
|
+
constructor(ctx: Context, deps: McidHandlerDeps);
|
|
38
|
+
/**
|
|
39
|
+
* 注册所有MCID命令
|
|
40
|
+
*/
|
|
41
|
+
registerCommands(cmd: any): void;
|
|
42
|
+
/**
|
|
43
|
+
* 查询MC账号
|
|
44
|
+
*/
|
|
45
|
+
private handleQuery;
|
|
46
|
+
/**
|
|
47
|
+
* 构建查询响应消息
|
|
48
|
+
*/
|
|
49
|
+
private buildQueryResponse;
|
|
50
|
+
/**
|
|
51
|
+
* 通过MC用户名查询QQ号
|
|
52
|
+
*/
|
|
53
|
+
private handleFindUser;
|
|
54
|
+
/**
|
|
55
|
+
* 绑定MC账号
|
|
56
|
+
*/
|
|
57
|
+
private handleBind;
|
|
58
|
+
private handleBindForOther;
|
|
59
|
+
private handleBindForSelf;
|
|
60
|
+
/**
|
|
61
|
+
* 修改MC账号
|
|
62
|
+
*/
|
|
63
|
+
private handleChange;
|
|
64
|
+
private handleChangeForOther;
|
|
65
|
+
private handleChangeForSelf;
|
|
66
|
+
/**
|
|
67
|
+
* 解绑MC账号
|
|
68
|
+
*/
|
|
69
|
+
private handleUnbind;
|
|
70
|
+
private handleUnbindForOther;
|
|
71
|
+
private handleUnbindForSelf;
|
|
72
|
+
/**
|
|
73
|
+
* 设置管理员
|
|
74
|
+
*/
|
|
75
|
+
private handleAdmin;
|
|
76
|
+
/**
|
|
77
|
+
* 撤销管理员
|
|
78
|
+
*/
|
|
79
|
+
private handleUnadmin;
|
|
80
|
+
/**
|
|
81
|
+
* 列出所有管理员
|
|
82
|
+
*/
|
|
83
|
+
private handleAdminlist;
|
|
84
|
+
/**
|
|
85
|
+
* 查看统计
|
|
86
|
+
*/
|
|
87
|
+
private handleStats;
|
|
88
|
+
/**
|
|
89
|
+
* 修复群昵称
|
|
90
|
+
*/
|
|
91
|
+
private handleFixNicknames;
|
|
92
|
+
/**
|
|
93
|
+
* 清除提醒冷却
|
|
94
|
+
*/
|
|
95
|
+
private handleClearReminder;
|
|
96
|
+
/**
|
|
97
|
+
* 导出群数据
|
|
98
|
+
*/
|
|
99
|
+
private handleExport;
|
|
100
|
+
}
|
|
101
|
+
export {};
|