mirai-js 2.8.1 → 2.8.2
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/demo.ts +35 -5
- package/dist/node/Middleware.d.ts +1 -1
- package/package.json +1 -1
- package/src/Middleware.d.ts +1 -1
package/demo.ts
CHANGED
@@ -6,15 +6,45 @@ import { Bot, Message, Middleware } from './src';
|
|
6
6
|
const verifyKey = '123456789';
|
7
7
|
const qq = 3070539027;
|
8
8
|
const bot = new Bot();
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
9
19
|
bot.on('FriendMessage', new Middleware()
|
10
|
-
.messageProcessor(['AtAll', 'App'])
|
20
|
+
.messageProcessor(['AtAll', 'App'])
|
21
|
+
.textProcessor()
|
22
|
+
.done(ctx => {
|
23
|
+
ctx.
|
11
24
|
|
12
|
-
}).done((d) => {
|
13
|
-
d.
|
14
25
|
}));
|
15
|
-
bot.on('FriendMessage', d => {
|
16
26
|
|
17
|
-
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
bot.on('NewFriendRequestEvent', new Middleware()
|
44
|
+
.friendRequestProcessor()
|
45
|
+
.done(ctx => {
|
46
|
+
d
|
47
|
+
}))
|
18
48
|
// 在 mirai-console 登录你的 bot
|
19
49
|
|
20
50
|
} catch (err) {
|
@@ -26,7 +26,7 @@ export class Middleware<CTX = { [key: string]: any }> {
|
|
26
26
|
* message 数组为 value,置于 data.classified
|
27
27
|
* @param typeArr message 的类型,例如 Plain Image Voice
|
28
28
|
*/
|
29
|
-
messageProcessor<U extends MessageChainElementTypes[]>(typeArr: U): Middleware<CTX & {
|
29
|
+
messageProcessor<U extends MessageChainElementTypes[]>(typeArr: U): Middleware<CTX & { classified: { [type in ArrayToValuesUnion<U>]: any[] } }>;
|
30
30
|
|
31
31
|
/**
|
32
32
|
* @description 过滤出字符串类型的 message,并拼接在一起,置于 data.text
|
package/package.json
CHANGED
package/src/Middleware.d.ts
CHANGED
@@ -26,7 +26,7 @@ export class Middleware<CTX = { [key: string]: any }> {
|
|
26
26
|
* message 数组为 value,置于 data.classified
|
27
27
|
* @param typeArr message 的类型,例如 Plain Image Voice
|
28
28
|
*/
|
29
|
-
messageProcessor<U extends MessageChainElementTypes[]>(typeArr: U): Middleware<CTX & {
|
29
|
+
messageProcessor<U extends MessageChainElementTypes[]>(typeArr: U): Middleware<CTX & { classified: { [type in ArrayToValuesUnion<U>]: any[] } }>;
|
30
30
|
|
31
31
|
/**
|
32
32
|
* @description 过滤出字符串类型的 message,并拼接在一起,置于 data.text
|