@kotori-bot/core 1.7.1 → 1.7.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.
Files changed (71) hide show
  1. package/lib/app/common.d.ts +6 -0
  2. package/lib/app/common.js +2 -2
  3. package/lib/app/config.d.ts +32 -0
  4. package/lib/app/config.js +2 -2
  5. package/lib/app/core.d.ts +139 -0
  6. package/lib/app/core.js +5 -5
  7. package/lib/app/index.d.ts +3 -0
  8. package/lib/app/index.js +2 -2
  9. package/lib/app/message.d.ts +34 -0
  10. package/lib/app/message.js +7 -7
  11. package/lib/components/adapter.d.ts +122 -0
  12. package/lib/components/adapter.js +2 -2
  13. package/lib/components/api.d.ts +420 -0
  14. package/lib/components/api.js +4 -4
  15. package/lib/components/cache.d.ts +37 -0
  16. package/lib/components/cache.js +3 -3
  17. package/lib/components/command.d.ts +153 -0
  18. package/lib/components/command.js +2 -2
  19. package/lib/components/elements.d.ts +144 -0
  20. package/lib/components/elements.js +4 -4
  21. package/lib/components/filter.d.ts +22 -0
  22. package/lib/components/filter.js +2 -2
  23. package/lib/components/index.d.ts +8 -0
  24. package/lib/components/index.js +2 -2
  25. package/lib/components/messages.d.ts +186 -0
  26. package/lib/components/messages.js +2 -2
  27. package/lib/components/session.d.ts +177 -0
  28. package/lib/components/session.js +2 -2
  29. package/lib/decorators/index.d.ts +7 -0
  30. package/lib/decorators/index.js +2 -2
  31. package/lib/decorators/plugin.d.ts +7 -0
  32. package/lib/decorators/plugin.js +2 -2
  33. package/lib/decorators/utils.d.ts +60 -0
  34. package/lib/decorators/utils.js +5 -5
  35. package/lib/global/constants.d.ts +8 -0
  36. package/lib/global/constants.js +2 -2
  37. package/lib/global/index.d.ts +2 -0
  38. package/lib/global/index.js +2 -2
  39. package/lib/global/symbols.d.ts +15 -0
  40. package/lib/global/symbols.js +2 -2
  41. package/lib/index.d.ts +13 -0
  42. package/lib/index.js +16 -16
  43. package/lib/types/adapter.d.ts +22 -0
  44. package/lib/types/adapter.js +2 -2
  45. package/lib/types/api.d.ts +71 -0
  46. package/lib/types/api.js +2 -2
  47. package/lib/types/command.d.ts +78 -0
  48. package/lib/types/command.js +2 -2
  49. package/lib/types/config.d.ts +21 -0
  50. package/lib/types/config.js +2 -2
  51. package/lib/types/events.d.ts +3 -0
  52. package/lib/types/events.js +2 -2
  53. package/lib/types/filter.d.ts +51 -0
  54. package/lib/types/filter.js +2 -2
  55. package/lib/types/index.d.ts +7 -0
  56. package/lib/types/index.js +2 -2
  57. package/lib/types/message.d.ts +176 -0
  58. package/lib/types/message.js +2 -2
  59. package/lib/types/session.d.ts +349 -0
  60. package/lib/types/session.js +2 -2
  61. package/lib/utils/container.d.ts +9 -0
  62. package/lib/utils/container.js +2 -2
  63. package/lib/utils/error.d.ts +49 -0
  64. package/lib/utils/error.js +2 -2
  65. package/lib/utils/factory.d.ts +12 -0
  66. package/lib/utils/factory.js +2 -2
  67. package/lib/utils/internal.d.ts +46 -0
  68. package/lib/utils/internal.js +2 -2
  69. package/lib/utils/jsx.d.ts +57 -0
  70. package/lib/utils/jsx.js +5 -4
  71. package/package.json +3 -3
@@ -0,0 +1,46 @@
1
+ import 'reflect-metadata';
2
+ import type { CronJob } from 'cron';
3
+ import type { IdentityType } from 'fluoro';
4
+ import type { Command } from '../components';
5
+ import type { MidwareCallback, OptsOrigin, RegexpCallback, TaskOptions } from '../types';
6
+ export declare function cancelFactory(): {
7
+ get(): () => void;
8
+ fn(): void;
9
+ value: boolean;
10
+ };
11
+ type CommandOriginData = Command<any, OptsOrigin>['meta'];
12
+ interface CommandMeta extends CommandOriginData {
13
+ identity?: IdentityType;
14
+ }
15
+ interface MidwareMeta {
16
+ identity?: IdentityType;
17
+ priority: number;
18
+ }
19
+ interface RegExpMeta {
20
+ identity?: IdentityType;
21
+ match: RegExp;
22
+ }
23
+ interface TaskMeta {
24
+ identity?: IdentityType;
25
+ task: CronJob;
26
+ options: TaskOptions;
27
+ }
28
+ export declare function getCommandMeta(command: Command<any, any>): CommandMeta | undefined;
29
+ export declare function setCommandMeta(command: Command<any, any>, meta: CommandMeta): void;
30
+ export declare function getMidwareMeta(callback: MidwareCallback): MidwareMeta | undefined;
31
+ export declare function setMidwareMeta(callback: MidwareCallback, meta: MidwareMeta): void;
32
+ export declare function getRegExpMeta(callback: RegexpCallback): RegExpMeta | undefined;
33
+ export declare function setRegExpMeta(callback: RegexpCallback, meta: RegExpMeta): void;
34
+ export declare function getTaskMeta(task: CronJob): TaskMeta | undefined;
35
+ export declare function setTaskMeta(task: CronJob, meta: TaskMeta): void;
36
+ declare const _default: {
37
+ getCommandMeta: typeof getCommandMeta;
38
+ setCommandMeta: typeof setCommandMeta;
39
+ getMidwareMeta: typeof getMidwareMeta;
40
+ setMidwareMeta: typeof setMidwareMeta;
41
+ getRegExpMeta: typeof getRegExpMeta;
42
+ setRegExpMeta: typeof setRegExpMeta;
43
+ getTaskMeta: typeof getTaskMeta;
44
+ setTaskMeta: typeof setTaskMeta;
45
+ };
46
+ export default _default;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/core
3
- * @Version 1.7.1
3
+ * @Version 1.7.2
4
4
  * @Author Arimura Sena <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 00:45:33
8
+ * @Date 2026/2/14 15:50:13
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -0,0 +1,57 @@
1
+ declare global {
2
+ namespace JSX {
3
+ type Node = string | number | boolean | null | Element | Node[];
4
+ type Element = import('../components/messages').MessageList<keyof import('../types/message').MessageMapping> | import('../components/messages').MessageSingle<keyof import('../types/message').MessageMapping>;
5
+ interface ElementAttributesProperty {
6
+ props: any;
7
+ }
8
+ interface ElementChildrenAttribute {
9
+ children: unknown;
10
+ }
11
+ interface IntrinsicElements {
12
+ text: {
13
+ children: string;
14
+ };
15
+ br: never;
16
+ image: {
17
+ src: string;
18
+ };
19
+ reply: {
20
+ messageId: string;
21
+ };
22
+ mention: {
23
+ userId: string;
24
+ };
25
+ mentionAll: never;
26
+ video: {
27
+ src: string;
28
+ };
29
+ audio: {
30
+ src: string;
31
+ };
32
+ voice: {
33
+ src: string;
34
+ };
35
+ file: {
36
+ src: string;
37
+ };
38
+ location: {
39
+ latitude: number;
40
+ longitude: number;
41
+ title: string;
42
+ content: string;
43
+ };
44
+ seg: {
45
+ children: Node;
46
+ };
47
+ format: {
48
+ template: string;
49
+ children: Element[] | Element;
50
+ };
51
+ }
52
+ }
53
+ }
54
+ declare const Fragment: unique symbol;
55
+ export declare function hTs(type: string | typeof Fragment | ((props: Record<string, unknown>) => JSX.Element), props: Record<string, unknown>, ...children: any[]): JSX.Element;
56
+ export declare function hRes(type: string, props: Record<string, unknown>): JSX.Element;
57
+ export {};
package/lib/utils/jsx.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package @kotori-bot/core
3
- * @Version 1.7.1
3
+ * @Version 1.7.2
4
4
  * @Author Arimura Sena <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/2/14 00:45:33
8
+ * @Date 2026/2/14 15:50:13
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -31,8 +31,8 @@ __export(jsx_exports, {
31
31
  hTs: () => hTs
32
32
  });
33
33
  module.exports = __toCommonJS(jsx_exports);
34
- var import_factory = require("../utils/factory");
35
34
  var import_messages = require("../components/messages");
35
+ var import_factory = require("../utils/factory");
36
36
  const Fragment = Symbol("Fragment");
37
37
  function hTs(type, props, ...children) {
38
38
  if (type === Fragment) return hTs("list", props, ...children);
@@ -55,7 +55,7 @@ function hTs(type, props, ...children) {
55
55
  return import_messages.Messages.video(props.src);
56
56
  case "file":
57
57
  return import_messages.Messages.file(props.src);
58
- case "location":
58
+ case "location": {
59
59
  const locationProps = props;
60
60
  return import_messages.Messages.location(
61
61
  locationProps.latitude,
@@ -63,6 +63,7 @@ function hTs(type, props, ...children) {
63
63
  locationProps.title,
64
64
  locationProps.content
65
65
  );
66
+ }
66
67
  case "seg":
67
68
  return (0, import_messages.Messages)(
68
69
  ...flattenedChildren.map(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kotori-bot/core",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Kotori Core",
5
5
  "main": "lib/index.js",
6
6
  "license": "GPL-3.0",
@@ -30,8 +30,8 @@
30
30
  "reflect-metadata": "^0.2.2",
31
31
  "tsukiko": "^1.4.2",
32
32
  "@kotori-bot/i18n": "^1.3.3",
33
- "fluoro": "^1.1.1",
34
- "@kotori-bot/tools": "^1.5.2"
33
+ "@kotori-bot/tools": "^1.5.2",
34
+ "fluoro": "^1.1.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/minimist": "^1.2.5"