alemonjs 1.1.40 → 1.2.0-rc.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/README.md +14 -0
- package/lib/api/index.js +8 -17
- package/lib/config/login.js +35 -36
- package/lib/core/index.js +5 -7
- package/lib/core/main.js +9 -5
- package/lib/core/{dev → processor}/alemon.js +184 -53
- package/lib/core/{dev → processor}/application.js +26 -45
- package/lib/core/processor/configs.js +67 -0
- package/lib/core/processor/help.js +37 -0
- package/lib/core/{dev → processor}/listdouble.js +31 -31
- package/lib/{log/index.js → core/processor/log.js} +2 -8
- package/lib/core/{dev → processor}/plugin.js +11 -8
- package/lib/core/{dev → processor}/subscribe.js +6 -19
- package/lib/core/types.js +24 -0
- package/lib/core/utils/buffer.js +1 -37
- package/lib/core/utils/counter.js +17 -0
- package/lib/core/utils/index.js +1 -1
- package/lib/core/utils/ip.js +6 -14
- package/lib/core/utils/puppeteer.js +15 -23
- package/lib/core/utils/utils.js +1 -12
- package/lib/define/main.js +33 -106
- package/lib/discord/alemon/bot.js +3 -8
- package/lib/discord/alemon/controller.js +20 -41
- package/lib/discord/alemon/conversation.js +6 -12
- package/lib/discord/alemon/message/CHANNEL_TOPIC_UPDATE.js +1 -4
- package/lib/discord/alemon/message/CHANNEL_UPDATE.js +1 -4
- package/lib/discord/alemon/message/GUILD_MEMBER_ADD.js +1 -4
- package/lib/discord/alemon/message/GUILD_MEMBER_REMOVE.js +1 -4
- package/lib/discord/alemon/message/GUILD_MEMBER_UPDATE.js +1 -4
- package/lib/discord/alemon/message/MESSAGE_CREATE.js +10 -29
- package/lib/discord/alemon/message/MESSAGE_DELETE.js +1 -4
- package/lib/discord/alemon/message/MESSAGE_REACTION_ADD.js +1 -4
- package/lib/discord/alemon/message/MESSAGE_UPDATE.js +1 -4
- package/lib/discord/alemon/message/PRESENCE_UPDATE.js +1 -4
- package/lib/discord/alemon/message/TYPING_START.js +1 -4
- package/lib/discord/alemon/message/VOICE_CHANNEL_STATUS_UPDATE.js +1 -4
- package/lib/discord/alemon/message/VOICE_STATE_UPDATE.js +1 -4
- package/lib/discord/alemon/reply.js +7 -8
- package/lib/discord/index.js +12 -14
- package/lib/discord/sdk/api.js +240 -47
- package/lib/discord/sdk/config.js +6 -21
- package/lib/discord/sdk/index.js +1 -1
- package/lib/discord/sdk/log.js +4 -4
- package/lib/discord/sdk/wss.js +155 -111
- package/lib/index.js +9 -9
- package/lib/koa/back.js +2 -2
- package/lib/koa/client.js +7 -7
- package/lib/koa/config.js +3 -21
- package/lib/koa/file.js +78 -75
- package/lib/koa/index.js +1 -1
- package/lib/kook/alemon/bot.js +3 -8
- package/lib/kook/alemon/controller.js +35 -49
- package/lib/kook/alemon/conversation.js +2 -3
- package/lib/kook/alemon/direct.js +30 -39
- package/lib/kook/alemon/message/DIRECT_MESSAGE.js +9 -22
- package/lib/kook/alemon/message/GUILD_MESSAGE_REACTIONS.js +8 -25
- package/lib/kook/alemon/message/PUBLIC_GUILD_MESSAGES.js +9 -26
- package/lib/kook/alemon/reply.js +9 -10
- package/lib/kook/index.js +21 -30
- package/lib/kook/sdk/api.js +297 -249
- package/lib/kook/sdk/config.js +3 -20
- package/lib/kook/sdk/index.js +1 -1
- package/lib/kook/sdk/log.js +11 -0
- package/lib/kook/sdk/ws.js +107 -128
- package/lib/{login.js → login/index.js} +5 -1
- package/lib/ntqq/alemon/bot.js +6 -0
- package/lib/ntqq/alemon/{group/controller.js → controller.js} +27 -42
- package/lib/ntqq/alemon/conversation.js +7 -8
- package/lib/ntqq/alemon/{group/direct.js → direct.js} +40 -59
- package/lib/ntqq/alemon/{group/message → message}/C2C_MESSAGE_CREATE.js +8 -21
- package/lib/ntqq/alemon/{group/message → message}/GROUP_AT_MESSAGE_CREATE.js +9 -22
- package/lib/ntqq/alemon/{group/reply.js → reply.js} +11 -18
- package/lib/ntqq/alemon/{group/segment.js → segment.js} +1 -1
- package/lib/ntqq/index.js +15 -21
- package/lib/ntqq/sdk/api.js +155 -0
- package/lib/ntqq/sdk/config.js +3 -21
- package/lib/ntqq/sdk/index.js +1 -1
- package/lib/ntqq/sdk/intents.js +1 -76
- package/lib/ntqq/sdk/log.js +4 -4
- package/lib/ntqq/sdk/wss.js +187 -169
- package/lib/qq/alemon/bot.js +3 -8
- package/lib/qq/alemon/controller.js +35 -104
- package/lib/qq/alemon/conversation.js +53 -139
- package/lib/qq/alemon/direct.js +29 -53
- package/lib/qq/alemon/message/AT_MESSAGE_CREATE.js +117 -0
- package/lib/qq/alemon/message/CHANNEL_CREATE.js +71 -0
- package/lib/qq/alemon/message/CHANNEL_DELETE.js +71 -0
- package/lib/qq/alemon/message/CHANNEL_UPDATE.js +71 -0
- package/lib/qq/alemon/message/DIRECT_MESSAGE_CREATE.js +57 -0
- package/lib/qq/alemon/message/DIRECT_MESSAGE_DELETE.js +57 -0
- package/lib/qq/alemon/message/GUILD_CREATE.js +71 -0
- package/lib/qq/alemon/message/GUILD_DELETE.js +71 -0
- package/lib/qq/alemon/message/GUILD_MEMBER_ADD.js +76 -0
- package/lib/qq/alemon/message/GUILD_MEMBER_REMOVE.js +76 -0
- package/lib/qq/alemon/message/GUILD_MEMBER_UPDATE.js +76 -0
- package/lib/qq/alemon/message/GUILD_UPDATE.js +71 -0
- package/lib/qq/alemon/message/{INTERACTION.js → INTERACTION_CREATE.js} +16 -40
- package/lib/qq/alemon/message/MESSAGE_CREATE.js +128 -0
- package/lib/qq/alemon/message/{GUILD_MESSAGES.js → MESSAGE_DELETE.js} +33 -57
- package/lib/qq/alemon/message/MESSAGE_REACTION_ADD.js +75 -0
- package/lib/qq/alemon/message/MESSAGE_REACTION_REMOVE.js +75 -0
- package/lib/qq/alemon/message/PUBLIC_MESSAGE_DELETE.js +69 -0
- package/lib/qq/alemon/reply.js +11 -20
- package/lib/qq/index.js +14 -43
- package/lib/qq/sdk/api.js +514 -73
- package/lib/qq/sdk/config.js +5 -21
- package/lib/qq/sdk/index.js +1 -1
- package/lib/qq/sdk/intents.js +1 -42
- package/lib/qq/sdk/log.js +4 -4
- package/lib/qq/sdk/typings.js +1 -1
- package/lib/qq/sdk/wss.js +135 -127
- package/lib/villa/alemon/controller.js +82 -199
- package/lib/villa/alemon/conversation.js +2 -0
- package/lib/villa/alemon/message/GUILD_BOT.js +5 -22
- package/lib/villa/alemon/message/GUILD_MEMBERS.js +5 -22
- package/lib/villa/alemon/message/GUILD_MESSAGE_REACTIONS.js +5 -22
- package/lib/villa/alemon/message/MESSAGES.js +5 -25
- package/lib/villa/alemon/message/MESSAGE_AUDIT.js +5 -22
- package/lib/villa/alemon/message/MESSAGE_BUTTON.js +5 -25
- package/lib/villa/alemon/reply.js +8 -15
- package/lib/villa/index.js +18 -20
- package/lib/villa/sdk/api.js +1119 -608
- package/lib/villa/sdk/config.js +3 -20
- package/lib/villa/sdk/index.js +1 -1
- package/lib/villa/sdk/log.js +4 -4
- package/lib/villa/sdk/wss.js +198 -159
- package/package.json +8 -13
- package/resources/index.html +28 -31
- package/types/api/index.d.ts +8 -17
- package/types/config/login.d.ts +17 -20
- package/types/config/types.d.ts +6 -6
- package/types/core/index.d.ts +5 -7
- package/types/core/main.d.ts +9 -5
- package/types/core/{dev → processor}/alemon.d.ts +44 -12
- package/types/core/{dev → processor}/application.d.ts +5 -5
- package/types/core/processor/configs.d.ts +76 -0
- package/types/core/processor/help.d.ts +16 -0
- package/types/core/{dev → processor}/listdouble.d.ts +1 -3
- package/types/core/processor/log.d.ts +7 -0
- package/types/core/{dev → processor}/plugin.d.ts +9 -5
- package/types/core/{dev → processor}/subscribe.d.ts +5 -12
- package/types/core/{plugin → processor}/types.d.ts +39 -2
- package/types/core/types.d.ts +162 -0
- package/types/core/typings.d.ts +5 -151
- package/types/core/utils/buffer.d.ts +0 -36
- package/types/{villa/sdk → core/utils}/counter.d.ts +3 -1
- package/types/core/utils/index.d.ts +1 -1
- package/types/core/utils/ip.d.ts +1 -9
- package/types/core/utils/puppeteer.d.ts +0 -8
- package/types/core/utils/utils.d.ts +1 -13
- package/types/default/types.d.ts +5 -5
- package/types/define/main.d.ts +0 -6
- package/types/define/types.d.ts +3 -15
- package/types/discord/alemon/bot.d.ts +3 -3
- package/types/discord/alemon/controller.d.ts +6 -93
- package/types/discord/index.d.ts +1 -1
- package/types/discord/sdk/api.d.ts +167 -25
- package/types/discord/sdk/config.d.ts +4 -12
- package/types/discord/sdk/index.d.ts +1 -1
- package/types/discord/sdk/wss.d.ts +39 -16
- package/types/index.d.ts +7 -7
- package/types/koa/config.d.ts +2 -10
- package/types/koa/file.d.ts +27 -23
- package/types/koa/index.d.ts +1 -1
- package/types/kook/alemon/bot.d.ts +3 -3
- package/types/kook/alemon/controller.d.ts +79 -64
- package/types/kook/alemon/direct.d.ts +106 -70
- package/types/kook/alemon/message/DIRECT_MESSAGE.d.ts +2 -1
- package/types/kook/alemon/message/PUBLIC_GUILD_MESSAGES.d.ts +2 -2
- package/types/kook/alemon/reply.d.ts +7 -1
- package/types/kook/index.d.ts +1 -1
- package/types/kook/sdk/api.d.ts +253 -247
- package/types/kook/sdk/config.d.ts +2 -12
- package/types/kook/sdk/index.d.ts +1 -1
- package/types/kook/sdk/log.d.ts +2 -0
- package/types/kook/sdk/ws.d.ts +28 -10
- package/types/{login.d.ts → login/index.d.ts} +2 -2
- package/types/ntqq/alemon/bot.d.ts +8 -0
- package/types/ntqq/alemon/controller.d.ts +45 -0
- package/types/ntqq/alemon/direct.d.ts +72 -0
- package/types/ntqq/alemon/{group/reply.d.ts → reply.d.ts} +4 -1
- package/types/ntqq/index.d.ts +1 -1
- package/types/ntqq/sdk/api.d.ts +120 -0
- package/types/ntqq/sdk/config.d.ts +2 -12
- package/types/ntqq/sdk/index.d.ts +1 -1
- package/types/ntqq/sdk/intents.d.ts +1 -8
- package/types/ntqq/sdk/wss.d.ts +54 -17
- package/types/qq/alemon/bot.d.ts +3 -3
- package/types/qq/alemon/controller.d.ts +13 -100
- package/types/qq/alemon/conversation.d.ts +1 -1
- package/types/qq/alemon/direct.d.ts +62 -71
- package/types/qq/alemon/message/AT_MESSAGE_CREATE.d.ts +40 -0
- package/types/qq/alemon/message/CHANNEL_CREATE.d.ts +20 -0
- package/types/qq/alemon/message/CHANNEL_DELETE.d.ts +20 -0
- package/types/qq/alemon/message/CHANNEL_UPDATE.d.ts +20 -0
- package/types/qq/alemon/message/DIRECT_MESSAGE_CREATE.d.ts +34 -0
- package/types/qq/alemon/message/DIRECT_MESSAGE_DELETE.d.ts +22 -0
- package/types/qq/alemon/message/GUILD_CREATE.d.ts +20 -0
- package/types/qq/alemon/message/GUILD_DELETE.d.ts +20 -0
- package/types/qq/alemon/message/GUILD_MEMBER_ADD.d.ts +19 -0
- package/types/qq/alemon/message/GUILD_MEMBER_REMOVE.d.ts +19 -0
- package/types/qq/alemon/message/GUILD_MEMBER_UPDATE.d.ts +19 -0
- package/types/qq/alemon/message/GUILD_UPDATE.d.ts +20 -0
- package/types/qq/alemon/message/INTERACTION_CREATE.d.ts +6 -0
- package/types/qq/alemon/message/MESSAGE_CREATE.d.ts +9 -0
- package/types/qq/alemon/message/MESSAGE_DELETE.d.ts +9 -0
- package/types/qq/alemon/message/MESSAGE_REACTION_ADD.d.ts +13 -0
- package/types/qq/alemon/message/MESSAGE_REACTION_REMOVE.d.ts +13 -0
- package/types/qq/alemon/message/PUBLIC_MESSAGE_DELETE.d.ts +19 -0
- package/types/qq/index.d.ts +2 -6
- package/types/qq/sdk/api.d.ts +325 -29
- package/types/qq/sdk/config.d.ts +3 -12
- package/types/qq/sdk/index.d.ts +1 -1
- package/types/qq/sdk/typings.d.ts +3 -3
- package/types/qq/sdk/wss.d.ts +63 -18
- package/types/villa/alemon/controller.d.ts +46 -172
- package/types/villa/alemon/reply.d.ts +3 -1
- package/types/villa/index.d.ts +1 -1
- package/types/villa/sdk/api.d.ts +427 -375
- package/types/villa/sdk/config.d.ts +4 -14
- package/types/villa/sdk/index.d.ts +1 -1
- package/types/villa/sdk/wss.d.ts +50 -20
- package/lib/api/controller.js +0 -40
- package/lib/core/application.js +0 -256
- package/lib/core/apps.js +0 -261
- package/lib/core/cache/app.js +0 -20
- package/lib/core/cache/arg.js +0 -13
- package/lib/core/cache/event.js +0 -13
- package/lib/core/cache/index.js +0 -6
- package/lib/core/cache/message.js +0 -13
- package/lib/core/cache/priority.js +0 -13
- package/lib/core/cache/slicing.js +0 -26
- package/lib/core/call.js +0 -33
- package/lib/core/configs.js +0 -36
- package/lib/core/conversation/index.js +0 -89
- package/lib/core/dealmsg.js +0 -222
- package/lib/core/help.js +0 -51
- package/lib/core/plugin/index.js +0 -151
- package/lib/core/utils/screenshot.js +0 -67
- package/lib/discord/discord.js +0 -30
- package/lib/discord/login.js +0 -20
- package/lib/discord/sdk/base.js +0 -30
- package/lib/discord/sdk/cdn.js +0 -38
- package/lib/kook/kook.js +0 -4
- package/lib/kook/login.js +0 -20
- package/lib/log/event.js +0 -20
- package/lib/log/user.js +0 -20
- package/lib/ntqq/alemon/group/bot.js +0 -11
- package/lib/ntqq/alemon/group/types.js +0 -1
- package/lib/ntqq/alemon/guild/controller.js +0 -1
- package/lib/ntqq/login.js +0 -19
- package/lib/ntqq/ntqq.js +0 -11
- package/lib/ntqq/sdk/api/auth.js +0 -15
- package/lib/ntqq/sdk/api/config.js +0 -3
- package/lib/ntqq/sdk/api/group.js +0 -124
- package/lib/ntqq/sdk/api/guild.js +0 -80
- package/lib/ntqq/sdk/api/index.js +0 -4
- package/lib/ntqq/sdk/counter.js +0 -15
- package/lib/qq/alemon/doc.js +0 -93
- package/lib/qq/alemon/message/AUDIO_ACTION.js +0 -108
- package/lib/qq/alemon/message/CHANNEL.js +0 -102
- package/lib/qq/alemon/message/DIRECT_MESSAGE.js +0 -87
- package/lib/qq/alemon/message/FORUMS_EVENT.js +0 -106
- package/lib/qq/alemon/message/GUILDS.js +0 -102
- package/lib/qq/alemon/message/GUILD_MEMBERS.js +0 -97
- package/lib/qq/alemon/message/GUILD_MESSAGE_REACTIONS.js +0 -101
- package/lib/qq/alemon/message/MESSAGE_AUDIT.js +0 -96
- package/lib/qq/alemon/message/OPEN_FORUMS_EVENT.js +0 -125
- package/lib/qq/alemon/message/PUBLIC_GUILD_MESSAGES.js +0 -153
- package/lib/qq/alemon/permissions.js +0 -41
- package/lib/qq/alemon/types.js +0 -21
- package/lib/qq/login.js +0 -18
- package/lib/qq/qq.js +0 -15
- package/lib/villa/login.js +0 -21
- package/lib/villa/sdk/all.js +0 -4
- package/lib/villa/sdk/counter.js +0 -9
- package/lib/villa/sdk/mechanism.js +0 -254
- package/lib/villa/sdk/reply.js +0 -62
- package/lib/villa/sdk/utils.js +0 -83
- package/lib/villa/villa.js +0 -7
- package/types/api/controller.d.ts +0 -32
- package/types/core/application.d.ts +0 -65
- package/types/core/apps.d.ts +0 -291
- package/types/core/cache/app.d.ts +0 -11
- package/types/core/cache/arg.d.ts +0 -10
- package/types/core/cache/event.d.ts +0 -10
- package/types/core/cache/index.d.ts +0 -6
- package/types/core/cache/message.d.ts +0 -10
- package/types/core/cache/priority.d.ts +0 -10
- package/types/core/cache/slicing.d.ts +0 -20
- package/types/core/call.d.ts +0 -70
- package/types/core/configs.d.ts +0 -82
- package/types/core/conversation/index.d.ts +0 -76
- package/types/core/dealmsg.d.ts +0 -14
- package/types/core/dev/types.d.ts +0 -37
- package/types/core/help.d.ts +0 -11
- package/types/core/plugin/index.d.ts +0 -95
- package/types/core/utils/screenshot.d.ts +0 -28
- package/types/discord/discord.d.ts +0 -28
- package/types/discord/login.d.ts +0 -7
- package/types/discord/sdk/base.d.ts +0 -14
- package/types/discord/sdk/cdn.d.ts +0 -16
- package/types/kook/kook.d.ts +0 -19
- package/types/kook/login.d.ts +0 -7
- package/types/log/event.d.ts +0 -15
- package/types/log/index.d.ts +0 -10
- package/types/log/user.d.ts +0 -15
- package/types/ntqq/alemon/group/bot.d.ts +0 -8
- package/types/ntqq/alemon/group/controller.d.ts +0 -77
- package/types/ntqq/alemon/group/direct.d.ts +0 -81
- package/types/ntqq/alemon/guild/controller.d.ts +0 -1
- package/types/ntqq/login.d.ts +0 -6
- package/types/ntqq/ntqq.d.ts +0 -55
- package/types/ntqq/sdk/api/auth.d.ts +0 -8
- package/types/ntqq/sdk/api/config.d.ts +0 -3
- package/types/ntqq/sdk/api/group.d.ts +0 -99
- package/types/ntqq/sdk/api/guild.d.ts +0 -35
- package/types/ntqq/sdk/api/index.d.ts +0 -4
- package/types/ntqq/sdk/counter.d.ts +0 -7
- package/types/qq/alemon/doc.d.ts +0 -93
- package/types/qq/alemon/message/AUDIO_ACTION.d.ts +0 -15
- package/types/qq/alemon/message/CHANNEL.d.ts +0 -36
- package/types/qq/alemon/message/DIRECT_MESSAGE.d.ts +0 -49
- package/types/qq/alemon/message/FORUMS_EVENT.d.ts +0 -38
- package/types/qq/alemon/message/GUILDS.d.ts +0 -39
- package/types/qq/alemon/message/GUILD_MEMBERS.d.ts +0 -26
- package/types/qq/alemon/message/GUILD_MESSAGES.d.ts +0 -12
- package/types/qq/alemon/message/GUILD_MESSAGE_REACTIONS.d.ts +0 -24
- package/types/qq/alemon/message/INTERACTION.d.ts +0 -8
- package/types/qq/alemon/message/MESSAGE_AUDIT.d.ts +0 -9
- package/types/qq/alemon/message/OPEN_FORUMS_EVENT.d.ts +0 -42
- package/types/qq/alemon/message/PUBLIC_GUILD_MESSAGES.d.ts +0 -51
- package/types/qq/alemon/permissions.d.ts +0 -29
- package/types/qq/alemon/types.d.ts +0 -20
- package/types/qq/login.d.ts +0 -6
- package/types/qq/qq.d.ts +0 -50
- package/types/villa/login.d.ts +0 -7
- package/types/villa/sdk/all.d.ts +0 -4
- package/types/villa/sdk/mechanism.d.ts +0 -11
- package/types/villa/sdk/reply.d.ts +0 -26
- package/types/villa/sdk/utils.d.ts +0 -11
- package/types/villa/villa.d.ts +0 -34
- package/lib/core/{dev → processor}/data.js +0 -0
- package/lib/core/{dev → processor}/path.js +12 -12
- package/lib/core/{dev → processor}/types.js +0 -0
- package/lib/{core/plugin → ntqq/alemon}/types.js +0 -0
- package/types/core/{dev → processor}/data.d.ts +0 -0
- package/types/core/{dev → processor}/path.d.ts +9 -9
- /package/types/ntqq/alemon/{group/message → message}/C2C_MESSAGE_CREATE.d.ts +0 -0
- /package/types/ntqq/alemon/{group/message → message}/GROUP_AT_MESSAGE_CREATE.d.ts +0 -0
- /package/types/ntqq/alemon/{group/segment.d.ts → segment.d.ts} +0 -0
- /package/types/ntqq/alemon/{group/types.d.ts → types.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -167,6 +167,20 @@ npm run build
|
|
|
167
167
|
|
|
168
168
|
该程序可放置于`plugins/your plugin name`文件夹下
|
|
169
169
|
|
|
170
|
+
# Unknown file ".ts"
|
|
171
|
+
|
|
172
|
+
node >= 20.0.0
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
npx ts-node alemon.config.ts
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
更改为
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
node --no-warnings=ExperimentalWarning --loader ts-node/esm alemon.config.ts
|
|
182
|
+
```
|
|
183
|
+
|
|
170
184
|
### Dependencies
|
|
171
185
|
|
|
172
186
|
```json
|
package/lib/api/index.js
CHANGED
|
@@ -4,27 +4,18 @@
|
|
|
4
4
|
* ***********
|
|
5
5
|
*/
|
|
6
6
|
export { ClientQQ } from '../qq/index.js';
|
|
7
|
-
/**
|
|
8
|
-
* villa客户端
|
|
9
|
-
*/
|
|
10
7
|
export { ClientVILLA } from '../villa/index.js';
|
|
11
|
-
/**
|
|
12
|
-
* ntqq客户端
|
|
13
|
-
*/
|
|
14
8
|
export { ClientNTQQ } from '../ntqq/index.js';
|
|
15
|
-
/**
|
|
16
|
-
* server客户端
|
|
17
|
-
*/
|
|
18
9
|
export { ClientKOA } from '../koa/index.js';
|
|
19
|
-
/**
|
|
20
|
-
* kook客户端
|
|
21
|
-
*/
|
|
22
10
|
export { ClientKOOK } from '../kook/index.js';
|
|
23
|
-
/**
|
|
24
|
-
* discord
|
|
25
|
-
*/
|
|
26
11
|
export { ClientDISOCRD } from '../discord/index.js';
|
|
27
12
|
/**
|
|
28
|
-
*
|
|
13
|
+
* ************
|
|
14
|
+
* Controllers
|
|
15
|
+
* ************
|
|
29
16
|
*/
|
|
30
|
-
export
|
|
17
|
+
export { Controllers as ControllerVILLA } from '../villa/alemon/controller.js';
|
|
18
|
+
export { Controllers as ControllerQQ } from '../qq/alemon/controller.js';
|
|
19
|
+
export { Controllers as ControllerDISCORD } from '../discord/alemon/controller.js';
|
|
20
|
+
export { Controllers as ControllerNTQQ } from '../ntqq/alemon/controller.js';
|
|
21
|
+
export { Controllers as ControllerKOOK } from '../kook/alemon/controller.js';
|
package/lib/config/login.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { DefaultConfig } from '../default/index.js';
|
|
2
|
-
import { defineKOOK as kook } from '../kook/
|
|
3
|
-
import { defineVILLA as villa } from '../villa/
|
|
4
|
-
import { defineQQ as qq } from '../qq/
|
|
5
|
-
import { defineNtqq as ntqq } from '../ntqq/
|
|
6
|
-
import { defineDISCORD as discord } from '../discord/
|
|
2
|
+
import { defineKOOK as kook } from '../kook/sdk/ws.js';
|
|
3
|
+
import { defineVILLA as villa } from '../villa/sdk/wss.js';
|
|
4
|
+
import { defineQQ as qq } from '../qq/sdk/wss.js';
|
|
5
|
+
import { defineNtqq as ntqq } from '../ntqq/sdk/wss.js';
|
|
6
|
+
import { defineDISCORD as discord } from '../discord/sdk/wss.js';
|
|
7
7
|
import { Screenshot } from '../core/index.js';
|
|
8
|
-
class
|
|
9
|
-
data =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
class BaseConfig {
|
|
9
|
+
#data = null;
|
|
10
|
+
constructor(val) {
|
|
11
|
+
this.#data = val;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 设置配置
|
|
15
|
+
* @param key
|
|
16
|
+
* @param val
|
|
17
|
+
*/
|
|
18
18
|
set(key, val) {
|
|
19
19
|
if (key == 'puppeteer') {
|
|
20
20
|
// pup 不用检查 直接覆盖
|
|
21
21
|
for (const item in val) {
|
|
22
|
-
this
|
|
22
|
+
this.#data[key][item] = val[item];
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
for (const item in val) {
|
|
27
27
|
// 当前仅当同属性名的时候才会覆盖默认配置
|
|
28
|
-
if (Object.prototype.hasOwnProperty.call(this
|
|
29
|
-
this
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(this.#data[key], item)) {
|
|
29
|
+
this.#data[key][item] = val[item];
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
// 不属于默认
|
|
33
33
|
try {
|
|
34
|
-
this
|
|
35
|
-
this
|
|
34
|
+
this.#data[key] = {};
|
|
35
|
+
this.#data[key] = val[item];
|
|
36
36
|
console.info('KEY secess');
|
|
37
37
|
}
|
|
38
38
|
catch {
|
|
@@ -42,25 +42,24 @@ class BotConfig {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* 读取配置
|
|
47
|
+
* @param key
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
45
50
|
get(key) {
|
|
46
|
-
return this
|
|
51
|
+
return this.#data[key];
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
/**
|
|
50
55
|
* 机器人配置
|
|
51
56
|
*/
|
|
52
|
-
export const BOTCONFIG = new
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* g得到机器人基础配置
|
|
62
|
-
* @param key 配置名
|
|
63
|
-
* @returns 得到配置值
|
|
64
|
-
* @deprecated 已废弃
|
|
65
|
-
*/
|
|
66
|
-
export const getBotConfigByKey = BOTCONFIG.get;
|
|
57
|
+
export const BOTCONFIG = new BaseConfig({
|
|
58
|
+
...DefaultConfig,
|
|
59
|
+
kook,
|
|
60
|
+
villa,
|
|
61
|
+
qq,
|
|
62
|
+
ntqq,
|
|
63
|
+
puppeteer: Screenshot.launch,
|
|
64
|
+
discord
|
|
65
|
+
});
|
package/lib/core/index.js
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* private
|
|
4
4
|
* ********
|
|
5
5
|
*/
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './configs.js';
|
|
8
|
-
export * from './apps.js';
|
|
9
|
-
export * from './cache/index.js';
|
|
10
|
-
export * from './conversation/index.js';
|
|
11
|
-
export * from './dealmsg.js';
|
|
12
|
-
export * from './application.js';
|
|
6
|
+
export * from './processor/configs.js';
|
|
13
7
|
export * from './typings.js';
|
|
14
8
|
export * from './utils/index.js';
|
|
9
|
+
export * from './types.js';
|
|
10
|
+
export * from './processor/path.js';
|
|
11
|
+
export * from './processor/application.js';
|
|
12
|
+
export * from './processor/log.js';
|
package/lib/core/main.js
CHANGED
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
* public
|
|
4
4
|
* ********
|
|
5
5
|
*/
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './conversation/index.js';
|
|
10
|
-
export * from './plugin/index.js';
|
|
6
|
+
export * from './processor/configs.js';
|
|
7
|
+
export * from './processor/help.js';
|
|
8
|
+
export * from './index.js';
|
|
11
9
|
export * from './utils/index.js';
|
|
12
10
|
export * from './typings.js';
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
export * from './processor/alemon.js';
|
|
13
|
+
export * from './processor/path.js';
|
|
14
|
+
export * from './processor/help.js';
|
|
15
|
+
export * from './processor/plugin.js';
|
|
16
|
+
export * from './processor/subscribe.js';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AppMap } from './data.js';
|
|
2
2
|
import { getAppName } from './path.js';
|
|
3
3
|
import { DoublyLinkedList } from './listdouble.js';
|
|
4
|
+
import memory from 'memory-cache';
|
|
5
|
+
import { Help } from './help.js';
|
|
6
|
+
import { APPCONFIG } from './configs.js';
|
|
4
7
|
/**
|
|
5
8
|
* 应用结构
|
|
6
9
|
*/
|
|
@@ -22,8 +25,10 @@ export class Alemon {
|
|
|
22
25
|
#regular = null;
|
|
23
26
|
// 消息链表
|
|
24
27
|
#list = new DoublyLinkedList();
|
|
28
|
+
#listArr = [];
|
|
25
29
|
// 事件链表
|
|
26
30
|
#elist = new DoublyLinkedList();
|
|
31
|
+
#elistArr = [];
|
|
27
32
|
/**
|
|
28
33
|
* 创建应用
|
|
29
34
|
* @param name 应用名
|
|
@@ -57,11 +62,13 @@ export class Alemon {
|
|
|
57
62
|
/**
|
|
58
63
|
* list查询
|
|
59
64
|
*/
|
|
60
|
-
find() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
find(acount, example, func) {
|
|
66
|
+
for (const node of this.#listArr) {
|
|
67
|
+
if (node.acount == acount &&
|
|
68
|
+
node.example == example &&
|
|
69
|
+
node.func == func) {
|
|
70
|
+
return node;
|
|
71
|
+
}
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
74
|
/**
|
|
@@ -77,6 +84,8 @@ export class Alemon {
|
|
|
77
84
|
* @param node
|
|
78
85
|
*/
|
|
79
86
|
async responseNode(e, node) {
|
|
87
|
+
//
|
|
88
|
+
const time = Date.now();
|
|
80
89
|
/**
|
|
81
90
|
* **********
|
|
82
91
|
* 构造配置
|
|
@@ -94,22 +103,18 @@ export class Alemon {
|
|
|
94
103
|
arr = await argFunc(e);
|
|
95
104
|
}
|
|
96
105
|
this.#data[node.acount][node.example].e = e;
|
|
97
|
-
const time = Date.now();
|
|
98
106
|
// 执行
|
|
99
|
-
|
|
107
|
+
this.#data[node.acount][node.example][node.func](e, ...arr)
|
|
100
108
|
.then(res => {
|
|
101
|
-
|
|
109
|
+
if (res && typeof res != 'boolean') {
|
|
110
|
+
e.reply(res);
|
|
111
|
+
}
|
|
112
|
+
console.info(this.#infoFunc(e, node.name, node.acount, node.example, node.func), true, Date.now() - time);
|
|
102
113
|
return res;
|
|
103
114
|
})
|
|
104
115
|
.catch(err => {
|
|
105
|
-
console.error(this
|
|
116
|
+
console.error(this.#errorFunc(e, node.name, node.acount, node.example, node.func), false, Date.now() - time, err);
|
|
106
117
|
});
|
|
107
|
-
// 重执行
|
|
108
|
-
if (res && typeof res != 'boolean') {
|
|
109
|
-
await e.reply(res).catch(err => {
|
|
110
|
-
console.error(this.err(e, node.func, time - Date.now()), err);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
118
|
}
|
|
114
119
|
/**
|
|
115
120
|
* 应用解析
|
|
@@ -117,10 +122,9 @@ export class Alemon {
|
|
|
117
122
|
*/
|
|
118
123
|
async responseMessage(e) {
|
|
119
124
|
// 空的
|
|
120
|
-
if (this.#list.isEmpty)
|
|
125
|
+
if (this.#list.isEmpty())
|
|
121
126
|
return;
|
|
122
|
-
|
|
123
|
-
const list = this.#list;
|
|
127
|
+
const time = Date.now();
|
|
124
128
|
/**
|
|
125
129
|
* **********
|
|
126
130
|
* 构造配置
|
|
@@ -137,39 +141,71 @@ export class Alemon {
|
|
|
137
141
|
if (typeof argFunc == 'function') {
|
|
138
142
|
arr = await argFunc(e);
|
|
139
143
|
}
|
|
144
|
+
// 自动延长过期周期
|
|
145
|
+
const CacheData = memory.get(e.msg);
|
|
146
|
+
if (CacheData) {
|
|
147
|
+
for (const node of CacheData) {
|
|
148
|
+
this.#data[node.acount][node.example].e = e;
|
|
149
|
+
const time = Date.now();
|
|
150
|
+
// 执行
|
|
151
|
+
const res = await this.#data[node.acount][node.example][node.func](e, ...arr)
|
|
152
|
+
.then(res => {
|
|
153
|
+
if (res && typeof res != 'boolean') {
|
|
154
|
+
e.reply(res);
|
|
155
|
+
}
|
|
156
|
+
console.info(this.#infoFunc(e, node.name, node.acount, node.example, node.func), true, Date.now() - time);
|
|
157
|
+
return res;
|
|
158
|
+
})
|
|
159
|
+
.catch(err => {
|
|
160
|
+
console.error(this.#errorFunc(e, node.name, node.acount, node.example, node.func), false, Date.now() - time, err);
|
|
161
|
+
});
|
|
162
|
+
// 不是 false ,也就是不放行
|
|
163
|
+
if (res != false)
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// 结点缓存
|
|
169
|
+
const cache = [];
|
|
140
170
|
/**
|
|
141
171
|
* *******
|
|
142
172
|
* 走表
|
|
143
173
|
* **********
|
|
144
174
|
*/
|
|
145
|
-
for (
|
|
146
|
-
// 不断的取出索引
|
|
147
|
-
const node = list.shift();
|
|
175
|
+
for (const node of this.#listArr) {
|
|
148
176
|
// 索引匹配
|
|
149
177
|
if (node.reg.test(e.msg)) {
|
|
150
178
|
this.#data[node.acount][node.example].e = e;
|
|
151
|
-
const time = Date.now();
|
|
152
179
|
// 执行
|
|
153
180
|
const res = await this.#data[node.acount][node.example][node.func](e, ...arr)
|
|
154
181
|
.then(res => {
|
|
155
|
-
|
|
182
|
+
if (res && typeof res != 'boolean') {
|
|
183
|
+
e.reply(res);
|
|
184
|
+
}
|
|
185
|
+
console.info(this.#infoFunc(e, node.name, node.acount, node.example, node.func), true, Date.now() - time);
|
|
156
186
|
return res;
|
|
157
187
|
})
|
|
158
188
|
.catch(err => {
|
|
159
|
-
console.error(this
|
|
189
|
+
console.error(this.#errorFunc(e, node.name, node.acount, node.example, node.func), false, Date.now() - time, err);
|
|
160
190
|
// 错误了就强制中断
|
|
161
191
|
});
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
await e.reply(res).catch(err => {
|
|
165
|
-
console.error(this.err(e, node.func, time - Date.now()), err);
|
|
166
|
-
});
|
|
167
|
-
}
|
|
192
|
+
// 推送缓存
|
|
193
|
+
cache.push(node);
|
|
168
194
|
// 不是 false ,也就是不放行
|
|
169
195
|
if (res != false)
|
|
170
196
|
break;
|
|
171
197
|
}
|
|
172
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* ********
|
|
201
|
+
* 记录缓存
|
|
202
|
+
* ********
|
|
203
|
+
*/
|
|
204
|
+
if (cache.length != 0) {
|
|
205
|
+
// 5分钟的缓存
|
|
206
|
+
memory.put(e.msg, cache, 5 * 60 * 1000);
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
173
209
|
}
|
|
174
210
|
/**
|
|
175
211
|
* 响应消息类型
|
|
@@ -177,9 +213,9 @@ export class Alemon {
|
|
|
177
213
|
*/
|
|
178
214
|
async responseEventType(e) {
|
|
179
215
|
// 空的
|
|
180
|
-
if (this.#elist.isEmpty)
|
|
216
|
+
if (this.#elist.isEmpty())
|
|
181
217
|
return;
|
|
182
|
-
const
|
|
218
|
+
const time = Date.now();
|
|
183
219
|
/**
|
|
184
220
|
* *****
|
|
185
221
|
* ******
|
|
@@ -195,35 +231,68 @@ export class Alemon {
|
|
|
195
231
|
if (typeof argFunc == 'function') {
|
|
196
232
|
arr = await argFunc(e);
|
|
197
233
|
}
|
|
234
|
+
const key = `${e.event}:${e.typing}`;
|
|
235
|
+
// 自动延长过期周期
|
|
236
|
+
const CacheData = memory.get(key);
|
|
237
|
+
if (CacheData) {
|
|
238
|
+
for (const node of CacheData) {
|
|
239
|
+
this.#data[node.acount][node.example].e = e;
|
|
240
|
+
const time = Date.now();
|
|
241
|
+
const res = await this.#data[node.acount][node.example][node.func](e, ...arr)
|
|
242
|
+
.then(res => {
|
|
243
|
+
console.info(this.#infoFunc(e, node.name, node.acount, node.example, node.func), true, Date.now() - time);
|
|
244
|
+
if (res && typeof res != 'boolean') {
|
|
245
|
+
e.reply(res);
|
|
246
|
+
}
|
|
247
|
+
return res;
|
|
248
|
+
})
|
|
249
|
+
.catch(err => {
|
|
250
|
+
console.error(this.#errorFunc(e, node.name, node.acount, node.example, node.func), false, Date.now() - time, err);
|
|
251
|
+
});
|
|
252
|
+
// 不是 false ,也就是不放行
|
|
253
|
+
if (res != false)
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const cache = [];
|
|
198
259
|
/**
|
|
199
260
|
* ******
|
|
200
261
|
* *****
|
|
201
262
|
*/
|
|
202
|
-
for (
|
|
203
|
-
const node = list.shift();
|
|
263
|
+
for (const node of this.#elistArr) {
|
|
204
264
|
// 类型不符
|
|
205
265
|
if (node.event !== e.event || node.typing !== e.typing)
|
|
206
266
|
continue;
|
|
207
267
|
//
|
|
208
268
|
this.#data[node.acount][node.example].e = e;
|
|
209
|
-
const time = Date.now();
|
|
210
269
|
const res = await this.#data[node.acount][node.example][node.func](e, ...arr)
|
|
211
270
|
.then(res => {
|
|
212
|
-
|
|
271
|
+
if (res && typeof res != 'boolean') {
|
|
272
|
+
e.reply(res);
|
|
273
|
+
}
|
|
274
|
+
console.info(this.#infoFunc(e, node.name, node.acount, node.example, node.func), true, Date.now() - time);
|
|
213
275
|
return res;
|
|
214
276
|
})
|
|
215
277
|
.catch(err => {
|
|
216
|
-
console.error(this
|
|
278
|
+
console.error(this.#errorFunc(e, node.name, node.acount, node.example, node.func), false, Date.now() - time, err);
|
|
217
279
|
});
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
console.error(this.err(e, node.func, time - Date.now()), err);
|
|
221
|
-
});
|
|
222
|
-
}
|
|
280
|
+
// 推送缓存
|
|
281
|
+
cache.push(node);
|
|
223
282
|
// 不是 false ,也就是不放行
|
|
224
283
|
if (res != false)
|
|
225
284
|
break;
|
|
226
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* ********
|
|
288
|
+
* 记录缓存
|
|
289
|
+
* ********
|
|
290
|
+
*/
|
|
291
|
+
if (cache.length != 0) {
|
|
292
|
+
// 15分钟的缓存
|
|
293
|
+
memory.put(key, cache, 60 * 15);
|
|
294
|
+
}
|
|
295
|
+
return;
|
|
227
296
|
}
|
|
228
297
|
/**
|
|
229
298
|
* 扩展参数
|
|
@@ -234,6 +303,16 @@ export class Alemon {
|
|
|
234
303
|
this.#dataMap.set('arg', fnc);
|
|
235
304
|
return this;
|
|
236
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
*
|
|
308
|
+
* 扩展参数
|
|
309
|
+
* @param fnc
|
|
310
|
+
* @returns
|
|
311
|
+
* @deprecated 已废弃
|
|
312
|
+
*/
|
|
313
|
+
setArg(fnc) {
|
|
314
|
+
return this.arg(fnc);
|
|
315
|
+
}
|
|
237
316
|
/**
|
|
238
317
|
* 重定义ecent
|
|
239
318
|
* @param fnc
|
|
@@ -243,6 +322,15 @@ export class Alemon {
|
|
|
243
322
|
this.#dataMap.set('event', fnc);
|
|
244
323
|
return this;
|
|
245
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* 重定义ecent
|
|
327
|
+
* @param fnc
|
|
328
|
+
* @returns
|
|
329
|
+
* @deprecated 已废弃
|
|
330
|
+
*/
|
|
331
|
+
setMessage(fnc) {
|
|
332
|
+
return this.event(fnc);
|
|
333
|
+
}
|
|
246
334
|
/**
|
|
247
335
|
* 字符串切割
|
|
248
336
|
* @param reg
|
|
@@ -256,6 +344,16 @@ export class Alemon {
|
|
|
256
344
|
});
|
|
257
345
|
return this;
|
|
258
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* 字符串切割
|
|
349
|
+
* @param reg
|
|
350
|
+
* @param str
|
|
351
|
+
* @returns
|
|
352
|
+
* @deprecated 已废弃
|
|
353
|
+
*/
|
|
354
|
+
setCharacter(val) {
|
|
355
|
+
return this.replace(/^(\/|#)/, val);
|
|
356
|
+
}
|
|
259
357
|
/**
|
|
260
358
|
* 集合
|
|
261
359
|
* @param AplguinMap
|
|
@@ -267,9 +365,17 @@ export class Alemon {
|
|
|
267
365
|
// 收集
|
|
268
366
|
for (const example in AplguinMap) {
|
|
269
367
|
const keys = new AplguinMap[example]();
|
|
270
|
-
//
|
|
368
|
+
// 过滤事件
|
|
369
|
+
const event = APPCONFIG.get('event');
|
|
370
|
+
if (keys.event && event.includes(keys.event)) {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
// name
|
|
271
374
|
keys.name = this.#name;
|
|
375
|
+
// 层级
|
|
272
376
|
keys.acount = this.#acount;
|
|
377
|
+
// 实例名
|
|
378
|
+
keys.example = example;
|
|
273
379
|
// 记录
|
|
274
380
|
this.#data[this.#acount][example] = keys;
|
|
275
381
|
// 忽视非法key
|
|
@@ -353,38 +459,61 @@ export class Alemon {
|
|
|
353
459
|
this.#acount++;
|
|
354
460
|
return this;
|
|
355
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* 加载
|
|
464
|
+
* @param AplguinMap
|
|
465
|
+
* @returns
|
|
466
|
+
* @deprecated 已废弃
|
|
467
|
+
*/
|
|
468
|
+
component(AplguinMap = {}) {
|
|
469
|
+
return this.use(AplguinMap);
|
|
470
|
+
}
|
|
356
471
|
/**
|
|
357
472
|
* 挂载
|
|
358
473
|
*/
|
|
359
474
|
mount() {
|
|
360
475
|
// 构造大正则
|
|
361
476
|
this.#regular = new RegExp(this.#mergedRegexArr.map(regex => regex.source).join('|'));
|
|
362
|
-
|
|
477
|
+
// 数组化
|
|
478
|
+
this.#elistArr = this.#elist.toArray();
|
|
479
|
+
this.#listArr = this.#list.toArray();
|
|
480
|
+
// 设置
|
|
363
481
|
AppMap.set(this.#name, this);
|
|
482
|
+
// 生成json
|
|
483
|
+
new Help(this.#name).create(this.#listArr);
|
|
364
484
|
}
|
|
485
|
+
#infoFunc = (e, name, acount, example, funcName) => {
|
|
486
|
+
return `[${e.event}] [${e.typing}] [${name}] [${acount}] [${example}] [${funcName}]`;
|
|
487
|
+
};
|
|
365
488
|
/**
|
|
366
|
-
*
|
|
489
|
+
* 自定义
|
|
367
490
|
* @param data
|
|
368
491
|
* @param funcName
|
|
369
492
|
* @returns
|
|
370
493
|
*/
|
|
371
|
-
|
|
372
|
-
|
|
494
|
+
info(func) {
|
|
495
|
+
this.#infoFunc = func;
|
|
496
|
+
return this;
|
|
373
497
|
}
|
|
498
|
+
#errorFunc = (e, name, acount, example, funcName) => {
|
|
499
|
+
return `[${e.event}] [${e.typing}] [${name}] [${acount}] [${example}] [${funcName}]`;
|
|
500
|
+
};
|
|
374
501
|
/**
|
|
375
|
-
*
|
|
502
|
+
* 错误打印
|
|
376
503
|
* @param data
|
|
377
504
|
* @param funcName
|
|
378
505
|
* @returns
|
|
379
506
|
*/
|
|
380
|
-
|
|
381
|
-
|
|
507
|
+
error(func) {
|
|
508
|
+
this.#errorFunc = func;
|
|
509
|
+
return this;
|
|
382
510
|
}
|
|
383
511
|
/**
|
|
384
512
|
* 响应消息类型
|
|
385
513
|
* @param e
|
|
386
514
|
*/
|
|
387
515
|
async response(e, event) {
|
|
516
|
+
const time = Date.now();
|
|
388
517
|
if (this.#CallData[event]) {
|
|
389
518
|
const func = this.#dataMap.get('event');
|
|
390
519
|
if (func)
|
|
@@ -398,14 +527,16 @@ export class Alemon {
|
|
|
398
527
|
arr = await argFunc(e);
|
|
399
528
|
}
|
|
400
529
|
const FuncName = String(this.#CallData[event]['fnc']).match(/:\s*(\w+)\]/)[1];
|
|
401
|
-
const time = Date.now();
|
|
402
530
|
this.#CallData[event](e, ...arr)
|
|
403
531
|
.then(res => {
|
|
404
|
-
|
|
532
|
+
if (res && typeof res != 'boolean') {
|
|
533
|
+
e.reply(res);
|
|
534
|
+
}
|
|
535
|
+
console.info(this.#infoFunc(e, this.#name, 0, 'on', FuncName), true, Date.now() - time);
|
|
405
536
|
return res;
|
|
406
537
|
})
|
|
407
538
|
.catch(err => {
|
|
408
|
-
console.error(this
|
|
539
|
+
console.error(this.#infoFunc(e, this.#name, 0, 'on', FuncName), false, Date.now() - time, err);
|
|
409
540
|
});
|
|
410
541
|
}
|
|
411
542
|
return false;
|