@kotori-bot/core 1.6.5 → 1.7.1
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/{LICENSE → LICENSE.md} +674 -674
- package/lib/app/common.js +8 -10
- package/lib/app/config.js +9 -10
- package/lib/app/core.js +8 -10
- package/lib/app/index.js +8 -10
- package/lib/app/message.js +17 -19
- package/lib/components/adapter.js +8 -10
- package/lib/components/api.js +18 -16
- package/lib/components/cache.js +8 -10
- package/lib/components/command.js +8 -10
- package/lib/components/elements.js +8 -10
- package/lib/components/filter.js +8 -10
- package/lib/components/index.js +8 -10
- package/lib/components/messages.js +8 -10
- package/lib/components/session.js +27 -17
- package/lib/decorators/index.js +8 -10
- package/lib/decorators/plugin.js +8 -10
- package/lib/decorators/utils.js +14 -12
- package/lib/global/constants.js +8 -10
- package/lib/global/index.js +8 -10
- package/lib/global/symbols.js +8 -10
- package/lib/index.js +23 -23
- package/lib/types/adapter.js +8 -10
- package/lib/types/api.js +8 -10
- package/lib/types/command.js +8 -10
- package/lib/types/config.js +8 -10
- package/lib/types/events.js +8 -10
- package/lib/types/filter.js +8 -10
- package/lib/types/index.js +8 -10
- package/lib/types/message.js +8 -10
- package/lib/types/session.js +8 -10
- package/lib/utils/container.js +8 -10
- package/lib/utils/error.js +8 -10
- package/lib/utils/factory.js +10 -11
- package/lib/utils/internal.js +8 -10
- package/lib/utils/jsx.js +97 -0
- package/package.json +5 -4
- package/lib/app/common.d.ts +0 -6
- package/lib/app/config.d.ts +0 -32
- package/lib/app/core.d.ts +0 -139
- package/lib/app/index.d.ts +0 -3
- package/lib/app/message.d.ts +0 -34
- package/lib/components/adapter.d.ts +0 -122
- package/lib/components/api.d.ts +0 -417
- package/lib/components/cache.d.ts +0 -37
- package/lib/components/command.d.ts +0 -153
- package/lib/components/elements.d.ts +0 -144
- package/lib/components/filter.d.ts +0 -22
- package/lib/components/index.d.ts +0 -8
- package/lib/components/messages.d.ts +0 -186
- package/lib/components/session.d.ts +0 -177
- package/lib/decorators/index.d.ts +0 -7
- package/lib/decorators/plugin.d.ts +0 -7
- package/lib/decorators/utils.d.ts +0 -60
- package/lib/global/constants.d.ts +0 -8
- package/lib/global/index.d.ts +0 -2
- package/lib/global/symbols.d.ts +0 -15
- package/lib/index.d.ts +0 -12
- package/lib/types/adapter.d.ts +0 -22
- package/lib/types/api.d.ts +0 -72
- package/lib/types/command.d.ts +0 -78
- package/lib/types/config.d.ts +0 -21
- package/lib/types/events.d.ts +0 -3
- package/lib/types/filter.d.ts +0 -51
- package/lib/types/index.d.ts +0 -7
- package/lib/types/message.d.ts +0 -176
- package/lib/types/session.d.ts +0 -349
- package/lib/utils/container.d.ts +0 -9
- package/lib/utils/error.d.ts +0 -49
- package/lib/utils/factory.d.ts +0 -12
- package/lib/utils/internal.d.ts +0 -46
package/lib/app/common.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/lib/app/config.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -55,6 +53,7 @@ class Config {
|
|
|
55
53
|
author: pkg.author,
|
|
56
54
|
coreVersion: pkg.version
|
|
57
55
|
};
|
|
56
|
+
;
|
|
58
57
|
globalThis.kotori = this.meta;
|
|
59
58
|
}
|
|
60
59
|
}
|
package/lib/app/core.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __create = Object.create;
|
|
14
12
|
var __defProp = Object.defineProperty;
|
package/lib/app/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/lib/app/message.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __create = Object.create;
|
|
14
12
|
var __defProp = Object.defineProperty;
|
|
@@ -99,7 +97,7 @@ class Message {
|
|
|
99
97
|
const prefix = session.api.adapter.config.commandPrefix ?? this.ctx.config.global.commandPrefix;
|
|
100
98
|
for (const cmd of this[import_global.Symbols.command]) {
|
|
101
99
|
for (const shortcut of cmd.meta.shortcut) {
|
|
102
|
-
if (
|
|
100
|
+
if (session.message.split(" ")[0] !== shortcut) continue;
|
|
103
101
|
session.message = session.message.replace(shortcut, `${prefix}${cmd.meta.root}`);
|
|
104
102
|
}
|
|
105
103
|
}
|
|
@@ -118,19 +116,20 @@ class Message {
|
|
|
118
116
|
if (result2 instanceof import_error.CommandError) continue;
|
|
119
117
|
try {
|
|
120
118
|
const executed = await cmd.meta.action({ args: result2.args, options: result2.options }, session);
|
|
121
|
-
if (executed instanceof import_error.CommandError) {
|
|
122
|
-
this.ctx.emit("command", { command: cmd, result: executed, raw, session });
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
119
|
if (executed !== void 0) session.quick(executed);
|
|
126
120
|
this.ctx.emit("command", {
|
|
127
121
|
command: cmd,
|
|
128
|
-
result: executed
|
|
122
|
+
result: executed,
|
|
129
123
|
raw,
|
|
130
124
|
session
|
|
131
125
|
});
|
|
132
126
|
} catch (error) {
|
|
133
|
-
this.ctx.emit("command", {
|
|
127
|
+
this.ctx.emit("command", {
|
|
128
|
+
command: matched,
|
|
129
|
+
result: error instanceof import_error.CommandError ? error : new import_error.CommandError({ type: "error", error }),
|
|
130
|
+
raw,
|
|
131
|
+
session
|
|
132
|
+
});
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
if (matched) return;
|
|
@@ -155,8 +154,7 @@ class Message {
|
|
|
155
154
|
cancel: cancel.get(),
|
|
156
155
|
target: key === "sendPrivateMsg" ? { type: import_types.MessageScope.PRIVATE, userId: id1 } : key === "sendGroupMsg" ? { type: import_types.MessageScope.GROUP, groupId: id1 } : { type: import_types.MessageScope.CHANNEL, guildId: id1, channelId: id2 }
|
|
157
156
|
});
|
|
158
|
-
|
|
159
|
-
Reflect.apply(target, thisArg, argArray);
|
|
157
|
+
return cancel.value ? { messageId: "", time: 0 } : Reflect.apply(target, thisArg, argArray);
|
|
160
158
|
}
|
|
161
159
|
});
|
|
162
160
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/lib/components/api.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -461,7 +459,7 @@ class Api {
|
|
|
461
459
|
* Set group avatar.
|
|
462
460
|
*
|
|
463
461
|
* @param groupId - Target group id
|
|
464
|
-
* @param
|
|
462
|
+
* @param image - Image data
|
|
465
463
|
* @param meta - Extra meta data, optional
|
|
466
464
|
*
|
|
467
465
|
* @experimental
|
|
@@ -473,7 +471,8 @@ class Api {
|
|
|
473
471
|
* Set group admin.
|
|
474
472
|
*
|
|
475
473
|
* @param groupId - Target group id
|
|
476
|
-
* @param
|
|
474
|
+
* @param userId - Target user id
|
|
475
|
+
* @param enable - Whether to set admin
|
|
477
476
|
* @param meta - Extra meta data, optional
|
|
478
477
|
*
|
|
479
478
|
* @experimental
|
|
@@ -485,7 +484,8 @@ class Api {
|
|
|
485
484
|
* Set group card.
|
|
486
485
|
*
|
|
487
486
|
* @param groupId - Target group id
|
|
488
|
-
* @param
|
|
487
|
+
* @param userId - Target user id
|
|
488
|
+
* @param card - Card content
|
|
489
489
|
* @param meta - Extra meta data, optional
|
|
490
490
|
*
|
|
491
491
|
* @experimental
|
|
@@ -497,7 +497,8 @@ class Api {
|
|
|
497
497
|
* Set group members ban or unban.
|
|
498
498
|
*
|
|
499
499
|
* @param groupId - Target group id
|
|
500
|
-
* @param
|
|
500
|
+
* @param userId - Target user id
|
|
501
|
+
* @param time - Ban time, 0 means unban
|
|
501
502
|
* @param meta - Extra meta data, optional
|
|
502
503
|
*
|
|
503
504
|
* @experimental
|
|
@@ -509,7 +510,8 @@ class Api {
|
|
|
509
510
|
* Set group new notice.
|
|
510
511
|
*
|
|
511
512
|
* @param groupId - Target group id
|
|
512
|
-
* @param
|
|
513
|
+
* @param content - Notice content
|
|
514
|
+
* @param image - Notice image, optional
|
|
513
515
|
* @param meta - Extra meta data, optional
|
|
514
516
|
*
|
|
515
517
|
* @experimental
|
|
@@ -530,7 +532,7 @@ class Api {
|
|
|
530
532
|
* Set group members kicked.
|
|
531
533
|
*
|
|
532
534
|
* @param groupId - Target group id
|
|
533
|
-
* @param
|
|
535
|
+
* @param userId - Target user id
|
|
534
536
|
* @param meta - Extra meta data, optional
|
|
535
537
|
*
|
|
536
538
|
* @experimental
|
package/lib/components/cache.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __create = Object.create;
|
|
14
12
|
var __defProp = Object.defineProperty;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/lib/components/filter.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/lib/components/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
11
|
+
var __create = Object.create;
|
|
13
12
|
var __defProp = Object.defineProperty;
|
|
14
13
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
14
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
15
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
16
16
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17
17
|
var __export = (target, all) => {
|
|
18
18
|
for (var name in all)
|
|
@@ -26,6 +26,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
}
|
|
27
27
|
return to;
|
|
28
28
|
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
29
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
38
|
var session_exports = {};
|
|
31
39
|
__export(session_exports, {
|
|
@@ -37,6 +45,7 @@ var import_factory = require("../utils/factory");
|
|
|
37
45
|
var import_error = require("../utils/error");
|
|
38
46
|
var import_global = require("../global");
|
|
39
47
|
var import_messages = require("./messages");
|
|
48
|
+
var import_fast_safe_stringify = __toESM(require("fast-safe-stringify"));
|
|
40
49
|
class SessionOrigin {
|
|
41
50
|
/**
|
|
42
51
|
* Api instance of current session.
|
|
@@ -70,13 +79,13 @@ class SessionOrigin {
|
|
|
70
79
|
*/
|
|
71
80
|
async send(message) {
|
|
72
81
|
if (this.type === import_types.MessageScope.GROUP) {
|
|
73
|
-
return
|
|
82
|
+
return this.api.sendGroupMsg(message, this.groupId, this.meta);
|
|
74
83
|
}
|
|
75
84
|
if (this.type === import_types.MessageScope.CHANNEL) {
|
|
76
|
-
return
|
|
85
|
+
return this.api.sendChannelMsg(message, this.guildId, this.channelId, this.meta);
|
|
77
86
|
}
|
|
78
87
|
if (this.type === import_types.MessageScope.PRIVATE) {
|
|
79
|
-
return
|
|
88
|
+
return this.api.sendPrivateMsg(message, this.userId, this.meta);
|
|
80
89
|
}
|
|
81
90
|
return { messageId: "", time: 0 };
|
|
82
91
|
}
|
|
@@ -118,12 +127,13 @@ class SessionOrigin {
|
|
|
118
127
|
async json(message) {
|
|
119
128
|
if (typeof message === "string") return this.send(message);
|
|
120
129
|
if (message && typeof message === "object") {
|
|
121
|
-
const result =
|
|
122
|
-
|
|
123
|
-
return result;
|
|
130
|
+
const result = (0, import_fast_safe_stringify.default)(message, void 0, 2);
|
|
131
|
+
return this.send(result === "{}" ? String(message) : result);
|
|
124
132
|
}
|
|
125
133
|
if (typeof message === "function") {
|
|
126
|
-
return
|
|
134
|
+
return this.send(
|
|
135
|
+
`[${message.toString().slice(0, 5) === "class" ? "class" : "Function"} ${message.name || "(anonymous)"}]`
|
|
136
|
+
);
|
|
127
137
|
}
|
|
128
138
|
return this.send(String(message));
|
|
129
139
|
}
|
package/lib/decorators/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __create = Object.create;
|
|
14
12
|
var __defProp = Object.defineProperty;
|
package/lib/decorators/plugin.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/lib/decorators/utils.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __create = Object.create;
|
|
14
12
|
var __defProp = Object.defineProperty;
|
|
@@ -49,6 +47,7 @@ var import_tsukiko = __toESM(require("tsukiko"));
|
|
|
49
47
|
var import_error = require("../utils/error");
|
|
50
48
|
var import_global = require("../global");
|
|
51
49
|
var import_node_path = require("node:path");
|
|
50
|
+
var import_fast_safe_stringify = __toESM(require("fast-safe-stringify"));
|
|
52
51
|
class Decorators {
|
|
53
52
|
static [import_global.Symbols.decorator] = /* @__PURE__ */ new Map();
|
|
54
53
|
static getMeta(target) {
|
|
@@ -89,8 +88,11 @@ class Decorators {
|
|
|
89
88
|
childCtx.midware(bound(fn, isStatic), options.priority);
|
|
90
89
|
}
|
|
91
90
|
for (const [fn, options, isStatic] of meta.commands) {
|
|
92
|
-
const
|
|
93
|
-
|
|
91
|
+
const oldCmd = childCtx.command(options.template, { ...options, action: bound(fn, isStatic) });
|
|
92
|
+
let cmd = oldCmd;
|
|
93
|
+
for (const option of JSON.parse((0, import_fast_safe_stringify.default)(options.options ?? []))) cmd = cmd.option(option[0], option[1]);
|
|
94
|
+
childCtx[import_global.Symbols.command].delete(oldCmd);
|
|
95
|
+
childCtx[import_global.Symbols.command].add(cmd);
|
|
94
96
|
}
|
|
95
97
|
for (const [fn, options, isStatic] of meta.regexps) {
|
|
96
98
|
childCtx.regexp(options.match, bound(fn, isStatic));
|
package/lib/global/constants.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/lib/global/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
* @Package @kotori-bot/core
|
|
3
|
+
* @Version 1.7.1
|
|
4
|
+
* @Author Arimura Sena <me@hotaru.icu>
|
|
5
|
+
* @Copyright 2024-2025 Hotaru. All rights reserved.
|
|
6
|
+
* @License GPL-3.0
|
|
7
|
+
* @Link https://github.com/kotorijs/kotori
|
|
8
|
+
* @Date 2026/2/14 00:45:33
|
|
9
|
+
*/
|
|
12
10
|
"use strict";
|
|
13
11
|
var __defProp = Object.defineProperty;
|
|
14
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|