alemonjs 2.1.41 → 2.1.43

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 (88) hide show
  1. package/lib/app/define/define-children.d.ts +8 -0
  2. package/lib/app/define/define-children.js +25 -0
  3. package/lib/app/define/define-middleware.d.ts +2 -0
  4. package/lib/app/define/define-middleware.js +8 -0
  5. package/lib/app/define/define-platform.d.ts +13 -0
  6. package/lib/app/define/define-platform.js +40 -0
  7. package/lib/app/define/define-response.d.ts +2 -0
  8. package/lib/app/define/define-response.js +8 -0
  9. package/lib/app/define/define-router.d.ts +17 -0
  10. package/lib/app/define/define-router.js +34 -0
  11. package/lib/app/event/event-group.d.ts +9 -0
  12. package/lib/app/event/event-group.js +29 -0
  13. package/lib/app/event/event-middleware.d.ts +23 -0
  14. package/lib/app/event/event-middleware.js +44 -0
  15. package/lib/app/event/event-response.d.ts +16 -0
  16. package/lib/app/event/event-response.js +23 -0
  17. package/lib/app/event/event-selects.d.ts +13 -0
  18. package/lib/app/event/event-selects.js +15 -0
  19. package/lib/app/event-processor/event-processor-callHandler.d.ts +1 -0
  20. package/lib/app/event-processor/event-processor-callHandler.js +43 -0
  21. package/lib/app/event-processor/event-processor-cycle.d.ts +14 -0
  22. package/lib/app/event-processor/event-processor-cycle.js +97 -0
  23. package/lib/app/event-processor/event-processor-cycleFiles.d.ts +11 -0
  24. package/lib/app/event-processor/event-processor-cycleFiles.js +147 -0
  25. package/lib/app/event-processor/event-processor-cycleRoute.d.ts +10 -0
  26. package/lib/app/event-processor/event-processor-cycleRoute.js +133 -0
  27. package/lib/app/event-processor/event-processor-event.d.ts +24 -0
  28. package/lib/app/event-processor/event-processor-event.js +41 -0
  29. package/lib/app/event-processor/event-processor-middleware.d.ts +14 -0
  30. package/lib/app/event-processor/event-processor-middleware.js +31 -0
  31. package/lib/app/event-processor/event-processor-subscribe.d.ts +35 -0
  32. package/lib/app/event-processor/event-processor-subscribe.js +115 -0
  33. package/lib/app/event-processor/event-processor.d.ts +17 -0
  34. package/lib/app/event-processor/event-processor.js +207 -0
  35. package/lib/app/hook-use/hook-use-api.d.ts +6 -0
  36. package/lib/app/hook-use/hook-use-api.js +22 -0
  37. package/lib/app/hook-use/hook-use-channel.d.ts +8 -0
  38. package/lib/app/hook-use/hook-use-channel.js +33 -0
  39. package/lib/app/hook-use/hook-use-client.d.ts +7 -0
  40. package/lib/app/hook-use/hook-use-client.js +27 -0
  41. package/lib/app/hook-use/hook-use-me.d.ts +8 -0
  42. package/lib/app/hook-use/hook-use-me.js +45 -0
  43. package/lib/app/hook-use/hook-use-menber.d.ts +8 -0
  44. package/lib/app/hook-use/hook-use-menber.js +59 -0
  45. package/lib/app/hook-use/hook-use-mention.d.ts +23 -0
  46. package/lib/app/hook-use/hook-use-mention.js +105 -0
  47. package/lib/app/hook-use/hook-use-message.d.ts +29 -0
  48. package/lib/app/hook-use/hook-use-message.js +88 -0
  49. package/lib/app/hook-use/hook-use-state.d.ts +30 -0
  50. package/lib/app/hook-use/hook-use-state.js +101 -0
  51. package/lib/app/hook-use/hook-use-subscribe.d.ts +46 -0
  52. package/lib/app/hook-use/hook-use-subscribe.js +143 -0
  53. package/lib/app/hook-use-api.d.ts +1 -3
  54. package/lib/app/hook-use-api.js +3 -3
  55. package/lib/app/index.js +1 -1
  56. package/lib/app/message/message-api.d.ts +69 -0
  57. package/lib/app/message/message-api.js +105 -0
  58. package/lib/app/message/message-format-old.d.ts +143 -0
  59. package/lib/app/message/message-format-old.js +359 -0
  60. package/lib/app/message/message-format.d.ts +215 -0
  61. package/lib/app/message/message-format.js +382 -0
  62. package/lib/app/message-api.d.ts +13 -0
  63. package/lib/app/message-api.js +45 -1
  64. package/lib/app/message-format.old.d.ts +50 -0
  65. package/lib/app/message-format.old.js +217 -0
  66. package/lib/cbp/connects/platform.js +3 -3
  67. package/lib/cbp/processor/actions.js +5 -4
  68. package/lib/cbp/processor/api.js +5 -4
  69. package/lib/cbp/processor/handle.d.ts +3 -0
  70. package/lib/cbp/processor/handle.js +32 -0
  71. package/lib/core/index.js +1 -1
  72. package/lib/core/utils.d.ts +1 -0
  73. package/lib/core/utils.js +5 -1
  74. package/lib/index.js +2 -2
  75. package/lib/jsx/index.d.ts +105 -0
  76. package/lib/jsx/index.js +211 -0
  77. package/lib/jsx/jsx-dev-runtime.d.ts +2 -0
  78. package/lib/jsx/jsx-dev-runtime.js +1 -0
  79. package/lib/jsx/jsx-runtime.d.ts +18 -0
  80. package/lib/jsx/jsx-runtime.js +24 -0
  81. package/lib/process/client.js +109 -0
  82. package/lib/process/direct-channel.js +3 -1
  83. package/lib/process/ipc-bridge.js +10 -4
  84. package/lib/store/SinglyLinkedList.d.ts +22 -0
  85. package/lib/store/SinglyLinkedList.js +97 -0
  86. package/lib/store/store.d.ts +127 -0
  87. package/lib/store/store.js +443 -0
  88. package/package.json +1 -1
@@ -0,0 +1,143 @@
1
+ import { ResultCode } from '../../core/variable.js';
2
+ import { SubscribeList } from '../../store/store.js';
3
+ import { SubscribeStatus } from '../config.js';
4
+
5
+ /**
6
+ * 订阅事件
7
+ * @param event
8
+ * @param select
9
+ * @returns
10
+ */
11
+ const useSubscribe = (event, selects) => {
12
+ // 检查参数
13
+ if (typeof event !== 'object') {
14
+ logger.error({
15
+ code: ResultCode.FailParams,
16
+ message: 'event is not object',
17
+ data: null
18
+ });
19
+ throw new Error('event is not object');
20
+ }
21
+ if (typeof selects !== 'string' && !Array.isArray(selects)) {
22
+ logger.error({
23
+ code: ResultCode.FailParams,
24
+ message: 'select is not string or array',
25
+ data: null
26
+ });
27
+ throw new Error('select is not string or array');
28
+ }
29
+ /**
30
+ * 运行订阅
31
+ * @param callback
32
+ * @param keys
33
+ * @param choose
34
+ * @returns
35
+ */
36
+ const register = (callback, keys, choose) => {
37
+ const curSelects = Array.isArray(selects) ? selects : [selects];
38
+ // 分配id
39
+ const ID = Date.now().toString(36) + Math.random().toString(36).substring(2, 15);
40
+ // 没有选择任何 key,无法绑定订阅
41
+ if (keys.length === 0) {
42
+ logger.warn({
43
+ code: ResultCode.FailParams,
44
+ message: 'subscribe keys is empty',
45
+ data: null
46
+ });
47
+ return { selects: curSelects, choose, id: ID };
48
+ }
49
+ // 创建 订阅 列表
50
+ for (const select of curSelects) {
51
+ const subList = new SubscribeList(choose, select);
52
+ // 只能选择基础数据类型的key
53
+ const values = {};
54
+ for (const key of keys) {
55
+ if (typeof key === 'string' && (typeof event[key] === 'string' || typeof event[key] === 'number' || typeof event[key] === 'boolean')) {
56
+ values[key] = event[key];
57
+ }
58
+ else {
59
+ logger.warn({
60
+ code: ResultCode.FailParams,
61
+ message: `Invalid key: ${key?.toString()} must be a string, number or boolean`,
62
+ data: null
63
+ });
64
+ }
65
+ }
66
+ subList.value.append({
67
+ choose,
68
+ selects: curSelects,
69
+ keys: values,
70
+ current: callback,
71
+ status: SubscribeStatus.active,
72
+ id: ID
73
+ });
74
+ }
75
+ return {
76
+ selects: curSelects,
77
+ choose,
78
+ id: ID
79
+ };
80
+ };
81
+ /**
82
+ * res 创建时 运行订阅
83
+ * @param callback
84
+ * @param keys
85
+ */
86
+ const create = (callback, keys) => {
87
+ return register(callback, keys, 'create');
88
+ };
89
+ /**
90
+ * res 挂载时 运行订阅
91
+ * @param callback
92
+ * @param keys
93
+ */
94
+ const mountBefore = (callback, keys) => {
95
+ return register(callback, keys, 'mount');
96
+ };
97
+ /**
98
+ * res 卸载时 运行订阅
99
+ * @param callback
100
+ * @param keys
101
+ */
102
+ const unmount = (callback, keys) => {
103
+ return register(callback, keys, 'unmount');
104
+ };
105
+ /**
106
+ * 清除订阅
107
+ * @param id
108
+ */
109
+ const cancel = (value) => {
110
+ const selects = value.selects;
111
+ const ID = value.id; // 订阅的 ID
112
+ for (const select of selects) {
113
+ const subList = new SubscribeList(value.choose, select);
114
+ subList.value.forEach(node => {
115
+ if (node.data.id === ID) {
116
+ node.data.status = SubscribeStatus.paused; // 标记为已暂停
117
+ return true; // break
118
+ }
119
+ });
120
+ }
121
+ };
122
+ const subscribe = {
123
+ create,
124
+ mount: mountBefore,
125
+ unmount,
126
+ cancel
127
+ };
128
+ return [subscribe];
129
+ };
130
+ /**
131
+ * 使用观察者模式订阅事件
132
+ * @param event
133
+ * @param selects
134
+ * @returns
135
+ * 废弃,请使用 useSubscribe
136
+ * @deprecated
137
+ */
138
+ const useObserver = (event, selects) => {
139
+ const [subscribe] = useSubscribe(event, selects);
140
+ return [subscribe.mount, subscribe.cancel];
141
+ };
142
+
143
+ export { useObserver, useSubscribe };
@@ -19,9 +19,8 @@ export declare const useMention: <T extends EventKeys>(event: Events[T]) => [{
19
19
  export declare const useMessage: <T extends EventKeys>(event: Events[T]) => readonly [{
20
20
  send(params?: {
21
21
  format: Format | DataEnums[];
22
- } | DataEnums[], param2?: {
23
22
  replyId?: string;
24
- }): Promise<Result[]>;
23
+ } | DataEnums[]): Promise<Result[]>;
25
24
  }];
26
25
  export declare const useMember: <T extends EventKeys>(event: Events[T]) => readonly [{
27
26
  information: (params: {
@@ -32,7 +31,6 @@ export declare const useChannel: <T extends EventKeys>(event: Events[T]) => read
32
31
  export declare const useSend: <T extends EventKeys>(event: Events[T]) => (...val: DataEnums[]) => Promise<Result[]>;
33
32
  export declare const useSends: <T extends EventKeys>(event: Events[T]) => readonly [(params?: DataEnums[] | {
34
33
  format: Format | DataEnums[];
35
- }, param2?: {
36
34
  replyId?: string;
37
35
  }) => Promise<Result[]>];
38
36
  export declare const unChildren: (name?: string) => void;
@@ -125,11 +125,11 @@ const useMessage = (event) => {
125
125
  return Array.isArray(result) ? result : [result];
126
126
  };
127
127
  const lightweight = {
128
- send(params, param2) {
128
+ send(params) {
129
129
  if (Array.isArray(params)) {
130
- return sendRaw(params.length > 0 ? params : [], param2?.replyId ?? event.MessageId);
130
+ return sendRaw(params.length > 0 ? params : []);
131
131
  }
132
- return sendRaw(resolveFormat(params), param2?.replyId ?? event.MessageId);
132
+ return sendRaw(resolveFormat(params), params?.replyId ?? event.MessageId);
133
133
  }
134
134
  };
135
135
  return [lightweight];
package/lib/app/index.js CHANGED
@@ -17,6 +17,6 @@ export { expendSubscribe, expendSubscribeCreate, expendSubscribeMount, expendSub
17
17
  export { createSelects, onSelects, unChildren, useChannel, useClient, useMe, useMember, useMention, useMessage, useSend, useSends } from './hook-use-api.js';
18
18
  export { onState, unState, useState } from './hook-use-state.js';
19
19
  export { useObserver, useSubscribe } from './hook-use-subscribe.js';
20
- export { createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser } from './message-api.js';
20
+ export { MessageDirect, createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser } from './message-api.js';
21
21
  export { Format, FormatButtonGroup, FormatMarkDown, createEvent } from './message-format.js';
22
22
  export { Attachment, Audio, BT, Button, Image, ImageFile, ImageURL, Link, MD, Markdown, MarkdownOriginal, Mention, Text, Video } from './message-format-old.js';
@@ -0,0 +1,69 @@
1
+ import { DataEnums, OnDataFormatFunc } from '../../types';
2
+ import { Result } from '../../core/utils';
3
+ type BaseMap = {
4
+ [key: string]: unknown;
5
+ };
6
+ /**
7
+ * 创建原生value映射
8
+ * @param event
9
+ * @returns
10
+ */
11
+ export declare const createEventValue: <T extends keyof R, R extends BaseMap>(event: {
12
+ value: R[T];
13
+ }) => R[T];
14
+ /**
15
+ * 创建数据格式。
16
+ * @param {...DataEnums[]} data - 要格式化的数据。
17
+ * @returns {DataEnums[]} - 返回格式化后的数据数组。
18
+ * @throws {Error} - 如果 data 无效,抛出错误。
19
+ */
20
+ export declare const format: OnDataFormatFunc;
21
+ /**
22
+ * 创建数据格式。
23
+ * @param {...DataEnums[]} data - 要格式化的数据。
24
+ * @returns {DataEnums[]} - 返回格式化后的数据数组。
25
+ * @throws {Error} - 如果 data 无效,抛出错误。
26
+ * 废弃,请使用 format
27
+ * @deprecated
28
+ */
29
+ export declare const createDataFormat: OnDataFormatFunc;
30
+ /**
31
+ * 向指定频道发送消息。
32
+ * @param {string} SpaceId - 空间ID,可能是服务器ID、频道ID、群ID、聊天ID,或者是复合ID。总之,是框架给指定空间的唯一标识。也就是说,不能使用ChannelId作为该参数。
33
+ * @param {DataEnums[]} data - 要发送的数据。
34
+ * @throws {Error} - 如果 SpaceId 无效或发送失败,抛出错误。
35
+ */
36
+ export declare const sendToChannel: (SpaceId: string, data: DataEnums[]) => Promise<Result[]>;
37
+ /**
38
+ * 向指定用户发送消息。
39
+ * @param {string} OpenID - 开放ID,可能是用户ID、聊天ID,或是复合ID。总之,是框架给指定用户的唯一标识。也就说,不能使用UserId作为该参数。
40
+ * @param {DataEnums[]} data - 要发送的数据。
41
+ * @throws {Error} - 如果 user_id 无效或发送失败,抛出错误。
42
+ */
43
+ export declare const sendToUser: (OpenID: string, data: DataEnums[]) => Promise<Result[]>;
44
+ type IntentResult = {
45
+ [key: string]: boolean | number;
46
+ maxImageCount?: number;
47
+ maxImageSize?: number;
48
+ maxTextLength?: number;
49
+ maxMarkdownLength?: number;
50
+ allowMarkdownLink?: boolean;
51
+ allowMarkdownImage?: boolean;
52
+ allowMarkdownMention?: boolean;
53
+ maxFileCount?: number;
54
+ maxFileSize?: number;
55
+ maxVideoCount?: number;
56
+ maxVideoSize?: number;
57
+ allowButton?: boolean;
58
+ allowMixImageText?: boolean;
59
+ allowMixMarkdownButton?: boolean;
60
+ };
61
+ /**
62
+ * 得到消息意图。
63
+ * 用于多平台下的降级消费。
64
+ * @param event
65
+ * @param data
66
+ * @returns
67
+ */
68
+ export declare const getMessageIntent: () => Promise<Result<IntentResult>>;
69
+ export {};
@@ -0,0 +1,105 @@
1
+ import { ResultCode } from '../../core/variable.js';
2
+ import { sendAction } from '../../cbp/processor/actions.js';
3
+ import { createResult } from '../../core/utils.js';
4
+
5
+ /**
6
+ * 创建原生value映射
7
+ * @param event
8
+ * @returns
9
+ */
10
+ const createEventValue = (event) => {
11
+ return event.value;
12
+ };
13
+ /**
14
+ * 创建数据格式。
15
+ * @param {...DataEnums[]} data - 要格式化的数据。
16
+ * @returns {DataEnums[]} - 返回格式化后的数据数组。
17
+ * @throws {Error} - 如果 data 无效,抛出错误。
18
+ */
19
+ const format = (...data) => {
20
+ if (!data || data.length === 0) {
21
+ logger.error({
22
+ code: ResultCode.FailParams,
23
+ message: 'Invalid data: data cannot be empty',
24
+ data: null
25
+ });
26
+ throw new Error('Invalid data: data cannot be empty');
27
+ }
28
+ return data;
29
+ };
30
+ global.format = format;
31
+ /**
32
+ * 创建数据格式。
33
+ * @param {...DataEnums[]} data - 要格式化的数据。
34
+ * @returns {DataEnums[]} - 返回格式化后的数据数组。
35
+ * @throws {Error} - 如果 data 无效,抛出错误。
36
+ * 废弃,请使用 format
37
+ * @deprecated
38
+ */
39
+ const createDataFormat = format;
40
+ /**
41
+ * 向指定频道发送消息。
42
+ * @param {string} SpaceId - 空间ID,可能是服务器ID、频道ID、群ID、聊天ID,或者是复合ID。总之,是框架给指定空间的唯一标识。也就是说,不能使用ChannelId作为该参数。
43
+ * @param {DataEnums[]} data - 要发送的数据。
44
+ * @throws {Error} - 如果 SpaceId 无效或发送失败,抛出错误。
45
+ */
46
+ const sendToChannel = async (SpaceId, data) => {
47
+ if (!SpaceId || typeof SpaceId !== 'string') {
48
+ logger.error({
49
+ code: ResultCode.FailParams,
50
+ message: 'Invalid SpaceId: SpaceId must be a string',
51
+ data: null
52
+ });
53
+ throw new Error('Invalid SpaceId: SpaceId must be a string');
54
+ }
55
+ return await sendAction({
56
+ action: 'message.send.channel',
57
+ payload: {
58
+ ChannelId: SpaceId,
59
+ params: {
60
+ format: data
61
+ }
62
+ }
63
+ });
64
+ };
65
+ /**
66
+ * 向指定用户发送消息。
67
+ * @param {string} OpenID - 开放ID,可能是用户ID、聊天ID,或是复合ID。总之,是框架给指定用户的唯一标识。也就说,不能使用UserId作为该参数。
68
+ * @param {DataEnums[]} data - 要发送的数据。
69
+ * @throws {Error} - 如果 user_id 无效或发送失败,抛出错误。
70
+ */
71
+ const sendToUser = async (OpenID, data) => {
72
+ if (!OpenID || typeof OpenID !== 'string') {
73
+ logger.error({
74
+ code: ResultCode.FailParams,
75
+ message: 'Invalid OpenID: OpenID must be a string',
76
+ data: null
77
+ });
78
+ throw new Error('Invalid OpenID: OpenID must be a string');
79
+ }
80
+ return await sendAction({
81
+ action: 'message.send.user',
82
+ payload: {
83
+ UserId: OpenID,
84
+ params: {
85
+ format: data
86
+ }
87
+ }
88
+ });
89
+ };
90
+ /**
91
+ * 得到消息意图。
92
+ * 用于多平台下的降级消费。
93
+ * @param event
94
+ * @param data
95
+ * @returns
96
+ */
97
+ const getMessageIntent = async () => {
98
+ const results = await sendAction({
99
+ action: 'message.intent',
100
+ payload: {}
101
+ });
102
+ return createResult(ResultCode.Ok, '获取成功', results[0]?.data ?? null);
103
+ };
104
+
105
+ export { createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser };
@@ -0,0 +1,143 @@
1
+ import { DataMention, DataImage, DataText, DataImageURL, DataImageFile, DataButtonRow, DataButtonGroup, DataButton, DataMarkDown, DataMarkdownTitle, DataMarkdownSubtitle, DataMarkdownBold, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownStrikethrough, DataMarkdownLink, DataMarkdownImage, DataMarkdownList, DataMarkdownListItem, DataMarkdownBlockquote, DataMarkdownDivider, DataMarkdownNewline, DataLink, DataMarkdownText, DataMarkdownCode, DataMarkdownOriginal, DataAttachment, DataAudio, DataVideo, DataMarkdownMention, DataMarkdownContent, DataMarkdownButton } from '../../types';
2
+ /**
3
+ * 文本消息
4
+ * @param val
5
+ * @param options
6
+ * @returns
7
+ */
8
+ export declare const Text: (val: DataText["value"], options?: DataText["options"]) => DataText;
9
+ /**
10
+ * 链接消息
11
+ * @deprecated 废弃,这个应该是md语法里的
12
+ * @param val 要显示的文本
13
+ * @param options 内容选项
14
+ * @returns
15
+ */
16
+ export declare const Link: (val: DataLink["value"], options?: DataText["options"]) => DataText;
17
+ /**
18
+ * 图片链接,http 或 https 开头
19
+ * @deprecated 废弃,推荐使用 Image
20
+ * @param val
21
+ * @returns
22
+ */
23
+ export declare const ImageURL: (val: DataImageURL["value"]) => DataImageURL;
24
+ /**
25
+ * 本地图片文件
26
+ * @deprecated 废弃,推荐使用 Image
27
+ * @param val
28
+ * @returns
29
+ */
30
+ export declare const ImageFile: (val: DataImageFile["value"]) => DataImageFile;
31
+ /**
32
+ * 图片消息
33
+ * @param val Buffer 或带协议的字符串(https:// | http:// | file:// | base64://)
34
+ * @returns
35
+ */
36
+ declare const Image: {
37
+ (val: Buffer | string): DataImage;
38
+ /**
39
+ * @deprecated 废弃,推荐使用 Image
40
+ */
41
+ url: (val: DataImageURL["value"]) => DataImageURL;
42
+ /**
43
+ * @deprecated 废弃,推荐使用 Image
44
+ */
45
+ file: (val: DataImageFile["value"]) => DataImageFile;
46
+ };
47
+ export { Image };
48
+ /**
49
+ * 提及
50
+ * @param UserId 默认 @ 所有人
51
+ * @param options 默认 user
52
+ * @returns
53
+ */
54
+ export declare const Mention: (UserId?: DataMention["value"], options?: DataMention["options"]) => DataMention;
55
+ export declare const Button: {
56
+ (title: string, data: DataButton["options"]["data"], options?: Omit<DataButton["options"], "data">): DataButton;
57
+ group: (...rows: DataButtonRow[]) => DataButtonGroup;
58
+ row: (...buttons: DataButton[]) => DataButtonRow;
59
+ };
60
+ export declare const BT: {
61
+ (title: string, data: DataButton["options"]["data"], options?: Omit<DataButton["options"], "data">): DataButton;
62
+ group: (...rows: DataButtonRow[]) => DataButtonGroup;
63
+ row: (...buttons: DataButton[]) => DataButtonRow;
64
+ };
65
+ /**
66
+ *
67
+ * @param values 要显示的文本
68
+ * @returns
69
+ */
70
+ declare const Markdown: {
71
+ (...values: DataMarkDown["value"]): DataMarkDown;
72
+ text(text: string): DataMarkdownText;
73
+ mention(uid?: string, options?: DataMarkdownMention["options"]): DataMarkdownMention;
74
+ button(title: string, data: DataMarkdownButton["options"]): DataMarkdownButton;
75
+ content(text: string): DataMarkdownContent;
76
+ title(text: string): DataMarkdownTitle;
77
+ subtitle(text: string): DataMarkdownSubtitle;
78
+ bold(text: string): DataMarkdownBold;
79
+ italic(text: string): DataMarkdownItalic;
80
+ italicStar(text: string): DataMarkdownItalicStar;
81
+ strikethrough(text: string): DataMarkdownStrikethrough;
82
+ link(text: string, url: string): DataMarkdownLink;
83
+ image(url: string, options?: {
84
+ width?: number;
85
+ height?: number;
86
+ }): DataMarkdownImage;
87
+ list(...items: any[]): DataMarkdownList;
88
+ listItem(indexOrText: number | string, text?: string): DataMarkdownListItem;
89
+ blockquote(text: string): DataMarkdownBlockquote;
90
+ divider(): DataMarkdownDivider;
91
+ newline(value?: boolean): DataMarkdownNewline;
92
+ code(value: DataMarkdownCode["value"], options?: DataMarkdownCode["options"]): DataMarkdownCode;
93
+ };
94
+ export declare const MD: {
95
+ (...values: DataMarkDown["value"]): DataMarkDown;
96
+ text(text: string): DataMarkdownText;
97
+ mention(uid?: string, options?: DataMarkdownMention["options"]): DataMarkdownMention;
98
+ button(title: string, data: DataMarkdownButton["options"]): DataMarkdownButton;
99
+ content(text: string): DataMarkdownContent;
100
+ title(text: string): DataMarkdownTitle;
101
+ subtitle(text: string): DataMarkdownSubtitle;
102
+ bold(text: string): DataMarkdownBold;
103
+ italic(text: string): DataMarkdownItalic;
104
+ italicStar(text: string): DataMarkdownItalicStar;
105
+ strikethrough(text: string): DataMarkdownStrikethrough;
106
+ link(text: string, url: string): DataMarkdownLink;
107
+ image(url: string, options?: {
108
+ width?: number;
109
+ height?: number;
110
+ }): DataMarkdownImage;
111
+ list(...items: any[]): DataMarkdownList;
112
+ listItem(indexOrText: number | string, text?: string): DataMarkdownListItem;
113
+ blockquote(text: string): DataMarkdownBlockquote;
114
+ divider(): DataMarkdownDivider;
115
+ newline(value?: boolean): DataMarkdownNewline;
116
+ code(value: DataMarkdownCode["value"], options?: DataMarkdownCode["options"]): DataMarkdownCode;
117
+ };
118
+ export { Markdown };
119
+ /**
120
+ * 纯 Markdown 文本
121
+ * @param val 原始 Markdown 字符串
122
+ * @returns
123
+ */
124
+ export declare const MarkdownOriginal: (val: string) => DataMarkdownOriginal;
125
+ /**
126
+ * 附件消息
127
+ * @param val 带协议的字符串(https:// | http:// | file:// | base64://)
128
+ * @param options 附件选项
129
+ * @returns
130
+ */
131
+ export declare const Attachment: (val: string, options?: DataAttachment["options"]) => DataAttachment;
132
+ /**
133
+ * 音频消息
134
+ * @param val 带协议的字符串(https:// | http:// | file:// | base64://)
135
+ * @returns
136
+ */
137
+ export declare const Audio: (val: string) => DataAudio;
138
+ /**
139
+ * 视频消息
140
+ * @param val 带协议的字符串(https:// | http:// | file:// | base64://)
141
+ * @returns
142
+ */
143
+ export declare const Video: (val: string) => DataVideo;