alemonjs 2.0.8 → 2.0.9

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 CHANGED
@@ -8,26 +8,26 @@ yarn add alemonjs @alemonjs/gui -W
8
8
 
9
9
  - 启动
10
10
 
11
- > src/index.ts
11
+ > src/index.js
12
12
 
13
- ```ts
13
+ ```js
14
14
  import { start } from 'alemonjs'
15
- start('src/index.ts')
15
+ start('src/index.js')
16
16
  ```
17
17
 
18
18
  - 响应
19
19
 
20
- > src/apps/res.ts
21
-
22
- ```ts
23
- import { Text, useSend } from 'alemonjs'
24
- export default OnResponse(event => {
25
- // 创建API
26
- const Send = useSend(event)
27
- // 执行
28
- Send(Text('hello'))
29
- // 事件类型
30
- }, 'message.create')
20
+ > src/response/res.js
21
+
22
+ ```js
23
+ import { createSelects, onResponse, Text, useSend } from 'alemonjs'
24
+ // 创建事件类型
25
+ export const selects = createSelects(['message.create'])
26
+ // 导出响应
27
+ export default onResponse(selects, event => {
28
+ // 使用发送函数
29
+ const send = useSend(event)
30
+ // 发送文本
31
+ send(Text('Hello Word!'))
32
+ })
31
33
  ```
32
-
33
- [配置编辑器](./bin/README.md)
package/lib/app/code.d.ts CHANGED
@@ -10,13 +10,13 @@
10
10
  * - 4002: 权限不足
11
11
  */
12
12
  declare const ResultCode: {
13
- readonly Ok: 2000;
14
- readonly Fail: 4000;
15
- readonly FailParams: 4001;
16
- readonly Warn: 2100;
17
- readonly FailAuth: 4002;
18
- readonly FailInternal: 5000;
19
- };
20
- type ResultCode = typeof ResultCode[keyof typeof ResultCode];
13
+ readonly Ok: 2000
14
+ readonly Fail: 4000
15
+ readonly FailParams: 4001
16
+ readonly Warn: 2100
17
+ readonly FailAuth: 4002
18
+ readonly FailInternal: 5000
19
+ }
20
+ type ResultCode = (typeof ResultCode)[keyof typeof ResultCode]
21
21
 
22
- export { ResultCode };
22
+ export { ResultCode }
package/lib/app/code.js CHANGED
@@ -2,16 +2,16 @@
2
2
  * 结果反馈码
3
3
  */
4
4
  // 成功码
5
- const Ok = 2000; // 成功
5
+ const Ok = 2000 // 成功
6
6
  // 警惕码
7
- const Warn = 2100; // 任意警告
7
+ const Warn = 2100 // 任意警告
8
8
  // 失败码
9
- const Fail = 4000; // 未知错误
10
- const FailParams = 4001; // 参数错误
9
+ const Fail = 4000 // 未知错误
10
+ const FailParams = 4001 // 参数错误
11
11
  // 权限错误
12
- const FailAuth = 4002; // 权限不足
12
+ const FailAuth = 4002 // 权限不足
13
13
  // 内部错误
14
- const FailInternal = 5000; // 内部错误
14
+ const FailInternal = 5000 // 内部错误
15
15
  /**
16
16
  * 结果反馈码
17
17
  * @description
@@ -21,12 +21,12 @@ const FailInternal = 5000; // 内部错误
21
21
  * - 4002: 权限不足
22
22
  */
23
23
  const ResultCode = {
24
- Ok,
25
- Fail,
26
- FailParams,
27
- Warn,
28
- FailAuth,
29
- FailInternal
30
- };
24
+ Ok,
25
+ Fail,
26
+ FailParams,
27
+ Warn,
28
+ FailAuth,
29
+ FailInternal
30
+ }
31
31
 
32
- export { ResultCode };
32
+ export { ResultCode }
@@ -39,7 +39,7 @@ const OnMiddleware = (callback, select) => {
39
39
  message: 'OnMiddleware is deprecated, please use onMiddleware',
40
40
  data: null
41
41
  });
42
- return ({ select, current: callback });
42
+ return { select, current: callback };
43
43
  };
44
44
  global.OnMiddleware = OnMiddleware;
45
45
 
@@ -10,7 +10,7 @@ import { expendSubscribeCreate, expendSubscribeMount, expendSubscribeUnmount } f
10
10
  */
11
11
  const showLog = (event, select) => {
12
12
  const log = {
13
- 'Name': select
13
+ Name: select
14
14
  };
15
15
  if (typeof event['ChannelId'] == 'string' && event['ChannelId'] != '') {
16
16
  log['ChannelId'] = event['ChannelId'];
package/lib/code.d.ts CHANGED
@@ -14,6 +14,6 @@ declare const ResultCode: {
14
14
  readonly FailAuth: 4002;
15
15
  readonly FailInternal: 5000;
16
16
  };
17
- type ResultCode = typeof ResultCode[keyof typeof ResultCode];
17
+ type ResultCode = (typeof ResultCode)[keyof typeof ResultCode];
18
18
 
19
19
  export { ResultCode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "bot script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "strict": false
4
- },
5
- "include": ["src/**/*"],
6
- "extends": "lvyjs/tsconfig.json"
7
- }