@zhin.js/adapter-kook 5.0.1 → 5.0.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/CHANGELOG.md +60 -0
- package/README.md +58 -451
- package/adapters/kook.ts +46 -0
- package/agent/tools/blacklist.ts +33 -0
- package/agent/tools/create_role.ts +25 -0
- package/agent/tools/delete_role.ts +21 -0
- package/agent/tools/grant_role.ts +22 -0
- package/agent/tools/list_roles.ts +27 -0
- package/agent/tools/revoke_role.ts +22 -0
- package/lib/endpoint.d.ts +80 -151
- package/lib/endpoint.js +260 -736
- package/lib/index.d.ts +6 -18
- package/lib/index.js +6 -350
- package/lib/kook-agent-deps.d.ts +29 -0
- package/lib/kook-agent-deps.js +30 -0
- package/lib/platform-permit.d.ts +12 -3
- package/lib/platform-permit.js +5 -3
- package/lib/protocol.d.ts +147 -0
- package/lib/protocol.js +279 -0
- package/lib/webhook.d.ts +15 -0
- package/lib/webhook.js +76 -0
- package/lib/ws.d.ts +42 -0
- package/lib/ws.js +63 -0
- package/package.json +47 -33
- package/plugin.ts +13 -0
- package/schema.json +55 -0
- package/src/endpoint.ts +287 -866
- package/src/index.ts +55 -331
- package/src/kook-agent-deps.ts +55 -0
- package/src/platform-permit.ts +13 -4
- package/src/protocol.ts +429 -0
- package/src/webhook.ts +116 -0
- package/src/ws.ts +120 -0
- package/client/Dashboard.tsx +0 -255
- package/client/index.tsx +0 -11
- package/client/tsconfig.json +0 -7
- package/client/utils/api.ts +0 -30
- package/dist/index.js +0 -31
- package/lib/adapter.d.ts +0 -30
- package/lib/adapter.d.ts.map +0 -1
- package/lib/adapter.js +0 -67
- package/lib/adapter.js.map +0 -1
- package/lib/endpoint.d.ts.map +0 -1
- package/lib/endpoint.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/kook-asset-upload.d.ts +0 -12
- package/lib/kook-asset-upload.d.ts.map +0 -1
- package/lib/kook-asset-upload.js +0 -46
- package/lib/kook-asset-upload.js.map +0 -1
- package/lib/kook-inbound.d.ts +0 -6
- package/lib/kook-inbound.d.ts.map +0 -1
- package/lib/kook-inbound.js +0 -22
- package/lib/kook-inbound.js.map +0 -1
- package/lib/kook-msg-route.d.ts +0 -34
- package/lib/kook-msg-route.d.ts.map +0 -1
- package/lib/kook-msg-route.js +0 -106
- package/lib/kook-msg-route.js.map +0 -1
- package/lib/kook-side-events.d.ts +0 -46
- package/lib/kook-side-events.d.ts.map +0 -1
- package/lib/kook-side-events.js +0 -189
- package/lib/kook-side-events.js.map +0 -1
- package/lib/outbound-keyboard.d.ts +0 -13
- package/lib/outbound-keyboard.d.ts.map +0 -1
- package/lib/outbound-keyboard.js +0 -63
- package/lib/outbound-keyboard.js.map +0 -1
- package/lib/outbound-media.d.ts +0 -10
- package/lib/outbound-media.d.ts.map +0 -1
- package/lib/outbound-media.js +0 -42
- package/lib/outbound-media.js.map +0 -1
- package/lib/outbound-sendable.d.ts +0 -12
- package/lib/outbound-sendable.d.ts.map +0 -1
- package/lib/outbound-sendable.js +0 -64
- package/lib/outbound-sendable.js.map +0 -1
- package/lib/platform-permit.d.ts.map +0 -1
- package/lib/platform-permit.js.map +0 -1
- package/lib/segment-mapper.d.ts +0 -2
- package/lib/segment-mapper.d.ts.map +0 -1
- package/lib/segment-mapper.js +0 -2
- package/lib/segment-mapper.js.map +0 -1
- package/lib/types.d.ts +0 -54
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -8
- package/lib/types.js.map +0 -1
- package/plugin.yml +0 -3
- package/src/adapter.ts +0 -76
- package/src/kook-asset-upload.ts +0 -55
- package/src/kook-inbound.ts +0 -22
- package/src/kook-msg-route.ts +0 -122
- package/src/kook-side-events.ts +0 -250
- package/src/outbound-keyboard.ts +0 -78
- package/src/outbound-media.ts +0 -67
- package/src/outbound-sendable.ts +0 -73
- package/src/segment-mapper.ts +0 -1
- package/src/types.ts +0 -59
- /package/{skills/kook → agent}/PERMITS.md +0 -0
- /package/{skills/kook/SKILL.md → agent/skills/kook.md} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
+
import { getKookAgentDeps } from '../../src/kook-agent-deps.js';
|
|
5
|
+
|
|
6
|
+
export default defineAgentTool<{ endpoint_id: string; guild_id: string; action: 'add' | 'remove'; user_id: string; remark?: string }>({
|
|
7
|
+
description: 'KOOK 服务器黑名单管理:添加/移除',
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
|
+
guild_id: z.string().describe('服务器 ID'),
|
|
11
|
+
action: z.enum(['add', 'remove']).describe('add|remove'),
|
|
12
|
+
user_id: z.string().describe('用户 ID'),
|
|
13
|
+
remark: z.string().optional().describe('备注(add 可选)'),
|
|
14
|
+
}),
|
|
15
|
+
platforms: ['kook'],
|
|
16
|
+
tags: ['kook'],
|
|
17
|
+
permissions: [platformPermit('guild_admin')],
|
|
18
|
+
async execute({ endpoint_id, guild_id, action, user_id, remark }: { endpoint_id: string; guild_id: string; action: 'add' | 'remove'; user_id: string; remark?: string }) {
|
|
19
|
+
const endpoint = getKookAgentDeps().getEndpoint(endpoint_id);
|
|
20
|
+
switch (action) {
|
|
21
|
+
case 'add': {
|
|
22
|
+
const success = await endpoint.addToBlacklist(guild_id, user_id, remark);
|
|
23
|
+
return { success, message: success ? `已将 ${user_id} 加入黑名单` : '操作失败' };
|
|
24
|
+
}
|
|
25
|
+
case 'remove': {
|
|
26
|
+
const success = await endpoint.removeFromBlacklist(guild_id, user_id);
|
|
27
|
+
return { success, message: success ? `已将 ${user_id} 从黑名单移除` : '操作失败' };
|
|
28
|
+
}
|
|
29
|
+
default:
|
|
30
|
+
return { success: false, message: `未知操作: ${action}` };
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
+
import { getKookAgentDeps } from '../../src/kook-agent-deps.js';
|
|
5
|
+
|
|
6
|
+
export default defineAgentTool<{ endpoint_id: string; guild_id: string; name: string }>({
|
|
7
|
+
description: '在 KOOK 服务器中创建新角色',
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
|
+
guild_id: z.string().describe('服务器 ID'),
|
|
11
|
+
name: z.string().describe('角色名称'),
|
|
12
|
+
}),
|
|
13
|
+
platforms: ['kook'],
|
|
14
|
+
tags: ['kook'],
|
|
15
|
+
permissions: [platformPermit('guild_owner')],
|
|
16
|
+
async execute({ endpoint_id, guild_id, name }: { endpoint_id: string; guild_id: string; name: string }) {
|
|
17
|
+
const endpoint = getKookAgentDeps().getEndpoint(endpoint_id);
|
|
18
|
+
const role = await endpoint.createRole(guild_id, name);
|
|
19
|
+
return {
|
|
20
|
+
success: true,
|
|
21
|
+
message: `已创建角色 "${name}"`,
|
|
22
|
+
role: { id: role.role_id, name: role.name },
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
+
import { getKookAgentDeps } from '../../src/kook-agent-deps.js';
|
|
5
|
+
|
|
6
|
+
export default defineAgentTool<{ endpoint_id: string; guild_id: string; role_id: string }>({
|
|
7
|
+
description: '删除 KOOK 服务器中的角色',
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
|
+
guild_id: z.string().describe('服务器 ID'),
|
|
11
|
+
role_id: z.string().describe('角色 ID'),
|
|
12
|
+
}),
|
|
13
|
+
platforms: ['kook'],
|
|
14
|
+
tags: ['kook'],
|
|
15
|
+
permissions: [platformPermit('guild_owner')],
|
|
16
|
+
async execute({ endpoint_id, guild_id, role_id }: { endpoint_id: string; guild_id: string; role_id: string }) {
|
|
17
|
+
const endpoint = getKookAgentDeps().getEndpoint(endpoint_id);
|
|
18
|
+
const success = await endpoint.deleteRole(guild_id, role_id);
|
|
19
|
+
return { success, message: success ? `已删除角色 ${role_id}` : '删除角色失败' };
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
+
import { getKookAgentDeps } from '../../src/kook-agent-deps.js';
|
|
5
|
+
|
|
6
|
+
export default defineAgentTool<{ endpoint_id: string; guild_id: string; user_id: string; role_id: string }>({
|
|
7
|
+
description: '给用户授予 KOOK 服务器角色',
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
|
+
guild_id: z.string().describe('服务器 ID'),
|
|
11
|
+
user_id: z.string().describe('用户 ID'),
|
|
12
|
+
role_id: z.string().describe('角色 ID'),
|
|
13
|
+
}),
|
|
14
|
+
platforms: ['kook'],
|
|
15
|
+
tags: ['kook'],
|
|
16
|
+
permissions: [platformPermit('manage_roles')],
|
|
17
|
+
async execute({ endpoint_id, guild_id, user_id, role_id }: { endpoint_id: string; guild_id: string; user_id: string; role_id: string }) {
|
|
18
|
+
const endpoint = getKookAgentDeps().getEndpoint(endpoint_id);
|
|
19
|
+
const success = await endpoint.grantRole(guild_id, user_id, role_id);
|
|
20
|
+
return { success, message: success ? `已授予用户 ${user_id} 角色 ${role_id}` : '授予角色失败' };
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getKookAgentDeps } from '../../src/kook-agent-deps.js';
|
|
4
|
+
|
|
5
|
+
export default defineAgentTool<{ endpoint_id: string; guild_id: string }>({
|
|
6
|
+
description: '获取 KOOK 服务器的角色列表',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
9
|
+
guild_id: z.string().describe('服务器 ID'),
|
|
10
|
+
}),
|
|
11
|
+
platforms: ['kook'],
|
|
12
|
+
tags: ['kook'],
|
|
13
|
+
async execute({ endpoint_id, guild_id }: { endpoint_id: string; guild_id: string }) {
|
|
14
|
+
const endpoint = getKookAgentDeps().getEndpoint(endpoint_id);
|
|
15
|
+
const roles = await endpoint.getRoleList(guild_id);
|
|
16
|
+
return {
|
|
17
|
+
roles: roles.map((r) => ({
|
|
18
|
+
id: String(r.role_id),
|
|
19
|
+
name: r.name,
|
|
20
|
+
color: r.color,
|
|
21
|
+
position: r.position,
|
|
22
|
+
permissions: r.permissions,
|
|
23
|
+
})),
|
|
24
|
+
count: roles.length,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
+
import { getKookAgentDeps } from '../../src/kook-agent-deps.js';
|
|
5
|
+
|
|
6
|
+
export default defineAgentTool<{ endpoint_id: string; guild_id: string; user_id: string; role_id: string }>({
|
|
7
|
+
description: '撤销用户的 KOOK 服务器角色',
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
|
+
guild_id: z.string().describe('服务器 ID'),
|
|
11
|
+
user_id: z.string().describe('用户 ID'),
|
|
12
|
+
role_id: z.string().describe('角色 ID'),
|
|
13
|
+
}),
|
|
14
|
+
platforms: ['kook'],
|
|
15
|
+
tags: ['kook'],
|
|
16
|
+
permissions: [platformPermit('manage_roles')],
|
|
17
|
+
async execute({ endpoint_id, guild_id, user_id, role_id }: { endpoint_id: string; guild_id: string; user_id: string; role_id: string }) {
|
|
18
|
+
const endpoint = getKookAgentDeps().getEndpoint(endpoint_id);
|
|
19
|
+
const success = await endpoint.revokeRole(guild_id, user_id, role_id);
|
|
20
|
+
return { success, message: success ? `已撤销用户 ${user_id} 的角色 ${role_id}` : '撤销角色失败' };
|
|
21
|
+
},
|
|
22
|
+
});
|
package/lib/endpoint.d.ts
CHANGED
|
@@ -1,155 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
private getSenderInfo;
|
|
40
|
-
/**
|
|
41
|
-
* 踢出用户
|
|
42
|
-
* @param guildId 服务器ID
|
|
43
|
-
* @param userId 用户ID
|
|
44
|
-
*/
|
|
45
|
-
kickUser(guildId: string, userId: string): Promise<boolean>;
|
|
46
|
-
/**
|
|
47
|
-
* 将用户加入黑名单
|
|
48
|
-
* @param guildId 服务器ID
|
|
49
|
-
* @param userId 用户ID
|
|
50
|
-
* @param remark 备注
|
|
51
|
-
* @param delMsgDays 删除消息天数(0-7)
|
|
52
|
-
*/
|
|
53
|
-
addToBlacklist(guildId: string, userId: string, remark?: string, delMsgDays?: number): Promise<boolean>;
|
|
54
|
-
/**
|
|
55
|
-
* 将用户从黑名单移除
|
|
56
|
-
* @param guildId 服务器ID
|
|
57
|
-
* @param userId 用户ID
|
|
58
|
-
*/
|
|
59
|
-
removeFromBlacklist(guildId: string, userId: string): Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* 给用户授予角色
|
|
62
|
-
* @param guildId 服务器ID
|
|
63
|
-
* @param userId 用户ID
|
|
64
|
-
* @param roleId 角色ID
|
|
65
|
-
*/
|
|
1
|
+
import type { EndpointInstance } from '@zhin.js/adapter';
|
|
2
|
+
import type { MessageGateway } from '@zhin.js/core/runtime';
|
|
3
|
+
import type { HttpHost } from '@zhin.js/host-http';
|
|
4
|
+
import type { CapabilityId } from '@zhin.js/plugin-runtime';
|
|
5
|
+
import { type KookInboundMessage, type ResolvedKookWebhookConfig, type ResolvedKookWebsocketConfig } from './protocol.js';
|
|
6
|
+
import { type CreateKookClient } from './ws.js';
|
|
7
|
+
export interface KookEndpointOptions {
|
|
8
|
+
readonly id: CapabilityId;
|
|
9
|
+
readonly gateway: MessageGateway;
|
|
10
|
+
readonly config: ResolvedKookWebsocketConfig;
|
|
11
|
+
readonly createClient?: CreateKookClient;
|
|
12
|
+
}
|
|
13
|
+
export declare class KookWebsocketEndpoint implements EndpointInstance {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(options: KookEndpointOptions);
|
|
16
|
+
start(): Promise<void>;
|
|
17
|
+
open(): void;
|
|
18
|
+
close(): void;
|
|
19
|
+
stop(): Promise<void>;
|
|
20
|
+
send({ target, payload }: {
|
|
21
|
+
readonly target: string;
|
|
22
|
+
readonly payload: unknown;
|
|
23
|
+
}): Promise<string>;
|
|
24
|
+
/** Test / internal: admit a message when open. */
|
|
25
|
+
admit(msg: KookInboundMessage): void;
|
|
26
|
+
getRoleList(guildId: string): Promise<{
|
|
27
|
+
role_id: string | number;
|
|
28
|
+
name: string;
|
|
29
|
+
color?: number;
|
|
30
|
+
position?: number;
|
|
31
|
+
permissions?: unknown;
|
|
32
|
+
}[]>;
|
|
33
|
+
createRole(guildId: string, name: string): Promise<{
|
|
34
|
+
role_id: string | number;
|
|
35
|
+
name: string;
|
|
36
|
+
}>;
|
|
37
|
+
deleteRole(guildId: string, roleId: string): Promise<boolean>;
|
|
66
38
|
grantRole(guildId: string, userId: string, roleId: string): Promise<boolean>;
|
|
67
|
-
/**
|
|
68
|
-
* 撤销用户角色
|
|
69
|
-
* @param guildId 服务器ID
|
|
70
|
-
* @param userId 用户ID
|
|
71
|
-
* @param roleId 角色ID
|
|
72
|
-
*/
|
|
73
39
|
revokeRole(guildId: string, userId: string, roleId: string): Promise<boolean>;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* 获取服务器成员列表
|
|
100
|
-
* @param guildId 服务器ID
|
|
101
|
-
* @param channelId 可选的频道ID
|
|
102
|
-
*/
|
|
103
|
-
getGuildMembers(guildId: string, channelId?: string): Promise<User.Info[]>;
|
|
104
|
-
private buildAtElement;
|
|
105
|
-
private resolveAtUserId;
|
|
106
|
-
private parseMarkdown;
|
|
107
|
-
/**
|
|
108
|
-
* 将 kook-client 的 MessageSegment[] 转换为 Zhin 的 MessageElement[]
|
|
109
|
-
*/
|
|
110
|
-
private parseMessageContent;
|
|
111
|
-
/**
|
|
112
|
-
* 检查文本是否包含 KMarkdown 特殊语法
|
|
113
|
-
*/
|
|
114
|
-
private hasKMarkdownSyntax;
|
|
115
|
-
/**
|
|
116
|
-
* 连接到 KOOK
|
|
117
|
-
*/
|
|
118
|
-
$connect(): Promise<void>;
|
|
119
|
-
/**
|
|
120
|
-
* 断开连接
|
|
121
|
-
*/
|
|
122
|
-
$disconnect(): Promise<void>;
|
|
123
|
-
/**
|
|
124
|
-
* 上传媒体(覆盖 kook-client:其 FormData.append 不接受 Node Buffer)
|
|
125
|
-
*/
|
|
126
|
-
uploadMedia(data: string | Buffer): Promise<string>;
|
|
127
|
-
/**
|
|
128
|
-
* 发送消息
|
|
129
|
-
*/
|
|
130
|
-
$sendMessage(options: SendOptions): Promise<string>;
|
|
131
|
-
/**
|
|
132
|
-
* 撤回消息。支持 `kook:channel:msgId` 出站 ref,或入站 plain msgId + route/sceneType 提示。
|
|
133
|
-
*/
|
|
134
|
-
$recallMessage(messageIdOrRef: string, hint?: {
|
|
135
|
-
route?: KookMsgRoute;
|
|
136
|
-
sceneType?: 'private' | 'group' | 'channel';
|
|
137
|
-
}): Promise<void>;
|
|
138
|
-
private deleteKookMsg;
|
|
139
|
-
/**
|
|
140
|
-
* 为消息添加表情回应(TypingIndicator reaction 模式)
|
|
141
|
-
* @returns reactionId(含 channel/direct 路由),供 $removeReaction 使用
|
|
142
|
-
*/
|
|
143
|
-
$addReaction(messageId: string, emoji: string, hint?: {
|
|
144
|
-
sceneType?: 'private' | 'group' | 'channel';
|
|
40
|
+
addToBlacklist(guildId: string, userId: string, remark?: string): Promise<boolean>;
|
|
41
|
+
removeFromBlacklist(guildId: string, userId: string): Promise<boolean>;
|
|
42
|
+
}
|
|
43
|
+
export interface KookWebhookEndpointOptions {
|
|
44
|
+
readonly id: CapabilityId;
|
|
45
|
+
readonly gateway: MessageGateway;
|
|
46
|
+
readonly http: HttpHost;
|
|
47
|
+
readonly config: ResolvedKookWebhookConfig;
|
|
48
|
+
readonly createClient?: CreateKookClient;
|
|
49
|
+
}
|
|
50
|
+
export declare class KookWebhookEndpoint implements EndpointInstance {
|
|
51
|
+
#private;
|
|
52
|
+
constructor(options: KookWebhookEndpointOptions);
|
|
53
|
+
/** Used by webhook handler. */
|
|
54
|
+
get isOpen(): boolean;
|
|
55
|
+
get config(): ResolvedKookWebhookConfig;
|
|
56
|
+
get selfId(): string | undefined;
|
|
57
|
+
start(): Promise<void>;
|
|
58
|
+
open(): void;
|
|
59
|
+
close(): void;
|
|
60
|
+
stop(): Promise<void>;
|
|
61
|
+
send({ target, payload }: {
|
|
62
|
+
readonly target: string;
|
|
63
|
+
readonly payload: unknown;
|
|
145
64
|
}): Promise<string>;
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
65
|
+
/** Test / internal: admit a message when open. */
|
|
66
|
+
admit(msg: KookInboundMessage): void;
|
|
67
|
+
checkAndRememberSn(sn: number): boolean;
|
|
68
|
+
getRoleList(guildId: string): Promise<{
|
|
69
|
+
role_id: string | number;
|
|
70
|
+
name: string;
|
|
71
|
+
color?: number;
|
|
72
|
+
position?: number;
|
|
73
|
+
permissions?: unknown;
|
|
74
|
+
}[]>;
|
|
75
|
+
createRole(guildId: string, name: string): Promise<{
|
|
76
|
+
role_id: string | number;
|
|
77
|
+
name: string;
|
|
78
|
+
}>;
|
|
79
|
+
deleteRole(guildId: string, roleId: string): Promise<boolean>;
|
|
80
|
+
grantRole(guildId: string, userId: string, roleId: string): Promise<boolean>;
|
|
81
|
+
revokeRole(guildId: string, userId: string, roleId: string): Promise<boolean>;
|
|
82
|
+
addToBlacklist(guildId: string, userId: string, remark?: string): Promise<boolean>;
|
|
83
|
+
removeFromBlacklist(guildId: string, userId: string): Promise<boolean>;
|
|
154
84
|
}
|
|
155
|
-
//# sourceMappingURL=endpoint.d.ts.map
|