alemonjs 1.0.46 → 1.0.47

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.
@@ -49,12 +49,8 @@ export const PUBLIC_GUILD_MESSAGES_KOOK = async (event) => {
49
49
  });
50
50
  msg = msg.replace(`(met)${item.id}(met)`, '').trim();
51
51
  }
52
- let isMaster = false;
53
52
  const cfg = getBotConfigByKey('kook');
54
53
  const masterID = cfg.masterID;
55
- if (event.msg_id == masterID) {
56
- isMaster = true;
57
- }
58
54
  let at_user;
59
55
  if (at) {
60
56
  if (at_users[0] && at_users[0].bot != true) {
@@ -69,7 +65,7 @@ export const PUBLIC_GUILD_MESSAGES_KOOK = async (event) => {
69
65
  eventType: 'CREATE',
70
66
  isPrivate: true,
71
67
  isRecall: false,
72
- isMaster: isMaster,
68
+ isMaster: event.msg_id == masterID ? true : false,
73
69
  isGroup: event.channel_type == 'GROUP' ? true : false,
74
70
  boundaries: 'private',
75
71
  attribute: event.channel_type == 'GROUP' ? 'group' : 'single',
@@ -5,6 +5,7 @@ import { getBotMsgByNtqq } from '../bot.js';
5
5
  import IMGS from 'image-size';
6
6
  import { ClientKOA } from '../../../koa/index.js';
7
7
  import { AlemonJSError, AlemonJSLog } from '../../../log/user.js';
8
+ import { getBotConfigByKey } from '../../../config/index.js';
8
9
  /**
9
10
  * 错误打印
10
11
  * @param err
@@ -15,9 +16,12 @@ const error = err => {
15
16
  return err;
16
17
  };
17
18
  export const C2C_MESSAGE_CREATE = async (event) => {
19
+ const cfg = getBotConfigByKey('ntqq');
20
+ const masterID = cfg.masterID;
18
21
  const e = {
19
22
  platform: 'ntqq',
20
23
  bot: getBotMsgByNtqq(),
24
+ isMaster: event.author.id == masterID ? true : false,
21
25
  event: 'MESSAGES',
22
26
  eventType: 'CREATE',
23
27
  // 是私
@@ -22,9 +22,12 @@ const error = err => {
22
22
  * @returns
23
23
  */
24
24
  export const GROUP_AT_MESSAGE_CREATE = async (event) => {
25
+ const cfg = getBotConfigByKey('ntqq');
26
+ const masterID = cfg.masterID;
25
27
  const e = {
26
28
  platform: 'ntqq',
27
29
  bot: getBotMsgByNtqq(),
30
+ isMaster: event.author.id == masterID ? true : false,
28
31
  event: 'MESSAGES',
29
32
  eventType: 'CREATE',
30
33
  isPrivate: false,
@@ -33,27 +36,6 @@ export const GROUP_AT_MESSAGE_CREATE = async (event) => {
33
36
  boundaries: 'publick',
34
37
  attribute: 'group'
35
38
  };
36
- /**
37
- * 得到登录配置
38
- */
39
- const cfg = getBotConfigByKey('ntqq');
40
- /**
41
- * 得到主人id
42
- */
43
- const masterID = cfg.masterID;
44
- /**
45
- * 默认不是主人
46
- */
47
- e.isMaster = false;
48
- /**
49
- * 检查身份
50
- */
51
- if (event.author.id == masterID) {
52
- /**
53
- * 是主人
54
- */
55
- e.isMaster = true;
56
- }
57
39
  /**
58
40
  * 消息发送机制
59
41
  * @param msg 消息
@@ -4,6 +4,7 @@ import { segmentQQ } from '../segment.js';
4
4
  import { getBotMsgByQQ } from '../bot.js';
5
5
  import { AlemonJSError, AlemonJSLog } from '../../../log/user.js';
6
6
  import { AlemonJSEventError, AlemonJSEventLog } from '../../../log/event.js';
7
+ import { getBotConfigByKey } from '../../../config/index.js';
7
8
  /**
8
9
  * 错误打印
9
10
  * @param err
@@ -24,9 +25,12 @@ DIRECT_MESSAGE (1 << 12)
24
25
  - DIRECT_MESSAGE_DELETE // 删除(撤回)消息事件
25
26
  */
26
27
  export const DIRECT_MESSAGE = async (event) => {
28
+ const cfg = getBotConfigByKey('qq');
29
+ const masterID = cfg.masterID;
27
30
  const e = {
28
31
  platform: 'qq',
29
32
  bot: getBotMsgByQQ(),
33
+ isMaster: event.msg.author.id == masterID ? true : false,
30
34
  event: 'MESSAGES',
31
35
  eventType: 'CREATE',
32
36
  isPrivate: false,
@@ -132,19 +132,6 @@ export async function MESSAGES_VILLA(event) {
132
132
  * 得到主人id
133
133
  */
134
134
  const masterID = cfg.masterID;
135
- /**
136
- * 默认不是主人
137
- */
138
- let isMaster = false;
139
- /**
140
- * 检查身份
141
- */
142
- if (MessageContent.user.id == masterID) {
143
- /**
144
- * 是主人
145
- */
146
- isMaster = true;
147
- }
148
135
  /**
149
136
  * 清除 @ 后的消息
150
137
  */
@@ -203,7 +190,7 @@ export async function MESSAGES_VILLA(event) {
203
190
  /**
204
191
  * 是否是机器人主人
205
192
  */
206
- isMaster: isMaster,
193
+ isMaster: MessageContent.user.id == masterID ? true : false,
207
194
  /*
208
195
  * 消息编号 这个消息是可以触发回复api的消息id
209
196
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "DOCS https://alemonjs.com/",
5
5
  "author": "ningmengchongshui",
6
6
  "license": "GPL-2.0",