@alemonjs/discord 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
@@ -12,4 +12,4 @@ export declare const platform = "discord";
12
12
  export declare const getDiscordConfig: () => Options & {
13
13
  [key: string]: any;
14
14
  };
15
- export declare const getMaster: (UserId: string) => readonly [any, string];
15
+ 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 { isMaster, createUserHashKey, getConfigValue } from 'alemonjs';
2
2
 
3
3
  const platform = 'discord';
4
4
  const getDiscordConfig = () => {
@@ -7,18 +7,12 @@ const getDiscordConfig = () => {
7
7
  return config;
8
8
  };
9
9
  const getMaster = (UserId) => {
10
- const values = getConfigValue() || {};
11
- const mainMasterKey = values.master_key || [];
12
- const mainMasterId = values.master_id || [];
13
- const config = getDiscordConfig();
14
- const masterKey = config.master_key || [];
15
- const masterId = config.master_id || [];
16
- const UserKey = useUserHashKey({
10
+ const isMasterUser = isMaster(UserId, platform);
11
+ const UserKey = createUserHashKey({
17
12
  Platform: platform,
18
- UserId: UserId
13
+ UserId
19
14
  });
20
- const is = mainMasterKey.includes(UserKey) || mainMasterId.includes(UserId) || masterKey.includes(UserKey) || masterId.includes(UserId);
21
- return [is, UserKey];
15
+ return [isMasterUser, UserKey];
22
16
  };
23
17
 
24
18
  export { getDiscordConfig, getMaster, platform };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/discord",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "description": "discord platform connection",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
@@ -39,14 +39,14 @@
39
39
  "logo": "antd.DiscordOutlined",
40
40
  "command": [
41
41
  {
42
- "name": "打开discord",
42
+ "name": "discord",
43
43
  "icon": "antd.DiscordOutlined",
44
44
  "command": "open.discord"
45
45
  }
46
46
  ],
47
47
  "sidebars": [
48
48
  {
49
- "name": "dc",
49
+ "name": "discord",
50
50
  "icon": "antd.DiscordOutlined",
51
51
  "command": "open.discord"
52
52
  }
@@ -65,5 +65,5 @@
65
65
  "type": "git",
66
66
  "url": "https://github.com/lemonade-lab/alemonjs.git"
67
67
  },
68
- "gitHead": "743b70375f728a1584ae149bbadcd04378540ade"
68
+ "gitHead": "8cee61f217e7e72eebc4342513e32232da05167a"
69
69
  }