alemonjs 2.1.8 → 2.1.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/lib/app/define-response.d.ts +3 -1
- package/lib/app/define-response.js +2 -1
- package/lib/cbp/connects/client.js +0 -5
- package/lib/cbp/connects/platform.js +0 -5
- package/lib/types/event/channel/index.d.ts +10 -0
- package/lib/types/event/channel/index.js +1 -0
- package/lib/types/event/map.d.ts +3 -3
- package/lib/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { DefineResponseFunc } from '../types';
|
|
2
|
-
export declare const lazy:
|
|
2
|
+
export declare const lazy: <T extends {
|
|
3
|
+
default: any;
|
|
4
|
+
}>(fnc: () => Promise<T>) => (() => Promise<T["default"]>);
|
|
3
5
|
export declare const defineResponse: DefineResponseFunc;
|
|
@@ -64,11 +64,6 @@ const cbpClient = (url, options = {}) => {
|
|
|
64
64
|
global.chatbotClient.on('message', message => {
|
|
65
65
|
try {
|
|
66
66
|
const parsedMessage = flattedJSON.parse(message.toString());
|
|
67
|
-
logger.debug({
|
|
68
|
-
code: ResultCode.Ok,
|
|
69
|
-
message: '客户端接收到消息',
|
|
70
|
-
data: parsedMessage
|
|
71
|
-
});
|
|
72
67
|
if (parsedMessage?.activeId) {
|
|
73
68
|
if (parsedMessage.active === 'sync') {
|
|
74
69
|
const configs = parsedMessage.payload;
|
|
@@ -86,11 +86,6 @@ const cbpPlatform = (url, options = {
|
|
|
86
86
|
global.chatbotPlatform.on('message', message => {
|
|
87
87
|
try {
|
|
88
88
|
const data = flattedJSON.parse(message.toString());
|
|
89
|
-
logger.debug({
|
|
90
|
-
code: ResultCode.Ok,
|
|
91
|
-
message: '平台端接收消息',
|
|
92
|
-
data: data
|
|
93
|
-
});
|
|
94
89
|
if (data.apiId) {
|
|
95
90
|
for (const cb of apiReplys) {
|
|
96
91
|
void cb(data, val => replyApi(data, val));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Guild, Channel } from '../base/guild';
|
|
2
|
+
import { platform } from '../base/platform';
|
|
3
|
+
import { Message } from '../base/message';
|
|
4
|
+
import { Expansion } from '../base/expansion';
|
|
5
|
+
export type PublicEventChannelCreate = platform & Guild & Channel & Message & {
|
|
6
|
+
name: 'channel.create';
|
|
7
|
+
} & Expansion;
|
|
8
|
+
export type PublicEventChannelDelete = platform & Guild & Channel & Message & {
|
|
9
|
+
name: 'channel.delete';
|
|
10
|
+
} & Expansion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/lib/types/event/map.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicEventChannelCreate, PublicEventChannelDelete } from './channel';
|
|
2
2
|
import { PublicEventGuildExit, PublicEventGuildJoin } from './guild';
|
|
3
3
|
import { PrivateEventInteractionCreate, PublicEventInteractionCreate } from './interaction';
|
|
4
4
|
import { PublicEventMemberAdd, PublicEventMemberRemove } from './member';
|
|
@@ -18,8 +18,8 @@ export type Events = {
|
|
|
18
18
|
'message.delete': PublicEventMessageDelete;
|
|
19
19
|
'message.reaction.add': PublicEventMessageReactionAdd;
|
|
20
20
|
'message.reaction.remove': PublicEventMessageReactionRemove;
|
|
21
|
-
'channel.create':
|
|
22
|
-
'
|
|
21
|
+
'channel.create': PublicEventChannelCreate;
|
|
22
|
+
'channel.delete': PublicEventChannelDelete;
|
|
23
23
|
'guild.join': PublicEventGuildJoin;
|
|
24
24
|
'guild.exit': PublicEventGuildExit;
|
|
25
25
|
'member.add': PublicEventMemberAdd;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './event/base/guild';
|
|
|
4
4
|
export * from './event/base/message';
|
|
5
5
|
export * from './event/base/platform';
|
|
6
6
|
export * from './event/base/user';
|
|
7
|
-
export * from './event/
|
|
7
|
+
export * from './event/channel/index';
|
|
8
8
|
export * from './event/guild/index';
|
|
9
9
|
export * from './event/interaction/index';
|
|
10
10
|
export * from './event/member/index';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "alemonjs",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.10",
|
|
5
5
|
"description": "bot script",
|
|
6
6
|
"author": "lemonade",
|
|
7
7
|
"license": "MIT",
|
|
@@ -72,4 +72,4 @@
|
|
|
72
72
|
"type": "git",
|
|
73
73
|
"url": "https://github.com/lemonade-lab/alemonjs.git"
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|