@karinjs/adapter-qqbot 1.2.8 → 1.2.10
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/config/comment/config.json +3 -0
- package/config/config/config.yaml +53 -0
- package/lib/cli/pr.d.ts +2 -0
- package/lib/cli/pr.js +73 -0
- package/lib/core/adapter/adapter.d.ts +91 -0
- package/lib/core/adapter/adapter.js +144 -0
- package/lib/core/adapter/handler.d.ts +49 -0
- package/lib/core/adapter/handler.js +140 -0
- package/lib/core/adapter/markdown.d.ts +38 -0
- package/lib/core/adapter/markdown.js +220 -0
- package/lib/core/adapter/normal.d.ts +30 -0
- package/lib/core/adapter/normal.js +263 -0
- package/lib/core/api/index.d.ts +167 -0
- package/lib/core/api/index.js +180 -0
- package/lib/core/api/sign.d.ts +22 -0
- package/lib/core/api/sign.js +40 -0
- package/lib/core/api/types.d.ts +236 -0
- package/lib/core/event/conver.d.ts +10 -0
- package/lib/core/event/conver.js +57 -0
- package/lib/core/event/index.d.ts +9 -0
- package/lib/core/event/index.js +98 -0
- package/lib/core/event/message.d.ts +27 -0
- package/lib/core/event/message.js +95 -0
- package/lib/core/event/notice.d.ts +50 -0
- package/lib/core/event/notice.js +133 -0
- package/lib/{types/event.d.ts → core/event/types.d.ts} +255 -14
- package/lib/core/internal/axios.d.ts +25 -0
- package/lib/core/internal/axios.js +46 -0
- package/lib/core/internal/sign.d.ts +22 -0
- package/lib/core/internal/sign.js +40 -0
- package/lib/core/webhook/c2c.d.ts +2 -0
- package/lib/core/webhook/c2c.js +14 -0
- package/lib/core/webhook/http.d.ts +2 -0
- package/lib/core/webhook/http.js +35 -0
- package/lib/core/webhook/index.d.ts +17 -0
- package/lib/core/webhook/index.js +87 -0
- package/lib/core/webhook/ws.d.ts +2 -0
- package/lib/core/webhook/ws.js +79 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.js +5 -7
- package/lib/root.d.ts +5 -0
- package/lib/root.js +9 -0
- package/lib/types/config.d.ts +53 -0
- package/lib/utils/common.d.ts +75 -61
- package/lib/utils/common.js +190 -202
- package/lib/utils/config.d.ts +5 -130
- package/lib/utils/config.js +50 -172
- package/lib/utils/dir.d.ts +1 -5
- package/lib/utils/dir.js +1 -10
- package/lib/utils/index.d.ts +4 -3
- package/lib/utils/index.js +4 -3
- package/package.json +41 -23
- package/config/config.yaml +0 -69
- package/lib/core/api.d.ts +0 -166
- package/lib/core/api.js +0 -429
- package/lib/core/index.d.ts +0 -92
- package/lib/core/index.js +0 -343
- package/lib/core/intents.d.ts +0 -6
- package/lib/core/intents.js +0 -57
- package/lib/core/markdown.d.ts +0 -23
- package/lib/core/markdown.js +0 -265
- package/lib/types/index.d.ts +0 -3
- package/lib/types/index.js +0 -3
- package/lib/types/media.d.ts +0 -100
- package/lib/types/message.d.ts +0 -85
- /package/lib/{types/event.js → core/api/types.js} +0 -0
- /package/lib/{types/media.js → core/event/types.js} +0 -0
- /package/lib/types/{message.js → config.js} +0 -0
package/lib/core/markdown.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { common, common as Common } from '../utils/common.js';
|
|
3
|
-
import { handler, common as karinCommon, segment, } from 'node-karin';
|
|
4
|
-
/**
|
|
5
|
-
* 图文模板
|
|
6
|
-
*/
|
|
7
|
-
export async function markdownTemplate(Opt) {
|
|
8
|
-
const { bot, data, type, openid, message_id } = Opt;
|
|
9
|
-
/** 先对消息进行分类 */
|
|
10
|
-
const text = [];
|
|
11
|
-
const image = [];
|
|
12
|
-
/** 待发送列表 */
|
|
13
|
-
const send_list = [];
|
|
14
|
-
let seq = common.random(1, 999999);
|
|
15
|
-
let keyboard;
|
|
16
|
-
const params = [];
|
|
17
|
-
const markdown = [];
|
|
18
|
-
const list = [];
|
|
19
|
-
const buttons = [];
|
|
20
|
-
const imgs = [];
|
|
21
|
-
const result = {
|
|
22
|
-
message_id: '',
|
|
23
|
-
message_time: 0,
|
|
24
|
-
raw_data: [],
|
|
25
|
-
};
|
|
26
|
-
const textFn = async () => {
|
|
27
|
-
text.sort((a, b) => a.index - b.index);
|
|
28
|
-
const data = Common.getQQBotButton(text.map(v => v.data.text).join(''));
|
|
29
|
-
const val = type === "users" /* PathType.Friends */ ? Common.formatText(data.text, true) : Common.formatText(data.text);
|
|
30
|
-
/** 去除at全体 */
|
|
31
|
-
params.push({ key: bot.markdown.oldTemplate.textStartKey, values: [val] });
|
|
32
|
-
/** 按钮 */
|
|
33
|
-
buttons.push(...data.data);
|
|
34
|
-
};
|
|
35
|
-
const imageFn = async (i) => {
|
|
36
|
-
const { url, width, height } = await handler.call('qqbot.files', { file: i.data.file, type: 'image', name: '0.png' });
|
|
37
|
-
imgs.push({ index: i.index, url, width, height });
|
|
38
|
-
};
|
|
39
|
-
const mediaFn = async (file, type, name, FileType) => {
|
|
40
|
-
const { url } = await handler.call('qqbot.files', { file, type, name });
|
|
41
|
-
const { file_info } = await bot.super.uploadMedia(openid, type, url, FileType);
|
|
42
|
-
const opt = bot.super.buildMedia(file_info, message_id, ++seq);
|
|
43
|
-
const res = await bot.super.sendMessage(openid, type, opt);
|
|
44
|
-
result.raw_data.push(res);
|
|
45
|
-
};
|
|
46
|
-
await Promise.all(data.map(async (data, index) => {
|
|
47
|
-
switch (data.type) {
|
|
48
|
-
case 'text':
|
|
49
|
-
text.push({ index, data });
|
|
50
|
-
break;
|
|
51
|
-
case 'image':
|
|
52
|
-
image.push({ index, data });
|
|
53
|
-
break;
|
|
54
|
-
case 'at': {
|
|
55
|
-
if (type === "users" /* PathType.Friends */)
|
|
56
|
-
break;
|
|
57
|
-
text.push({ index, data: segment.text(`<qqbot-at-user id="${data.uid || data.uin}" />`) });
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
case 'record': {
|
|
61
|
-
const file = await common.voiceToSilk(data.file);
|
|
62
|
-
list.push(mediaFn(file, type, '0.silk', 3 /* FileType.Record */));
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case 'video': {
|
|
66
|
-
list.push(mediaFn(data.file, type, '0.mp4', 2 /* FileType.Video */));
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case 'file': {
|
|
70
|
-
/** 判断是不是一个本地路径 */
|
|
71
|
-
let ext = Date.now() + '';
|
|
72
|
-
if (path.isAbsolute(data.file))
|
|
73
|
-
ext = Date.now() + path.extname(data.file);
|
|
74
|
-
list.push(mediaFn(data.file, type, ext, 4 /* FileType.File */));
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
case 'button': {
|
|
78
|
-
buttons.push(data);
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case 'markdown': {
|
|
82
|
-
text.push({ index, data: { type: 'text', text: data.content } });
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case 'markdown_tpl': {
|
|
86
|
-
markdown.push({ index, custom_template_id: data.custom_template_id, params: data.params });
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
default:
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
}));
|
|
93
|
-
if (text.length || image.length) {
|
|
94
|
-
/** 处理文本 */
|
|
95
|
-
if (text.length)
|
|
96
|
-
list.push(textFn());
|
|
97
|
-
/** 处理图片 */
|
|
98
|
-
image.map(i => list.push(imageFn(i)));
|
|
99
|
-
await Promise.all(list);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
await Promise.all(list);
|
|
103
|
-
}
|
|
104
|
-
if (buttons.length) {
|
|
105
|
-
const rows = [];
|
|
106
|
-
buttons.forEach(v => {
|
|
107
|
-
const button = karinCommon.buttonToQQBot(v);
|
|
108
|
-
rows.push(...button);
|
|
109
|
-
});
|
|
110
|
-
keyboard = { content: { rows: [...rows] } };
|
|
111
|
-
}
|
|
112
|
-
if (markdown.length) {
|
|
113
|
-
markdown.sort((a, b) => a.index - b.index);
|
|
114
|
-
await Promise.all(markdown.map(async (v, index) => {
|
|
115
|
-
const opt = bot.super.buildTplMarkdown(v.custom_template_id, v.params, keyboard, message_id, ++seq);
|
|
116
|
-
send_list.push({ index: v.index, opt });
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
if (imgs.length) {
|
|
120
|
-
imgs.sort((a, b) => a.index - b.index);
|
|
121
|
-
/** 取第一个 */
|
|
122
|
-
const { url, width, height } = imgs[0];
|
|
123
|
-
params.push({ key: bot.markdown.oldTemplate.imgDescKey, values: [`img #${width}px #${height}px`] });
|
|
124
|
-
params.push({ key: bot.markdown.oldTemplate.imgUrlKey, values: [url] });
|
|
125
|
-
/** 去除第一个 */
|
|
126
|
-
imgs.shift();
|
|
127
|
-
send_list.push({ index: -1, opt: bot.super.buildTplMarkdown(bot.markdown.templateId, params, keyboard, message_id, ++seq) });
|
|
128
|
-
/** 剩下的构建为单独的md */
|
|
129
|
-
await Promise.all(imgs.map(async (img) => {
|
|
130
|
-
const { url, width, height } = img;
|
|
131
|
-
const params = [];
|
|
132
|
-
params.push({ key: bot.markdown.oldTemplate.imgDescKey, values: [`img #${width}px #${height}px`] });
|
|
133
|
-
params.push({ key: bot.markdown.oldTemplate.imgUrlKey, values: [url] });
|
|
134
|
-
send_list.push({ index: img.index, opt: bot.super.buildTplMarkdown(bot.markdown.templateId, params, keyboard, message_id, ++seq) });
|
|
135
|
-
}));
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
params.length && send_list.push({ index: -1, opt: bot.super.buildTplMarkdown(bot.markdown.templateId, params, keyboard, message_id, ++seq) });
|
|
139
|
-
}
|
|
140
|
-
/** 并发发送 */
|
|
141
|
-
await Promise.all(send_list.map(async (v, index) => {
|
|
142
|
-
index !== 0 && await new Promise(resolve => setTimeout(resolve, index * 100));
|
|
143
|
-
const res = await bot.super.sendMessage(openid, type, v.opt);
|
|
144
|
-
result.raw_data.push(res);
|
|
145
|
-
}));
|
|
146
|
-
result.message_id = result.raw_data[0].id;
|
|
147
|
-
result.message_time = result.raw_data[0].time;
|
|
148
|
-
return result;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* 原生markdown
|
|
152
|
-
*/
|
|
153
|
-
export async function markdownRaw(Opt) {
|
|
154
|
-
const { bot, data, type, openid, message_id } = Opt;
|
|
155
|
-
/** 待发送列表 */
|
|
156
|
-
const send_list = [];
|
|
157
|
-
let seq = common.random(1, 999999);
|
|
158
|
-
const list = [];
|
|
159
|
-
const result = {
|
|
160
|
-
message_id: '',
|
|
161
|
-
message_time: 0,
|
|
162
|
-
raw_data: [],
|
|
163
|
-
};
|
|
164
|
-
let keyboard;
|
|
165
|
-
const buttons = [];
|
|
166
|
-
const message = [];
|
|
167
|
-
const markdown_tpl = [];
|
|
168
|
-
const imageFn = async (index, data) => {
|
|
169
|
-
const { url, width, height } = await handler.call('qqbot.files', { file: data.file, type: 'image', name: '0.png' });
|
|
170
|
-
message.push({ index, data: `` });
|
|
171
|
-
};
|
|
172
|
-
/** 富媒体消息直接发送 无需和正常消息走 */
|
|
173
|
-
const mediaFn = async (file, type, name, FileType) => {
|
|
174
|
-
const { url } = await handler.call('qqbot.files', { file, type, name });
|
|
175
|
-
const { file_info } = await bot.super.uploadMedia(openid, type, url, FileType);
|
|
176
|
-
const opt = bot.super.buildMedia(file_info, message_id, ++seq);
|
|
177
|
-
const res = await bot.super.sendMessage(openid, type, opt);
|
|
178
|
-
result.raw_data.push(res);
|
|
179
|
-
};
|
|
180
|
-
await Promise.all(data.map(async (data, index) => {
|
|
181
|
-
switch (data.type) {
|
|
182
|
-
case 'text': {
|
|
183
|
-
/** 先提取掉url 随后放出按钮中 */
|
|
184
|
-
const res = Common.getQQBotButton(data.text);
|
|
185
|
-
buttons.push(...res.data);
|
|
186
|
-
const text = type === "users" /* PathType.Friends */ ? Common.formatText(res.text, true) : Common.formatText(res.text);
|
|
187
|
-
message.push({ index, data: text });
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
case 'image':
|
|
191
|
-
imageFn(index, data);
|
|
192
|
-
break;
|
|
193
|
-
case 'at': {
|
|
194
|
-
if (type === "users" /* PathType.Friends */)
|
|
195
|
-
break;
|
|
196
|
-
message.push({ index, data: `<qqbot-at-user id="${data.uid || data.uin}" />` });
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
case 'record': {
|
|
200
|
-
const file = await common.voiceToSilk(data.file);
|
|
201
|
-
list.push(mediaFn(file, type, '0.silk', 3 /* FileType.Record */));
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
case 'video': {
|
|
205
|
-
list.push(mediaFn(data.file, type, '0.mp4', 2 /* FileType.Video */));
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
case 'file': {
|
|
209
|
-
/** 判断是不是一个本地路径 */
|
|
210
|
-
let ext = Date.now() + '';
|
|
211
|
-
if (path.isAbsolute(data.file))
|
|
212
|
-
ext = Date.now() + path.extname(data.file);
|
|
213
|
-
list.push(mediaFn(data.file, type, ext, 4 /* FileType.File */));
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
case 'button': {
|
|
217
|
-
buttons.push(data);
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
case 'keyboard': {
|
|
221
|
-
buttons.push(data);
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
case 'markdown': {
|
|
225
|
-
message.push({ index, data: data.content });
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
// 原生下发模板多少有点问题...
|
|
229
|
-
case 'markdown_tpl': {
|
|
230
|
-
markdown_tpl.push({ index, data });
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
default:
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
}));
|
|
237
|
-
await Promise.all(list);
|
|
238
|
-
if (buttons.length) {
|
|
239
|
-
const rows = [];
|
|
240
|
-
buttons.forEach(v => {
|
|
241
|
-
const button = karinCommon.buttonToQQBot(v);
|
|
242
|
-
rows.push(...button);
|
|
243
|
-
});
|
|
244
|
-
keyboard = { content: { rows: [...rows] } };
|
|
245
|
-
}
|
|
246
|
-
if (markdown_tpl.length) {
|
|
247
|
-
await Promise.all(markdown_tpl.map(async (v, index) => {
|
|
248
|
-
const opt = bot.super.buildTplMarkdown(v.data.custom_template_id, v.data.params, keyboard, message_id, ++seq);
|
|
249
|
-
send_list.push({ index: v.index, opt });
|
|
250
|
-
}));
|
|
251
|
-
}
|
|
252
|
-
if (message.length) {
|
|
253
|
-
message.sort((a, b) => a.index - b.index);
|
|
254
|
-
send_list.push({ index: -1, opt: bot.super.buildRawMarkdown(message.map(v => v.data).join(''), keyboard, message_id, ++seq) });
|
|
255
|
-
}
|
|
256
|
-
/** 并发发送 */
|
|
257
|
-
await Promise.all(send_list.map(async (v, index) => {
|
|
258
|
-
index !== 0 && await new Promise(resolve => setTimeout(resolve, index * 100));
|
|
259
|
-
const res = await bot.super.sendMessage(openid, type, v.opt);
|
|
260
|
-
result.raw_data.push(res);
|
|
261
|
-
}));
|
|
262
|
-
result.message_id = result.raw_data[0].id;
|
|
263
|
-
result.message_time = result.raw_data[0].time;
|
|
264
|
-
return result;
|
|
265
|
-
}
|
package/lib/types/index.d.ts
DELETED
package/lib/types/index.js
DELETED
package/lib/types/media.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 需要注意 目前只有私聊可以收到file类型的消息
|
|
3
|
-
*/
|
|
4
|
-
export type Content_type = 'image/gif' | 'image/jpeg' | 'image/png' | 'file';
|
|
5
|
-
/**
|
|
6
|
-
* 富媒体文件类型
|
|
7
|
-
*/
|
|
8
|
-
export declare const enum FileType {
|
|
9
|
-
/**
|
|
10
|
-
* 图片
|
|
11
|
-
*/
|
|
12
|
-
Image = 1,
|
|
13
|
-
/**
|
|
14
|
-
* 视频
|
|
15
|
-
*/
|
|
16
|
-
Video = 2,
|
|
17
|
-
/**
|
|
18
|
-
* 语音
|
|
19
|
-
*/
|
|
20
|
-
Record = 3,
|
|
21
|
-
/**
|
|
22
|
-
* 文件
|
|
23
|
-
*/
|
|
24
|
-
File = 4
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* 富媒体基类
|
|
28
|
-
*/
|
|
29
|
-
export interface Attachment {
|
|
30
|
-
/**
|
|
31
|
-
* 类型
|
|
32
|
-
*/
|
|
33
|
-
content_type: Content_type;
|
|
34
|
-
/** 未知作用 */
|
|
35
|
-
content?: string;
|
|
36
|
-
/**
|
|
37
|
-
* 文件名
|
|
38
|
-
*/
|
|
39
|
-
filename: string;
|
|
40
|
-
/**
|
|
41
|
-
* 图片高度
|
|
42
|
-
*/
|
|
43
|
-
height?: number;
|
|
44
|
-
/**
|
|
45
|
-
* 图片宽度
|
|
46
|
-
*/
|
|
47
|
-
width?: number;
|
|
48
|
-
/**
|
|
49
|
-
* 文件大小
|
|
50
|
-
*/
|
|
51
|
-
size: number;
|
|
52
|
-
/**
|
|
53
|
-
* 文件url
|
|
54
|
-
*/
|
|
55
|
-
url: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* 富媒体消息结构
|
|
59
|
-
*/
|
|
60
|
-
export interface MediaType {
|
|
61
|
-
/** 文件信息 */
|
|
62
|
-
file_info: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* 上传富媒体文件请求参数
|
|
66
|
-
*/
|
|
67
|
-
export interface UploadMediaOptions {
|
|
68
|
-
/**
|
|
69
|
-
* 媒体的文件类型
|
|
70
|
-
* - 1. 图片 png/jpg
|
|
71
|
-
* - 2. 视频 mp4
|
|
72
|
-
* - 3. 语音 silk
|
|
73
|
-
* - 4. 文件
|
|
74
|
-
*/
|
|
75
|
-
file_type: FileType;
|
|
76
|
-
/**
|
|
77
|
-
* 媒体资源的URL
|
|
78
|
-
*/
|
|
79
|
-
url?: string;
|
|
80
|
-
/** 不带前缀的base64 */
|
|
81
|
-
file_data?: string;
|
|
82
|
-
/**
|
|
83
|
-
* 是否直接发送消息到目标端
|
|
84
|
-
* 如果设置为 true,将会消耗主动消息频次
|
|
85
|
-
*/
|
|
86
|
-
srv_send_msg: boolean;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* 上传富媒体文件返回数据
|
|
90
|
-
*/
|
|
91
|
-
export interface UploadMediaResponse {
|
|
92
|
-
/** 文件 ID */
|
|
93
|
-
file_uuid: string;
|
|
94
|
-
/** 文件信息,用于发消息接口的 media 字段使用 */
|
|
95
|
-
file_info: string;
|
|
96
|
-
/** 有效期,表示剩余多少秒到期,到期后 file_info 失效,当等于 0 时,表示可长期使用 */
|
|
97
|
-
ttl: number;
|
|
98
|
-
/** 发送消息的唯一ID,当srv_send_msg设置为true时返回 */
|
|
99
|
-
id?: string;
|
|
100
|
-
}
|
package/lib/types/message.d.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ArkType, KeyboardType, MarkdownType } from 'node-karin';
|
|
2
|
-
import { MediaType } from './media.js';
|
|
3
|
-
/**
|
|
4
|
-
* 请求路径类型
|
|
5
|
-
*/
|
|
6
|
-
export declare const enum PathType {
|
|
7
|
-
Groups = "groups",
|
|
8
|
-
Friends = "users"
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* 消息类型
|
|
12
|
-
*/
|
|
13
|
-
export declare const enum MessageType {
|
|
14
|
-
/**
|
|
15
|
-
* 文本消息
|
|
16
|
-
*/
|
|
17
|
-
Text = 0,
|
|
18
|
-
/**
|
|
19
|
-
* markdown消息
|
|
20
|
-
*/
|
|
21
|
-
Markdown = 2,
|
|
22
|
-
/**
|
|
23
|
-
* ark消息
|
|
24
|
-
*/
|
|
25
|
-
Ark = 3,
|
|
26
|
-
/**
|
|
27
|
-
* embed消息
|
|
28
|
-
*/
|
|
29
|
-
Embed = 4,
|
|
30
|
-
/**
|
|
31
|
-
* 富媒体消息
|
|
32
|
-
*/
|
|
33
|
-
Media = 7
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* v2接口枚举
|
|
37
|
-
*/
|
|
38
|
-
export declare const enum V2ApiType {
|
|
39
|
-
/**
|
|
40
|
-
* 发送消息
|
|
41
|
-
*/
|
|
42
|
-
Message = "messages",
|
|
43
|
-
/**
|
|
44
|
-
* 上传富媒体文件
|
|
45
|
-
*/
|
|
46
|
-
Files = "files"
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 被动消息ID类型
|
|
50
|
-
*/
|
|
51
|
-
export declare const enum IdType {
|
|
52
|
-
MsgID = "msg_id",
|
|
53
|
-
EventID = "event_id"
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* 被动消息Seq
|
|
57
|
-
*/
|
|
58
|
-
export declare const enum SeqType {
|
|
59
|
-
MsgSeq = "msg_seq"
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* 发送消息请求参数
|
|
63
|
-
*/
|
|
64
|
-
export interface SendMessageOptions {
|
|
65
|
-
/** 文本内容 没有传空格 */
|
|
66
|
-
content: string;
|
|
67
|
-
/** 消息类型 */
|
|
68
|
-
msg_type: MessageType;
|
|
69
|
-
/** markdown消息 */
|
|
70
|
-
markdown?: MarkdownType<boolean>;
|
|
71
|
-
/** keyboard按钮消息 */
|
|
72
|
-
keyboard?: KeyboardType<boolean>;
|
|
73
|
-
/** ark消息 */
|
|
74
|
-
ark?: ArkType;
|
|
75
|
-
/** 富媒体消息 */
|
|
76
|
-
media?: MediaType;
|
|
77
|
-
/** 【暂未支持】消息引用 */
|
|
78
|
-
message_reference?: object;
|
|
79
|
-
/** 平台方事件ID,可以用于被动消息发送 */
|
|
80
|
-
[IdType.EventID]?: string;
|
|
81
|
-
/** 平台方消息ID,可以用于被动消息发送 */
|
|
82
|
-
[IdType.MsgID]?: string;
|
|
83
|
-
/** 回复消息的序号 相同的 msg_id + msg_seq 重复发送会失败 */
|
|
84
|
-
[SeqType.MsgSeq]?: number;
|
|
85
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|