alemonjs 2.1.0-alpha.2 → 2.1.0-alpha.21

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 (60) hide show
  1. package/README.md +85 -25
  2. package/lib/app/event-group.d.ts +11 -0
  3. package/lib/app/event-group.js +28 -0
  4. package/lib/app/event-middleware.d.ts +10 -2
  5. package/lib/app/event-middleware.js +11 -1
  6. package/lib/app/event-processor-event.js +1 -1
  7. package/lib/app/event-processor-middleware.js +1 -1
  8. package/lib/app/event-processor.js +1 -1
  9. package/lib/app/event-response.d.ts +10 -2
  10. package/lib/app/event-response.js +12 -1
  11. package/lib/app/hook-use-api.d.ts +19 -24
  12. package/lib/app/hook-use-api.js +136 -117
  13. package/lib/app/hook-use-subscribe.d.ts +20 -3
  14. package/lib/app/hook-use-subscribe.js +13 -1
  15. package/lib/app/load.js +10 -14
  16. package/lib/app/message-api.d.ts +28 -8
  17. package/lib/app/message-api.js +31 -14
  18. package/lib/app/message-format.d.ts +5 -12
  19. package/lib/app/message-format.js +16 -7
  20. package/lib/app/store.js +4 -3
  21. package/lib/cbp/actions.js +11 -7
  22. package/lib/cbp/api.js +37 -0
  23. package/lib/cbp/config.js +8 -2
  24. package/lib/cbp/connect.d.ts +6 -2
  25. package/lib/cbp/connect.js +213 -30
  26. package/lib/cbp/index.js +53 -6
  27. package/lib/{app → core}/utils.d.ts +2 -3
  28. package/lib/{app → core}/utils.js +3 -4
  29. package/lib/core/variable.js +7 -1
  30. package/lib/global.d.ts +18 -1
  31. package/lib/index.d.ts +11 -10
  32. package/lib/index.js +7 -7
  33. package/lib/main.js +6 -5
  34. package/lib/typing/actions.d.ts +1 -1
  35. package/lib/typing/apis.d.ts +18 -0
  36. package/lib/typing/client/index.d.ts +1 -1
  37. package/lib/typing/event/base/expansion.d.ts +5 -0
  38. package/lib/typing/event/base/guild.d.ts +4 -0
  39. package/lib/typing/event/base/user.d.ts +4 -0
  40. package/lib/typing/event/channal/index.d.ts +3 -2
  41. package/lib/typing/event/guild/index.d.ts +3 -2
  42. package/lib/typing/event/index.d.ts +13 -1
  43. package/lib/typing/event/interaction/index.d.ts +3 -2
  44. package/lib/typing/event/map.d.ts +0 -2
  45. package/lib/typing/event/member/index.d.ts +3 -2
  46. package/lib/typing/event/message/message.d.ts +6 -5
  47. package/lib/typing/event/message/private.message.d.ts +4 -3
  48. package/lib/typing/event/request/index.d.ts +3 -2
  49. package/lib/typing/message/button.d.ts +6 -5
  50. package/lib/typing/message/index.d.ts +4 -4
  51. package/lib/typing/message/markdown.d.ts +13 -3
  52. package/lib/utils.d.ts +80 -0
  53. package/lib/utils.js +203 -0
  54. package/package.json +12 -3
  55. package/lib/app/define-bot.d.ts +0 -17
  56. package/lib/app/define-bot.js +0 -39
  57. package/lib/cbp/index.d.ts +0 -32
  58. package/lib/cbp/message.js +0 -9
  59. package/lib/jsx.d.ts +0 -142
  60. package/lib/jsx.js +0 -234
package/lib/utils.js ADDED
@@ -0,0 +1,203 @@
1
+ import { writeFile, existsSync, createReadStream } from 'fs';
2
+ import axios from 'axios';
3
+ import { toDataURL } from 'qrcode';
4
+ import { isReadable, Readable } from 'node:stream';
5
+ import { basename } from 'path';
6
+ import { fileTypeFromBuffer, fileTypeFromStream } from 'file-type';
7
+ import { publicIp } from 'public-ip';
8
+
9
+ /**
10
+ * 通过URL获取Buffer
11
+ * @param url
12
+ * @returns
13
+ */
14
+ const getBufferByURL = async (url) => {
15
+ return await axios
16
+ .get(url, {
17
+ responseType: 'arraybuffer'
18
+ })
19
+ .then(res => Buffer.from(res.data, 'binary'));
20
+ };
21
+ /**
22
+ * 生成二维码
23
+ * @param text
24
+ * @param targetPath
25
+ * @returns
26
+ */
27
+ const createQRCode = async (text, targetPath) => {
28
+ try {
29
+ const qrDataURL = await new Promise((resolve, reject) => {
30
+ toDataURL(text, {
31
+ margin: 2,
32
+ width: 500
33
+ }, (err, qrDataURL) => {
34
+ if (err) {
35
+ console.error(err);
36
+ reject(err);
37
+ }
38
+ else {
39
+ resolve(qrDataURL);
40
+ }
41
+ });
42
+ });
43
+ const bufferData = Buffer.from(qrDataURL.split(',')[1], 'base64');
44
+ if (targetPath) {
45
+ writeFile(targetPath, bufferData, (err) => {
46
+ if (err)
47
+ throw err;
48
+ console.info(targetPath);
49
+ });
50
+ }
51
+ return bufferData;
52
+ }
53
+ catch (err) {
54
+ console.error(err);
55
+ return false;
56
+ }
57
+ };
58
+ class Counter {
59
+ #counter = 1;
60
+ #val = 0;
61
+ /**
62
+ * 计数器
63
+ * @param initialValue
64
+ */
65
+ constructor(initialValue) {
66
+ this.#counter = initialValue;
67
+ this.#val = initialValue;
68
+ }
69
+ /**
70
+ * 获取当前计数值
71
+ */
72
+ get value() {
73
+ return this.#counter;
74
+ }
75
+ /**
76
+ * 获取下一个计数值
77
+ * @returns
78
+ */
79
+ next() {
80
+ return ++this.#counter;
81
+ }
82
+ /**
83
+ * 重置计数器
84
+ * @param initialValue
85
+ */
86
+ reStart(initialValue) {
87
+ if (initialValue !== undefined) {
88
+ this.#val = initialValue;
89
+ this.#counter = initialValue;
90
+ }
91
+ else {
92
+ this.#counter = this.#val;
93
+ }
94
+ }
95
+ }
96
+ /**
97
+ * 创建form
98
+ * @param options.url
99
+ * @param options.image
100
+ * @param options.name
101
+ * @description 支持以下几种方式创建图片数据:
102
+ * 1. 通过url获取图片数据
103
+ * 2. 通过图片路径获取图片数据
104
+ * 3. 通过base64字符串获取图片数据
105
+ * 4. 通过Buffer获取图片数据
106
+ * 5. 通过Readable流获取图片数据
107
+ * @returns
108
+ */
109
+ async function createPicFrom(options) {
110
+ let { url, image, name } = options;
111
+ let picData;
112
+ const pushBuffer = (buffer) => {
113
+ picData = new Readable();
114
+ picData.push(buffer);
115
+ // end
116
+ picData.push(null);
117
+ };
118
+ if (url) {
119
+ if (!existsSync(url))
120
+ return;
121
+ if (!name)
122
+ name = basename(url.toString());
123
+ picData = createReadStream(url);
124
+ }
125
+ else if (typeof image === 'string') {
126
+ // base64
127
+ if (image.startsWith('data:')) {
128
+ const base64Data = image.split(',')[1];
129
+ const buffer = Buffer.from(base64Data, 'base64');
130
+ const type = await fileTypeFromBuffer(buffer);
131
+ name = 'file.' + (type?.ext || 'jpg');
132
+ pushBuffer(buffer);
133
+ }
134
+ // file path
135
+ else if (existsSync(image)) {
136
+ if (!name)
137
+ name = basename(image);
138
+ picData = createReadStream(image);
139
+ }
140
+ // invalid string
141
+ else {
142
+ return;
143
+ }
144
+ }
145
+ else if (Buffer.isBuffer(image)) {
146
+ if (!name) {
147
+ const type = await fileTypeFromBuffer(image);
148
+ name = 'file.' + (type?.ext || 'jpg');
149
+ }
150
+ pushBuffer(image);
151
+ }
152
+ else if (isReadable(image)) {
153
+ if (!name) {
154
+ const img = Readable.toWeb(image);
155
+ const type = await fileTypeFromStream(img);
156
+ name = 'file.' + (type?.ext || 'jpg');
157
+ }
158
+ picData = image;
159
+ }
160
+ else {
161
+ return;
162
+ }
163
+ return { picData, name };
164
+ }
165
+ /**
166
+ *
167
+ * @param options
168
+ * @returns
169
+ */
170
+ const getPublicIP = async (options = {}) => {
171
+ const { force, ...config } = options;
172
+ if (global.publicip && !force)
173
+ return global.publicip;
174
+ return await publicIp({
175
+ onlyHttps: true,
176
+ ...config
177
+ }).then(ip => {
178
+ global.publicip = ip;
179
+ return global.publicip;
180
+ });
181
+ };
182
+ /**
183
+ * 正则表达式工具类
184
+ */
185
+ class Regular extends RegExp {
186
+ constructor(pattern, flags) {
187
+ super(pattern, flags);
188
+ }
189
+ static or(...regs) {
190
+ return new Regular(`(${regs.map(reg => reg.source).join('|')})`, regs.map(reg => reg.flags).join(''));
191
+ }
192
+ static and(...regs) {
193
+ return new Regular(regs.map(reg => `(?=${reg.source})`).join('') + '.*', regs.map(reg => reg.flags).join(''));
194
+ }
195
+ or(...regs) {
196
+ return Regular.or(this, ...regs);
197
+ }
198
+ and(...regs) {
199
+ return Regular.and(this, ...regs);
200
+ }
201
+ }
202
+
203
+ export { Counter, Regular, createPicFrom, createQRCode, getBufferByURL, getPublicIP };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "2.1.0-alpha.2",
3
+ "version": "2.1.0-alpha.21",
4
4
  "description": "bot script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
@@ -16,6 +16,10 @@
16
16
  "types": "./lib/index.d.ts"
17
17
  },
18
18
  "./package": "./package.json",
19
+ "./utils": {
20
+ "import": "./lib/utils.js",
21
+ "types": "./lib/utils.d.ts"
22
+ },
19
23
  "./env": {
20
24
  "types": "./lib/global.d.ts"
21
25
  }
@@ -29,10 +33,15 @@
29
33
  "koa-router": "^13.0.1",
30
34
  "koa-static": "^5.0.0",
31
35
  "@koa/cors": "^5.0.0",
32
- "ws": "^8.18.0"
36
+ "ws": "^8.18.0",
37
+ "flatted": "^3.3.3",
38
+ "uuid": "11.1.0",
39
+ "public-ip": "^7.0.1",
40
+ "axios": "^1.10.0",
41
+ "file-type": "21.0.0",
42
+ "qrcode": "^1.5.4"
33
43
  },
34
44
  "devDependencies": {
35
- "tsx": "^4.19.1",
36
45
  "@types/uuid": "^10.0.0",
37
46
  "@types/koa": "^2.15.0",
38
47
  "@types/koa-bodyparser": "^4.3.12",
@@ -1,17 +0,0 @@
1
- import { DefinePlatformFunc } from '../typing/event/index.js'
2
- import '../global.js'
3
-
4
- /**
5
- * 定义机器人
6
- * @param callback
7
- * @throws {Error} - 如果 callback 无效,抛出错误。
8
- * @returns
9
- */
10
- declare const definePlatform: DefinePlatformFunc
11
- /**
12
- * 废弃,请使用 definePlatform
13
- * @deprecated
14
- */
15
- declare const defineBot: DefinePlatformFunc
16
-
17
- export { defineBot, definePlatform }
@@ -1,39 +0,0 @@
1
- import { ResultCode } from '../core/code.js'
2
-
3
- /**
4
- * 定义机器人
5
- * @param callback
6
- * @throws {Error} - 如果 callback 无效,抛出错误。
7
- * @returns
8
- */
9
- const definePlatform = callback => {
10
- // 判断是否是函数
11
- if (typeof callback !== 'function') {
12
- logger.error({
13
- code: ResultCode.FailParams,
14
- message: 'Invalid callback: callback must be a function',
15
- data: null
16
- })
17
- throw new Error('Invalid callback: callback must be a function')
18
- }
19
- return {
20
- _name: 'platform',
21
- callback
22
- }
23
- }
24
- global.definePlatform = definePlatform
25
- /**
26
- * 废弃,请使用 definePlatform
27
- * @deprecated
28
- */
29
- const defineBot = callback => {
30
- logger.warn({
31
- code: ResultCode.Warn,
32
- message: 'defineBot is deprecated, please use definePlatform',
33
- data: null
34
- })
35
- return definePlatform(callback)
36
- }
37
- global.defineBot = defineBot
38
-
39
- export { defineBot, definePlatform }
@@ -1,32 +0,0 @@
1
- import { Actions } from '../typing/actions.js'
2
- import { EventsEnum } from '../typing/event/map.js'
3
- import '../global.js'
4
-
5
- declare const cbpServer: (port: number, listeningListener?: () => void) => void
6
- /**
7
- * 发送行为
8
- * @param data
9
- */
10
- declare const sendAction: (data: Actions) => Promise<any>
11
- type CBPClientOptions = {
12
- open?: () => void
13
- isFullReceive?: boolean
14
- }
15
- /**
16
- * CBP 客户端
17
- * @param url
18
- * @param onopen
19
- */
20
- declare const cbpClient: (url: string, options?: CBPClientOptions) => void
21
- type ReplyFunc = (data: Actions, consume: (payload: any) => void) => void
22
- declare const cbpPlatform: (
23
- url: string,
24
- options?: {
25
- open: () => void
26
- }
27
- ) => {
28
- send: (data: EventsEnum) => void
29
- onactions: (reply: ReplyFunc) => void
30
- }
31
-
32
- export { cbpClient, cbpPlatform, cbpServer, sendAction }
@@ -1,9 +0,0 @@
1
- import KoaRouter from 'koa-router'
2
-
3
- const router = new KoaRouter({
4
- prefix: '/message'
5
- })
6
- // 消息发送
7
- router.post('/send', () => {})
8
-
9
- export { router as default }
package/lib/jsx.d.ts DELETED
@@ -1,142 +0,0 @@
1
- import { EventKeys, Events } from './typing/event/map.js'
2
- import { ClientAPIMessageResult } from './typing/client/index.js'
3
- import { DataEnums } from './typing/message/index.js'
4
- import { Result } from './app/utils.js'
5
- import React from 'react'
6
- import { DataImage, DataImageURL, DataImageFile } from './typing/message/image.js'
7
- import { DataButton } from './typing/message/button.js'
8
- import { DataText } from './typing/message/text.js'
9
- import { DataMention } from './typing/message/mention.js'
10
-
11
- /**
12
- *
13
- * @param _props
14
- * @returns
15
- */
16
- declare function Text(
17
- _props:
18
- | {
19
- children?: DataText['value'] | DataText['value'][]
20
- style?: DataText['options']['style']
21
- }
22
- | {
23
- value?: DataText['value'] | DataText['value'][]
24
- style?: DataText['options']['style']
25
- }
26
- ): React.ReactElement<
27
- {
28
- dataType: string
29
- },
30
- string | React.JSXElementConstructor<any>
31
- >
32
- declare const Image: React.FC<{
33
- value: DataImage['value']
34
- }> & {
35
- url: React.FC<{
36
- src: DataImageURL['value']
37
- }>
38
- file: React.FC<{
39
- src: DataImageURL['value']
40
- }>
41
- }
42
-
43
- /**
44
- *
45
- * @param _props
46
- * @returns
47
- */
48
- declare function ImageFile(_props: { src: DataImageFile['value'] }): React.ReactElement<
49
- {
50
- dataType: string
51
- },
52
- string | React.JSXElementConstructor<any>
53
- >
54
- /**
55
- *
56
- * @param _props
57
- * @returns
58
- */
59
- declare function ImageURL(_props: { src: DataImageURL['value'] }): React.ReactElement<
60
- {
61
- dataType: string
62
- },
63
- string | React.JSXElementConstructor<any>
64
- >
65
- /**
66
- *
67
- * @param _props
68
- * @returns
69
- */
70
- declare function Mention(_props: {
71
- belong?: DataMention['options']['belong']
72
- value: DataMention['value']
73
- }): React.ReactElement<
74
- {
75
- dataType: string
76
- },
77
- string | React.JSXElementConstructor<any>
78
- >
79
- interface BTProps {
80
- text: DataButton['value']
81
- data: DataButton['options']['data']
82
- autoEnter?: DataButton['options']['autoEnter']
83
- toolTip?: DataButton['options']['toolTip']
84
- showList?: DataButton['options']['showList']
85
- isLink?: DataButton['options']['isLink']
86
- children?: DataButton['value']
87
- }
88
- declare const BT: React.FC<BTProps> & {
89
- group: React.FC<{
90
- children?: React.ReactNode
91
- }>
92
- row: React.FC<{
93
- children?: React.ReactNode
94
- }>
95
- template: React.FC<{
96
- id: string
97
- }>
98
- }
99
-
100
- /**
101
- * 转换数据
102
- * ***
103
- * 原则上,显示文本。使用 children 属性
104
- * ***
105
- * 其他类型使用 value 属性
106
- * ***
107
- * 如果是资源文件,使用 src 属性
108
- * ***
109
- * @param arg
110
- * @returns
111
- */
112
- declare function JSX(...arg: React.JSX.Element[]): DataEnums[]
113
- /**
114
- * 发送消息
115
- * @param e
116
- * @returns
117
- */
118
- declare const useSend: <T extends EventKeys>(
119
- e: Events[T]
120
- ) => (...arg: React.JSX.Element[]) => Promise<Result | ClientAPIMessageResult[]>
121
- /**
122
- *
123
- * @param channel_id
124
- * @param data
125
- * @returns
126
- */
127
- declare const sendToChannel: (
128
- channel_id: string,
129
- data: React.JSX.Element[]
130
- ) => Promise<ClientAPIMessageResult[]>
131
- /**
132
- *
133
- * @param user_id
134
- * @param data
135
- * @returns
136
- */
137
- declare const sendToUser: (
138
- user_id: string,
139
- data: React.JSX.Element[]
140
- ) => Promise<ClientAPIMessageResult[]>
141
-
142
- export { BT, Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend }
package/lib/jsx.js DELETED
@@ -1,234 +0,0 @@
1
- import React from 'react'
2
- import { logger } from './global.js'
3
- import './app/define-bot.js'
4
- import './app/define-chidren.js'
5
- import './app/event-middleware.js'
6
- import './app/event-processor.js'
7
- import './app/event-response.js'
8
- import { useSend as useSend$1 } from './app/hook-use-api.js'
9
- import './typing/event/actions.js'
10
- import 'fs'
11
- import 'path'
12
- import 'yaml'
13
- import { ResultCode } from './core/code.js'
14
- import 'node:fs'
15
- import 'log4js'
16
- import './app/load.js'
17
- import { sendToChannel as sendToChannel$1, sendToUser as sendToUser$1 } from './app/message-api.js'
18
- import {
19
- Text as Text$1,
20
- ImageURL as ImageURL$1,
21
- ImageFile as ImageFile$1,
22
- Image as Image$1,
23
- Mention as Mention$1,
24
- BT as BT$1
25
- } from './app/message-format.js'
26
- import './app/utils.js'
27
-
28
- /**
29
- *
30
- * @param _props
31
- * @returns
32
- */
33
- function Text(_props) {
34
- return React.createElement('div', {
35
- dataType: 'Text'
36
- })
37
- }
38
- const Image = _props => {
39
- return React.createElement('div', {
40
- dataType: 'Image'
41
- })
42
- }
43
- // BT.group 子组件
44
- Image.url = _props => {
45
- return React.createElement('div', {
46
- dataType: 'ImageURL'
47
- })
48
- }
49
- Image.file = _props => {
50
- return React.createElement('div', {
51
- dataType: 'ImageFile'
52
- })
53
- }
54
- /**
55
- *
56
- * @param _props
57
- * @returns
58
- */
59
- function ImageFile(_props) {
60
- return React.createElement('div', {
61
- dataType: 'ImageFile'
62
- })
63
- }
64
- /**
65
- *
66
- * @param _props
67
- * @returns
68
- */
69
- function ImageURL(_props) {
70
- return React.createElement('div', {
71
- dataType: 'ImageURL'
72
- })
73
- }
74
- /**
75
- *
76
- * @param _props
77
- * @returns
78
- */
79
- function Mention(_props) {
80
- return React.createElement('div', {
81
- dataType: 'Mention'
82
- })
83
- }
84
- const BT = _props => {
85
- return React.createElement('div', {
86
- dataType: 'Button'
87
- })
88
- }
89
- function ButtonGroup(_props) {
90
- return React.createElement('div', {
91
- dataType: 'BT.group'
92
- })
93
- }
94
- function ButtonRows(_props) {
95
- return React.createElement('div', {
96
- dataType: 'BT.row'
97
- })
98
- }
99
- function ButtonTemplate(_props) {
100
- return React.createElement('div', {
101
- dataType: 'BT.group'
102
- })
103
- }
104
- // BT.group 子组件
105
- BT.group = ButtonGroup
106
- // BT.template 子组件
107
- BT.template = ButtonTemplate
108
- // BT.row 子组件
109
- BT.row = ButtonRows
110
- /**
111
- * 转换数据
112
- * ***
113
- * 原则上,显示文本。使用 children 属性
114
- * ***
115
- * 其他类型使用 value 属性
116
- * ***
117
- * 如果是资源文件,使用 src 属性
118
- * ***
119
- * @param arg
120
- * @returns
121
- */
122
- function JSX(...arg) {
123
- const data = []
124
- for (const item of arg) {
125
- const props = item.props
126
- const dataType = item.type()?.props?.dataType
127
- if (dataType === 'Text') {
128
- if (props?.value) {
129
- data.push(
130
- Text$1(props.value, {
131
- style: props?.style
132
- })
133
- )
134
- } else if (props?.children) {
135
- data.push(
136
- Text$1(Array.isArray(props.children) ? props.children.join('') : props.children, {
137
- style: props?.style
138
- })
139
- )
140
- }
141
- } else if (dataType === 'ImageURL') {
142
- data.push(ImageURL$1(props.src))
143
- } else if (dataType === 'ImageFile') {
144
- data.push(ImageFile$1(props.src))
145
- } else if (dataType === 'Image') {
146
- data.push(Image$1(props.value))
147
- } else if (dataType === 'Mention') {
148
- // <@!123456> 文本的显示会被平台显示。不用自己定义显示的文本,此处不使用 children
149
- data.push(
150
- Mention$1(
151
- props.value,
152
- props?.belong
153
- ? {
154
- belong: props?.belong
155
- }
156
- : null
157
- )
158
- )
159
- } else if (dataType === 'BT.group') {
160
- const id = props?.id
161
- if (id) {
162
- data.push(BT$1.template(id))
163
- } else {
164
- if (Array.isArray(props?.children)) {
165
- const rows = []
166
- for (const child of props?.children) {
167
- // 拿到每个子组件
168
- const bts = []
169
- if (Array.isArray(child.children)) {
170
- for (const chi of child.children) {
171
- // const type = chi.children
172
- const value = chi.props?.text
173
- const data = chi.props?.data
174
- const options = {}
175
- if (chi.props?.autoEnter) {
176
- options['autoEnter'] = chi.props?.autoEnter ? true : false
177
- }
178
- if (chi.props?.toolTip) {
179
- options['toolTip'] = chi.props?.toolTip ?? ''
180
- }
181
- if (chi.props?.showList) {
182
- options['showList'] = chi.props?.showList ? true : false
183
- }
184
- if (chi.props?.isLink) {
185
- options['isLink'] = chi.props?.isLink ? true : false
186
- }
187
- bts.push(BT$1(value, data, options))
188
- }
189
- }
190
- rows.push(BT$1.row(...bts))
191
- }
192
- data.push(BT$1.group(...rows))
193
- }
194
- }
195
- }
196
- }
197
- if (data.length === 0) {
198
- logger.warn({
199
- code: ResultCode.FailParams,
200
- message: 'Invalid data: data must be a non-empty array',
201
- data: null
202
- })
203
- }
204
- return data
205
- }
206
- /**
207
- * 发送消息
208
- * @param e
209
- * @returns
210
- */
211
- const useSend = e => {
212
- const Send = useSend$1(e)
213
- return (...arg) => Send(...JSX(...arg))
214
- }
215
- /**
216
- *
217
- * @param channel_id
218
- * @param data
219
- * @returns
220
- */
221
- const sendToChannel = async (channel_id, data) => {
222
- return sendToChannel$1(channel_id, JSX(...data))
223
- }
224
- /**
225
- *
226
- * @param user_id
227
- * @param data
228
- * @returns
229
- */
230
- const sendToUser = async (user_id, data) => {
231
- return sendToUser$1(user_id, JSX(...data))
232
- }
233
-
234
- export { BT, Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend }