@alemonjs/qq-bot 2.1.10 → 2.1.12

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/lib/config.d.ts CHANGED
@@ -7,4 +7,4 @@ export type Options = {
7
7
  hideUnsupported?: boolean | number;
8
8
  } & sdkOptions;
9
9
  export declare const getQQBotConfig: () => Options;
10
- export declare const getMaster: (UserId: string) => readonly [any, string];
10
+ export declare const getMaster: (UserId: string) => readonly [boolean, string];
package/lib/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getConfigValue, useUserHashKey } from 'alemonjs';
1
+ import { getConfigValue, isMaster, createUserHashKey } from 'alemonjs';
2
2
 
3
3
  const platform = 'qq-bot';
4
4
  const getQQBotConfig = () => {
@@ -6,18 +6,12 @@ const getQQBotConfig = () => {
6
6
  return value[platform] || {};
7
7
  };
8
8
  const getMaster = (UserId) => {
9
- const values = getConfigValue() || {};
10
- const mainMasterKey = values.master_key || [];
11
- const mainMasterId = values.master_id || [];
12
- const config = getQQBotConfig();
13
- const masterKey = config.master_key || [];
14
- const masterId = config.master_id || [];
15
- const UserKey = useUserHashKey({
9
+ const isMasterUser = isMaster(UserId, platform);
10
+ const UserKey = createUserHashKey({
16
11
  Platform: platform,
17
- UserId: UserId
12
+ UserId
18
13
  });
19
- const is = mainMasterKey.includes(UserKey) || mainMasterId.includes(UserId) || masterKey.includes(UserKey) || masterId.includes(UserId);
20
- return [is, UserKey];
14
+ return [isMasterUser, UserKey];
21
15
  };
22
16
 
23
17
  export { getMaster, getQQBotConfig, platform };
package/lib/sends.js CHANGED
@@ -96,7 +96,15 @@ const mdFormatters = {
96
96
  'MD.strikethrough': value => `~~${value}~~ `,
97
97
  'MD.blockquote': value => `\n> ${value} `,
98
98
  'MD.newline': () => '\n',
99
- 'MD.link': value => `[🔗${value.text}](${value.url}) `,
99
+ 'MD.link': value => {
100
+ if (!value?.text && !value?.url) {
101
+ return '';
102
+ }
103
+ if (!value?.text || !value?.url) {
104
+ return `<${value?.url ?? value?.text}> `;
105
+ }
106
+ return `[🔗${value?.text}](${value?.url}) `;
107
+ },
100
108
  'MD.image': (value, options) => `\n![text #${options?.width || 208}px #${options?.height || 320}px](${value})\n`,
101
109
  'MD.mention': (value, options) => {
102
110
  const { belong } = options || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "2.1.10",
3
+ "version": "2.1.12",
4
4
  "description": "阿柠檬qq-bot平台连接",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
@@ -74,5 +74,5 @@
74
74
  "type": "git",
75
75
  "url": "https://github.com/lemonade-lab/alemonjs.git"
76
76
  },
77
- "gitHead": "6f36000eddf636146e6e3d7218237ffbd7c4e4c5"
77
+ "gitHead": "8cee61f217e7e72eebc4342513e32232da05167a"
78
78
  }