@alemonjs/qq-bot 2.1.9 → 2.1.11

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) => boolean;
package/lib/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getConfigValue, useUserHashKey } from 'alemonjs';
1
+ import { getConfigValue, isMaster } from 'alemonjs';
2
2
 
3
3
  const platform = 'qq-bot';
4
4
  const getQQBotConfig = () => {
@@ -6,18 +6,7 @@ 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({
16
- Platform: platform,
17
- UserId: UserId
18
- });
19
- const is = mainMasterKey.includes(UserKey) || mainMasterId.includes(UserId) || masterKey.includes(UserKey) || masterId.includes(UserId);
20
- return [is, UserKey];
9
+ return isMaster(UserId, platform);
21
10
  };
22
11
 
23
12
  export { getMaster, getQQBotConfig, platform };
package/lib/desktop.js CHANGED
@@ -22,12 +22,13 @@ const activate = context => {
22
22
  webView.onMessage(data => {
23
23
  try {
24
24
  if (data.type === 'qq-bot.form.save') {
25
- const qqBot = data.data;
25
+ const db = data.data;
26
26
  const config = getConfig();
27
27
  const value = config.value ?? {};
28
28
  value['qq-bot'] = {
29
- ...qqBot,
30
- master_key: qqBot.master_key.split(',')
29
+ ...db,
30
+ master_key: db.master_key?.split(',') ?? null,
31
+ master_id: db.master_id?.split(',') ?? null
31
32
  };
32
33
  config.saveValue(value);
33
34
  context.notification('QQ Bot 配置保存成功~');
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.9",
3
+ "version": "2.1.11",
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": "743b70375f728a1584ae149bbadcd04378540ade"
77
+ "gitHead": "e50477125586204c6e56a8ecfe3391136f5fe74b"
78
78
  }