alemonjs 1.1.12 → 1.1.13

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.
Files changed (56) hide show
  1. package/lib/core/index.js +1 -0
  2. package/lib/core/utils.js +11 -0
  3. package/lib/define/main.js +11 -11
  4. package/lib/discord/discord.js +1 -1
  5. package/lib/discord/sdk/types.js +1 -1
  6. package/lib/discord/sdk/wss.js +1 -1
  7. package/lib/kook/alemon/message/DIRECT_MESSAGE.js +3 -3
  8. package/lib/kook/alemon/message/GUILD_MESSAGE_REACTIONS.js +5 -5
  9. package/lib/kook/alemon/message/PUBLIC_GUILD_MESSAGES.js +5 -5
  10. package/lib/kook/sdk/typings.js +1 -1
  11. package/lib/login.js +37 -0
  12. package/lib/ntqq/sdk/intents.js +10 -10
  13. package/lib/ntqq/sdk/wss.js +2 -2
  14. package/lib/qq/alemon/direct.js +4 -4
  15. package/lib/qq/alemon/message/CHANNEL.js +1 -1
  16. package/lib/qq/alemon/reply.js +4 -4
  17. package/lib/qq/sdk/wss.js +2 -2
  18. package/lib/villa/alemon/message/GUILD_BOT.js +9 -9
  19. package/lib/villa/alemon/message/GUILD_MEMBERS.js +15 -15
  20. package/lib/villa/alemon/message/GUILD_MESSAGE_REACTIONS.js +17 -17
  21. package/lib/villa/alemon/message/MESSAGES.js +12 -12
  22. package/lib/villa/alemon/message/MESSAGE_AUDIT.js +16 -16
  23. package/lib/villa/alemon/message/MESSAGE_BUTTON.js +11 -11
  24. package/lib/villa/index.js +9 -8
  25. package/lib/villa/sdk/api.js +8 -8
  26. package/lib/villa/sdk/config.js +3 -2
  27. package/lib/villa/sdk/counter.js +9 -0
  28. package/lib/villa/sdk/data.js +51 -0
  29. package/lib/villa/sdk/index.js +0 -1
  30. package/lib/villa/sdk/mechanism.js +6 -6
  31. package/lib/villa/sdk/proto/command.proto +112 -0
  32. package/lib/villa/sdk/proto/model.proto +158 -0
  33. package/lib/villa/sdk/proto/robot_event_message.proto +10 -0
  34. package/lib/villa/sdk/proto.js +107 -0
  35. package/lib/villa/sdk/types.js +23 -23
  36. package/lib/villa/sdk/utils.js +2 -2
  37. package/lib/villa/sdk/wss.js +146 -35
  38. package/lib/villa/villa.js +2 -1
  39. package/package.json +6 -5
  40. package/types/core/index.d.ts +1 -0
  41. package/types/core/utils.d.ts +9 -0
  42. package/types/login.d.ts +9 -0
  43. package/types/villa/alemon/message/GUILD_BOT.d.ts +10 -11
  44. package/types/villa/alemon/message/GUILD_MEMBERS.d.ts +10 -11
  45. package/types/villa/alemon/message/GUILD_MESSAGE_REACTIONS.d.ts +14 -15
  46. package/types/villa/alemon/message/MESSAGES.d.ts +14 -15
  47. package/types/villa/alemon/message/MESSAGE_AUDIT.d.ts +13 -14
  48. package/types/villa/alemon/message/MESSAGE_BUTTON.d.ts +13 -14
  49. package/types/villa/sdk/api.d.ts +2 -2
  50. package/types/villa/sdk/counter.d.ts +5 -0
  51. package/types/villa/sdk/data.d.ts +27 -0
  52. package/types/villa/sdk/index.d.ts +0 -1
  53. package/types/villa/sdk/proto.d.ts +51 -0
  54. package/types/villa/sdk/types.d.ts +5 -4
  55. package/types/villa/sdk/wss.d.ts +1 -1
  56. package/types/villa/villa.d.ts +5 -0
package/lib/core/index.js CHANGED
@@ -17,3 +17,4 @@ export * from './screenshot.js';
17
17
  export * from './typings.js';
18
18
  export * from './buffer.js';
19
19
  export * from './ip.js';
20
+ export * from './utils.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 字符串数组转正则
3
+ * [''] => /^$/
4
+ * ['abc'] => /^abc$/
5
+ * ['a','b','c'] => /^(a|b|c)$/
6
+ * @param APP
7
+ * @returns
8
+ */
9
+ export function arrayToRule(APP) {
10
+ return APP.length == 0 ? /^$/ : new RegExp(APP.join('|'));
11
+ }
@@ -89,16 +89,16 @@ export async function defineAlemonConfig(Options) {
89
89
  setBotConfigByKey('qq', {
90
90
  intents: [
91
91
  // 基础事件
92
- AvailableIntentsEventsEnum.GUILDS,
93
- AvailableIntentsEventsEnum.GUILD_MEMBERS,
94
- AvailableIntentsEventsEnum.DIRECT_MESSAGE,
92
+ AvailableIntentsEventsEnum.GUILDS, //频道进出
93
+ AvailableIntentsEventsEnum.GUILD_MEMBERS, //成员资料
94
+ AvailableIntentsEventsEnum.DIRECT_MESSAGE, //私信
95
95
  // 需申请的
96
- AvailableIntentsEventsEnum.AUDIO_ACTION,
97
- AvailableIntentsEventsEnum.MESSAGE_AUDIT,
98
- AvailableIntentsEventsEnum.INTERACTION,
99
- AvailableIntentsEventsEnum.GUILD_MESSAGE_REACTIONS,
96
+ AvailableIntentsEventsEnum.AUDIO_ACTION, //音频
97
+ AvailableIntentsEventsEnum.MESSAGE_AUDIT, //消息审核
98
+ AvailableIntentsEventsEnum.INTERACTION, //互动事件
99
+ AvailableIntentsEventsEnum.GUILD_MESSAGE_REACTIONS, //表情表态
100
100
  // 私域特有
101
- AvailableIntentsEventsEnum.GUILD_MESSAGES,
101
+ AvailableIntentsEventsEnum.GUILD_MESSAGES, //私域事件
102
102
  AvailableIntentsEventsEnum.FORUMS_EVENT //私域论坛
103
103
  ],
104
104
  ...Options.login.qq
@@ -108,9 +108,9 @@ export async function defineAlemonConfig(Options) {
108
108
  setBotConfigByKey('qq', {
109
109
  intents: [
110
110
  // 基础事件
111
- AvailableIntentsEventsEnum.GUILDS,
112
- AvailableIntentsEventsEnum.GUILD_MEMBERS,
113
- AvailableIntentsEventsEnum.DIRECT_MESSAGE,
111
+ AvailableIntentsEventsEnum.GUILDS, //频道进出
112
+ AvailableIntentsEventsEnum.GUILD_MEMBERS, //成员资料
113
+ AvailableIntentsEventsEnum.DIRECT_MESSAGE, //私信
114
114
  // 公域特有
115
115
  AvailableIntentsEventsEnum.PUBLIC_GUILD_MESSAGES //公域事件
116
116
  ],
@@ -5,7 +5,7 @@ import { IntentsEnum } from './sdk/index.js';
5
5
  export const defineDISCORD = {
6
6
  token: '',
7
7
  intent: [
8
- IntentsEnum.MESSAGE_CONTENT,
8
+ IntentsEnum.MESSAGE_CONTENT, // 内容是基础
9
9
  //
10
10
  IntentsEnum.DIRECT_MESSAGES,
11
11
  IntentsEnum.DIRECT_MESSAGE_TYPING,
@@ -19,4 +19,4 @@ export var IntentsEnum;
19
19
  IntentsEnum[IntentsEnum["GUILD_SCHEDULED_EVENTS"] = 65536] = "GUILD_SCHEDULED_EVENTS";
20
20
  IntentsEnum[IntentsEnum["AUTO_MODERATION_CONFIGURATION"] = 1048576] = "AUTO_MODERATION_CONFIGURATION";
21
21
  IntentsEnum[IntentsEnum["AUTO_MODERATION_EXECUTION"] = 2097152] = "AUTO_MODERATION_EXECUTION";
22
- })(IntentsEnum = IntentsEnum || (IntentsEnum = {}));
22
+ })(IntentsEnum || (IntentsEnum = {}));
@@ -19,7 +19,7 @@ export async function createClient(conversation, shard = [0, 1]) {
19
19
  });
20
20
  const call = async () => {
21
21
  wsConn.send(JSON.stringify({
22
- op: 1,
22
+ op: 1, // op = 1
23
23
  d: null // 如果是第一次连接,传null
24
24
  }));
25
25
  setTimeout(call, heartbeat_interval);
@@ -19,7 +19,7 @@ export const DIRECT_MESSAGE = async (event) => {
19
19
  const avatar = event.extra.author.avatar;
20
20
  // 私聊中 控制器并非私聊接口
21
21
  const Message = ClientDirectController({
22
- channel_id: event.target_id,
22
+ channel_id: event.target_id, // 频道号
23
23
  open_id: open_id
24
24
  });
25
25
  const Member = ClientControllerOnMember();
@@ -33,11 +33,11 @@ export const DIRECT_MESSAGE = async (event) => {
33
33
  : 'single',
34
34
  bot: getBotMsgByKOOK(),
35
35
  isMaster: event.extra.author.id == masterID,
36
- guild_id: '',
36
+ guild_id: '', // 频道号
37
37
  guild_name: '',
38
38
  guild_avatar: '',
39
39
  channel_name: event.extra.channel_name,
40
- channel_id: event.target_id,
40
+ channel_id: event.target_id, // 子频道
41
41
  attachments: [],
42
42
  specials: [],
43
43
  //
@@ -19,12 +19,12 @@ export const GUILD_MESSAGE_REACTIONS = async (event) => {
19
19
  const cfg = getBotConfigByKey('kook');
20
20
  const masterID = cfg.masterID;
21
21
  const Message = ClientController({
22
- channel_id: event.target_id,
22
+ channel_id: event.target_id, // 子频道
23
23
  msg_id: event.msg_id,
24
24
  user_id: body.user_id
25
25
  });
26
26
  const Member = ClientControllerOnMember({
27
- guild_id: event.target_id,
27
+ guild_id: event.target_id, // 频道
28
28
  user_id: body.user_id
29
29
  });
30
30
  const data = await ClientKOOK.userChatCreate(body.user_id).then(res => res?.data);
@@ -38,11 +38,11 @@ export const GUILD_MESSAGE_REACTIONS = async (event) => {
38
38
  : 'single',
39
39
  bot: getBotMsgByKOOK(),
40
40
  isMaster: body.user_id == masterID ? true : false,
41
- guild_id: event.target_id,
41
+ guild_id: event.target_id, // 频道
42
42
  guild_name: '',
43
43
  guild_avatar: '',
44
44
  channel_name: '',
45
- channel_id: event.target_id,
45
+ channel_id: event.target_id, // 子频道
46
46
  attachments: [],
47
47
  specials: [],
48
48
  //
@@ -52,7 +52,7 @@ export const GUILD_MESSAGE_REACTIONS = async (event) => {
52
52
  msg: '',
53
53
  msg_txt: event.content,
54
54
  msg_id: event.msg_id,
55
- open_id: data?.code ?? '',
55
+ open_id: data?.code ?? '', // 私聊标记 空的 需要创建私聊 每次请求都自动创建
56
56
  //
57
57
  user_id: body.user_id,
58
58
  user_name: '',
@@ -59,12 +59,12 @@ export const PUBLIC_GUILD_MESSAGES_KOOK = async (event) => {
59
59
  const masterID = cfg.masterID;
60
60
  const avatar = event.extra.author.avatar;
61
61
  const Message = ClientController({
62
- channel_id: event.target_id,
62
+ channel_id: event.target_id, // 子频道
63
63
  msg_id: event.msg_id,
64
64
  user_id: event.extra.author.id
65
65
  });
66
66
  const Member = ClientControllerOnMember({
67
- guild_id: event.target_id,
67
+ guild_id: event.target_id, // 频道
68
68
  user_id: event.extra.author.id
69
69
  });
70
70
  const data = await ClientKOOK.userChatCreate(event.extra.author.id).then(res => res?.data);
@@ -78,11 +78,11 @@ export const PUBLIC_GUILD_MESSAGES_KOOK = async (event) => {
78
78
  : 'single',
79
79
  bot: getBotMsgByKOOK(),
80
80
  isMaster: event.extra.author.id == masterID ? true : false,
81
- guild_id: event.extra.guild_id,
81
+ guild_id: event.extra.guild_id, // 频道
82
82
  guild_name: '',
83
83
  guild_avatar: '',
84
84
  channel_name: '',
85
- channel_id: event.target_id,
85
+ channel_id: event.target_id, // 子频道
86
86
  attachments: [],
87
87
  specials: [],
88
88
  //
@@ -92,7 +92,7 @@ export const PUBLIC_GUILD_MESSAGES_KOOK = async (event) => {
92
92
  msg,
93
93
  msg_txt: event.content,
94
94
  msg_id: event.msg_id,
95
- open_id: data?.code ?? '',
95
+ open_id: data?.code ?? '', // 私聊标记 空的 需要创建私聊 每次请求都自动创建
96
96
  //
97
97
  user_id: event.extra.author.id,
98
98
  user_name: event.extra.author.username,
@@ -163,7 +163,7 @@ export var ApiEnum;
163
163
  * *******
164
164
  */
165
165
  ApiEnum["GatewayIndex"] = "/api/v3/gateway/index";
166
- })(ApiEnum = ApiEnum || (ApiEnum = {}));
166
+ })(ApiEnum || (ApiEnum = {}));
167
167
  /**
168
168
  * 系统数据可枚举
169
169
  */
package/lib/login.js CHANGED
@@ -37,3 +37,40 @@ export function analysis(val) {
37
37
  console.info('LOAD BOT', ket);
38
38
  return val[ket];
39
39
  }
40
+ /**
41
+ * 为每个配置增加识别出Regex
42
+ * @param val
43
+ * @param key
44
+ * @returns
45
+ */
46
+ export function analysisRegex(val, key) {
47
+ // 很多个配置
48
+ const argv = [...process.argv];
49
+ const ars = argv.slice(2);
50
+ // 缓存key
51
+ let ket = '';
52
+ for (const item in val) {
53
+ // item 是key 检查有没有 有则直接得到第一个机器人
54
+ if (ars.includes(item)) {
55
+ ket = item;
56
+ break;
57
+ }
58
+ }
59
+ // 找不到实例
60
+ if (ket == '') {
61
+ /**
62
+ * 找不到实例 取第一个
63
+ */
64
+ for (const item in val) {
65
+ ket = item;
66
+ break;
67
+ }
68
+ }
69
+ if (ket == '')
70
+ return /^$/;
71
+ if (Object.prototype.hasOwnProperty.call(key, ket)) {
72
+ // 存在
73
+ return key[ket];
74
+ }
75
+ return /^$/;
76
+ }
@@ -9,16 +9,16 @@
9
9
  * 订阅枚举
10
10
  */
11
11
  export const AvailableIntentsEventsEnum = [
12
- 'GROUP_AT_MESSAGE_CREATE',
13
- 'C2C_MESSAGE_CREATE',
14
- 'FRIEND_ADD',
15
- 'FRIEND_DEL',
16
- 'C2C_MSG_REJECT',
17
- 'GROUP_ADD_ROBOT',
18
- 'GROUP_DEL_ROBOT',
19
- 'GROUP_MSG_REJECT',
20
- 'GROUP_MSG_RECEIVE',
21
- 'INTERACTION_CREATE',
12
+ 'GROUP_AT_MESSAGE_CREATE', // 群艾特消息
13
+ 'C2C_MESSAGE_CREATE', // 单聊消息
14
+ 'FRIEND_ADD', // 用户添加机器人
15
+ 'FRIEND_DEL', // 用户删除机器人
16
+ 'C2C_MSG_REJECT', // 拒绝机器人主动消息 | 允许机器人主动消息
17
+ 'GROUP_ADD_ROBOT', // 机器人加入群聊
18
+ 'GROUP_DEL_ROBOT', // 机器人退出群聊
19
+ 'GROUP_MSG_REJECT', // 群聊拒绝机器人主动消息
20
+ 'GROUP_MSG_RECEIVE', // 群聊接受机器人主动消息
21
+ 'INTERACTION_CREATE', // 点击回调按钮
22
22
  /**
23
23
  * 频道
24
24
  */
@@ -51,7 +51,7 @@ export async function createClient(conversation, shard = [0, 1]) {
51
51
  power = setInterval(() => {
52
52
  if (isConnected) {
53
53
  ws.send(JSON.stringify({
54
- op: 1,
54
+ op: 1, // op = 1
55
55
  d: null // 如果是第一次连接,传null
56
56
  }));
57
57
  }
@@ -88,7 +88,7 @@ export async function createClient(conversation, shard = [0, 1]) {
88
88
  * 发送鉴权
89
89
  */
90
90
  ws.send(JSON.stringify({
91
- op: 2,
91
+ op: 2, // op = 2
92
92
  d: {
93
93
  token: `QQBot ${token}`,
94
94
  intents: intents,
@@ -143,7 +143,7 @@ export async function directController(msg, open_id, msg_id, select) {
143
143
  try {
144
144
  return await Client.postDirectImage({
145
145
  id: open_id,
146
- msg_id: msg_id,
146
+ msg_id: msg_id, //消息id, 必须
147
147
  image: msg //buffer
148
148
  }).catch(everyoneError);
149
149
  }
@@ -166,8 +166,8 @@ export async function directController(msg, open_id, msg_id, select) {
166
166
  try {
167
167
  return await Client.postDirectImage({
168
168
  id: open_id,
169
- msg_id: msg_id,
170
- image: msg[isBuffer],
169
+ msg_id: msg_id, //消息id, 必须
170
+ image: msg[isBuffer], //buffer
171
171
  content: cont
172
172
  }).catch(everyoneError);
173
173
  }
@@ -195,7 +195,7 @@ export async function directController(msg, open_id, msg_id, select) {
195
195
  if (msg) {
196
196
  return await Client.postImage({
197
197
  id: open_id,
198
- msg_id: msg_id,
198
+ msg_id: msg_id, //消息id, 必须
199
199
  image: msg //buffer
200
200
  }).catch(everyoneError);
201
201
  }
@@ -46,7 +46,7 @@ export const CHANNEL = async (event) => {
46
46
  isMaster: false,
47
47
  attachments: [],
48
48
  specials: [],
49
- guild_id: event.msg?.guild_id,
49
+ guild_id: event.msg?.guild_id, // ?
50
50
  guild_name: '',
51
51
  guild_avatar: '',
52
52
  channel_name: '',
@@ -15,7 +15,7 @@ export async function replyController(msg, channel_id, msg_id, select) {
15
15
  try {
16
16
  return await Client.postImage({
17
17
  id: channel_id,
18
- msg_id: msg_id,
18
+ msg_id: msg_id, //消息id, 必须,不然就是主动消息了
19
19
  image: msg //buffer
20
20
  }).catch(everyoneError);
21
21
  }
@@ -38,8 +38,8 @@ export async function replyController(msg, channel_id, msg_id, select) {
38
38
  try {
39
39
  return await Client.postImage({
40
40
  id: channel_id,
41
- msg_id: msg_id,
42
- image: msg[isBuffer],
41
+ msg_id: msg_id, //消息id, 必须
42
+ image: msg[isBuffer], //buffer
43
43
  content: cont
44
44
  }).catch(everyoneError);
45
45
  }
@@ -67,7 +67,7 @@ export async function replyController(msg, channel_id, msg_id, select) {
67
67
  if (msg) {
68
68
  return await Client.postImage({
69
69
  id: channel_id,
70
- msg_id: msg_id,
70
+ msg_id: msg_id, //消息id, 必须
71
71
  image: msg //buffer
72
72
  }).catch(everyoneError);
73
73
  }
package/lib/qq/sdk/wss.js CHANGED
@@ -69,7 +69,7 @@ export async function createClient(callBack, shard = [0, 4]) {
69
69
  */
70
70
  if (isConnected) {
71
71
  ws.send(JSON.stringify({
72
- op: 1,
72
+ op: 1, // op = 1
73
73
  d: null // 如果是第一次连接,传null
74
74
  }));
75
75
  }
@@ -100,7 +100,7 @@ export async function createClient(callBack, shard = [0, 4]) {
100
100
  * 发送鉴权
101
101
  */
102
102
  ws.send(JSON.stringify({
103
- op: 2,
103
+ op: 2, // op = 2
104
104
  d: {
105
105
  token: `Bot ${appID}.${token}`,
106
106
  intents: getIntentsMask(intents),
@@ -10,10 +10,10 @@ import { ClientControllerOnMember, ClientControllerOnMessage } from '../controll
10
10
  export async function GUILD_BOT(event) {
11
11
  if (process.env?.ALEMONJS_EVENT == 'dev')
12
12
  console.info('event', event);
13
- const EventData = event.extend_data.EventData;
13
+ const extendData = event.extendData;
14
14
  const guild_id = event.type == 3
15
- ? EventData.CreateRobot.villa_id
16
- : EventData.DeleteRobot.villa_id;
15
+ ? extendData.createRobot.villaId
16
+ : extendData.deleteRobot.villaId;
17
17
  const Message = ClientControllerOnMessage({
18
18
  guild_id: guild_id,
19
19
  channel_id: 0,
@@ -50,7 +50,7 @@ export async function GUILD_BOT(event) {
50
50
  at_user: undefined,
51
51
  at_users: [],
52
52
  msg: '',
53
- msg_id: `${event.id}.${event.send_at}`,
53
+ msg_id: `${event.id}.${event.sendAt}`,
54
54
  msg_txt: '',
55
55
  open_id: '',
56
56
  //
@@ -58,7 +58,7 @@ export async function GUILD_BOT(event) {
58
58
  user_name: '',
59
59
  user_avatar: '',
60
60
  //
61
- send_at: event.send_at,
61
+ send_at: event.sendAt,
62
62
  segment: segmentVILLA,
63
63
  /**
64
64
  * 消息回复
@@ -71,11 +71,11 @@ export async function GUILD_BOT(event) {
71
71
  console.error('VILLA 无私信');
72
72
  return false;
73
73
  }
74
- const villa_id = select?.guild_id ?? guild_id;
75
- const room_id = select?.channel_id ?? false;
76
- if (!room_id)
74
+ const villaId = select?.guild_id ?? guild_id;
75
+ const roomId = select?.channel_id ?? false;
76
+ if (!roomId)
77
77
  return false;
78
- return await replyController(villa_id, room_id, msg, {
78
+ return await replyController(villaId, roomId, msg, {
79
79
  quote: select?.quote
80
80
  });
81
81
  },
@@ -11,18 +11,18 @@ import { ClientControllerOnMember, ClientControllerOnMessage } from '../controll
11
11
  export async function GUILD_MEMBERS(event) {
12
12
  if (process.env?.ALEMONJS_EVENT == 'dev')
13
13
  console.info('event', event);
14
- const JoinVilla = event.extend_data.EventData.JoinVilla;
14
+ const JoinVilla = event.extendData.joinVilla;
15
15
  const cfg = getBotConfigByKey('villa');
16
16
  const masterID = cfg.masterID;
17
- const msg_id = `${event.id}.${JoinVilla.join_at}`;
17
+ const msg_id = `${event.id}.${JoinVilla.joinAt}`;
18
18
  const Message = ClientControllerOnMessage({
19
- guild_id: JoinVilla.villa_id,
19
+ guild_id: JoinVilla.villaId,
20
20
  channel_id: 0,
21
21
  msg_id: msg_id
22
22
  });
23
23
  const Member = ClientControllerOnMember({
24
- guild_id: JoinVilla.villa_id,
25
- user_id: String(event.extend_data.EventData.JoinVilla.join_uid)
24
+ guild_id: JoinVilla.villaId,
25
+ user_id: String(event.extendData.joinVilla.joinUid)
26
26
  });
27
27
  /**
28
28
  * 制作e消息对象
@@ -38,8 +38,8 @@ export async function GUILD_MEMBERS(event) {
38
38
  name: event.robot.template.name,
39
39
  avatar: event.robot.template.icon
40
40
  },
41
- isMaster: masterID == String(JoinVilla.join_uid),
42
- guild_id: String(JoinVilla.villa_id),
41
+ isMaster: masterID == String(JoinVilla.joinUid),
42
+ guild_id: String(JoinVilla.villaId),
43
43
  guild_name: '',
44
44
  guild_avatar: '',
45
45
  channel_name: '',
@@ -55,10 +55,10 @@ export async function GUILD_MEMBERS(event) {
55
55
  msg_txt: '',
56
56
  open_id: '',
57
57
  //
58
- user_avatar: '',
59
- user_id: String(event.extend_data.EventData.JoinVilla.join_uid),
60
- user_name: event.extend_data.EventData.JoinVilla.join_user_nickname,
61
- send_at: JoinVilla.join_at,
58
+ user_avatar: '', // dodo 可以通过 请求权限获得
59
+ user_id: String(event.extendData.joinVilla.joinUid),
60
+ user_name: event.extendData.joinVilla.joinUserNickname,
61
+ send_at: JoinVilla.joinAt,
62
62
  segment: segmentVILLA,
63
63
  /**
64
64
  * 消息回复
@@ -77,11 +77,11 @@ export async function GUILD_MEMBERS(event) {
77
77
  console.error('VILLA 无私信');
78
78
  return false;
79
79
  }
80
- const villa_id = select?.guild_id ?? JoinVilla.villa_id;
81
- const room_id = select?.channel_id ?? false;
82
- if (!room_id)
80
+ const villaId = select?.guild_id ?? JoinVilla.villaId;
81
+ const roomId = select?.channel_id ?? false;
82
+ if (!roomId)
83
83
  return false;
84
- return await replyController(villa_id, room_id, msg, {
84
+ return await replyController(villaId, roomId, msg, {
85
85
  quote: select?.quote
86
86
  });
87
87
  },
@@ -11,17 +11,17 @@ import { ClientControllerOnMember, ClientControllerOnMessage } from '../controll
11
11
  export async function GUILD_MESSAGE_REACTIONS(event) {
12
12
  if (process.env?.ALEMONJS_EVENT == 'dev')
13
13
  console.info('event', event);
14
- const AddQuickEmoticon = event.extend_data.EventData.AddQuickEmoticon;
14
+ const AddQuickEmoticon = event.extendData.addQuickEmoticon;
15
15
  const cfg = getBotConfigByKey('villa');
16
16
  const masterID = cfg.masterID;
17
- const msg_id = `${AddQuickEmoticon.msg_uid}.${event.send_at}`;
17
+ const msg_id = `${AddQuickEmoticon.msgUid}.${event.sendAt}`;
18
18
  const Message = ClientControllerOnMessage({
19
- guild_id: AddQuickEmoticon.villa_id,
20
- channel_id: AddQuickEmoticon.room_id,
19
+ guild_id: AddQuickEmoticon.villaId,
20
+ channel_id: AddQuickEmoticon.roomId,
21
21
  msg_id: msg_id
22
22
  });
23
23
  const Member = ClientControllerOnMember({
24
- guild_id: AddQuickEmoticon.villa_id,
24
+ guild_id: AddQuickEmoticon.villaId,
25
25
  user_id: String(AddQuickEmoticon.uid)
26
26
  });
27
27
  /**
@@ -30,7 +30,7 @@ export async function GUILD_MESSAGE_REACTIONS(event) {
30
30
  const e = {
31
31
  platform: 'villa',
32
32
  event: 'GUILD_MESSAGE_REACTIONS',
33
- eventType: event.extend_data.EventData.AddQuickEmoticon.is_cancel
33
+ eventType: event.extendData.addQuickEmoticon.isCancel
34
34
  ? 'DELETE'
35
35
  : 'CREATE',
36
36
  boundaries: 'publick',
@@ -41,19 +41,19 @@ export async function GUILD_MESSAGE_REACTIONS(event) {
41
41
  avatar: event.robot.template.icon
42
42
  },
43
43
  isMaster: masterID == String(AddQuickEmoticon.uid),
44
- guild_id: String(AddQuickEmoticon.villa_id),
44
+ guild_id: String(AddQuickEmoticon.villaId),
45
45
  guild_name: '',
46
46
  guild_avatar: '',
47
47
  channel_name: '',
48
- channel_id: String(AddQuickEmoticon.room_id),
48
+ channel_id: String(AddQuickEmoticon.roomId),
49
49
  attachments: [],
50
50
  specials: [
51
51
  {
52
- emoticon_id: AddQuickEmoticon.emoticon_id,
52
+ emoticon_id: AddQuickEmoticon.emoticonId,
53
53
  emoticon_type: 0,
54
54
  emoticon: AddQuickEmoticon.emoticon,
55
- is_cancel: AddQuickEmoticon?.is_cancel ?? false,
56
- msg_uid: AddQuickEmoticon.msg_uid
55
+ is_cancel: AddQuickEmoticon?.isCancel ?? false,
56
+ msg_uid: AddQuickEmoticon.msgUid
57
57
  }
58
58
  ],
59
59
  //
@@ -66,9 +66,9 @@ export async function GUILD_MESSAGE_REACTIONS(event) {
66
66
  open_id: '',
67
67
  //
68
68
  user_id: String(AddQuickEmoticon.uid),
69
- user_name: '',
70
- user_avatar: '',
71
- send_at: event.send_at,
69
+ user_name: '', // dodo 可权限获得
70
+ user_avatar: '', // dodo 可权限获得
71
+ send_at: event.sendAt,
72
72
  segment: segmentVILLA,
73
73
  /**
74
74
  * 消息回复
@@ -81,9 +81,9 @@ export async function GUILD_MESSAGE_REACTIONS(event) {
81
81
  console.error('VILLA 无私信');
82
82
  return false;
83
83
  }
84
- const villa_id = select?.guild_id ?? AddQuickEmoticon.villa_id;
85
- const room_id = select?.channel_id ?? AddQuickEmoticon.room_id;
86
- return await replyController(villa_id, room_id, msg, {
84
+ const villaId = select?.guild_id ?? AddQuickEmoticon.villaId;
85
+ const roomId = select?.channel_id ?? AddQuickEmoticon.roomId;
86
+ return await replyController(villaId, roomId, msg, {
87
87
  quote: select?.quote
88
88
  });
89
89
  },
@@ -11,11 +11,11 @@ import { ClientControllerOnMessage, ClientControllerOnMember } from '../controll
11
11
  export async function MESSAGES(event) {
12
12
  if (process.env?.ALEMONJS_EVENT == 'dev')
13
13
  console.info('event', event);
14
- const SendMessage = event.extend_data.EventData.SendMessage;
14
+ const SendMessage = event.extendData.sendMessage;
15
15
  /**
16
16
  * 数据包解析
17
17
  */
18
- const MessageContent = JSON.parse(event.extend_data.EventData.SendMessage.content);
18
+ const MessageContent = JSON.parse(event.extendData.sendMessage.content);
19
19
  /**
20
20
  * 得到特效
21
21
  */
@@ -82,17 +82,17 @@ export async function MESSAGES(event) {
82
82
  const msg = txt.replace(/(@[^\s]+\s)(?!<)/g, '').trim();
83
83
  const cfg = getBotConfigByKey('villa');
84
84
  const masterID = cfg.masterID;
85
- const msg_id = `${SendMessage.msg_uid}.${SendMessage.send_at}`;
85
+ const msg_id = `${SendMessage.msgUid}.${SendMessage.sendAt}`;
86
86
  /**
87
87
  * 制作控制器
88
88
  */
89
89
  const Message = ClientControllerOnMessage({
90
- guild_id: SendMessage.villa_id,
91
- channel_id: SendMessage.room_id,
90
+ guild_id: SendMessage.villaId,
91
+ channel_id: SendMessage.roomId,
92
92
  msg_id: msg_id
93
93
  });
94
94
  const Member = ClientControllerOnMember({
95
- guild_id: SendMessage.villa_id,
95
+ guild_id: SendMessage.villaId,
96
96
  user_id: MessageContent.user.id
97
97
  });
98
98
  /**
@@ -110,11 +110,11 @@ export async function MESSAGES(event) {
110
110
  avatar: event.robot.template.icon
111
111
  },
112
112
  isMaster: MessageContent.user.id == masterID,
113
- guild_id: String(SendMessage.villa_id),
113
+ guild_id: String(SendMessage.villaId),
114
114
  guild_name: '',
115
115
  guild_avatar: '',
116
116
  channel_name: '',
117
- channel_id: String(SendMessage.room_id),
117
+ channel_id: String(SendMessage.roomId),
118
118
  attachments: [],
119
119
  specials: [],
120
120
  //
@@ -130,7 +130,7 @@ export async function MESSAGES(event) {
130
130
  user_name: MessageContent.user.name,
131
131
  user_avatar: MessageContent.user.portrait,
132
132
  //
133
- send_at: SendMessage.send_at,
133
+ send_at: SendMessage.sendAt,
134
134
  segment: segmentVILLA,
135
135
  /**
136
136
  *消息发送
@@ -143,9 +143,9 @@ export async function MESSAGES(event) {
143
143
  console.error('VILLA 无私信');
144
144
  return false;
145
145
  }
146
- const villa_id = select?.guild_id ?? SendMessage.villa_id;
147
- const room_id = select?.channel_id ?? SendMessage.room_id;
148
- return await replyController(villa_id, room_id, msg, {
146
+ const villaId = select?.guild_id ?? SendMessage.villaId;
147
+ const roomId = select?.channel_id ?? SendMessage.roomId;
148
+ return await replyController(villaId, roomId, msg, {
149
149
  quote: select?.quote
150
150
  });
151
151
  },