@alemonjs/discord 2.1.17 → 2.1.19

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/index.js CHANGED
@@ -67,13 +67,15 @@ const main = () => {
67
67
  const UserName = user.username;
68
68
  const [isMaster, UserKey] = getMaster(UserId);
69
69
  const isCustom = !!event.data?.custom_id;
70
- const MessageText = isCustom ? event?.data?.custom_id : `/${event.data?.name}`;
70
+ const customId = isCustom ? event.data.custom_id : '';
71
+ const notAutoConfirmation = isCustom ? /^notAutoConfirmation:/.test(customId) : false;
72
+ const currentMessageText = notAutoConfirmation ? customId.replace(/^notAutoConfirmation:/, '') : customId;
71
73
  if (isPrivate) {
72
74
  cbp.send(FormatEvent.create('private.interaction.create')
73
75
  .addPlatform({ Platform: platform, value: event, BotId: botId })
74
76
  .addUser({ UserId, UserKey, UserName: UserName, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
75
77
  .addMessage({ MessageId: event.id })
76
- .addText({ MessageText: MessageText })
78
+ .addText({ MessageText: currentMessageText })
77
79
  .addOpen({ OpenId: UserId })
78
80
  .add({ tag: 'private.interaction.create' }).value);
79
81
  }
@@ -84,11 +86,13 @@ const main = () => {
84
86
  .addChannel({ ChannelId: event.channel_id })
85
87
  .addUser({ UserId, UserKey, UserName: UserName, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
86
88
  .addMessage({ MessageId: event.id })
87
- .addText({ MessageText: MessageText })
89
+ .addText({ MessageText: currentMessageText })
88
90
  .addOpen({ OpenId: UserId })
89
91
  .add({ tag: 'interaction.create' }).value);
90
92
  }
91
- void client.interactionsCallbackEphemeral(event.id, event.token, '正在处理您的请求...');
93
+ if (!notAutoConfirmation) {
94
+ void client.interactionsCallbackEphemeral(event.id, event.token, '正在处理...');
95
+ }
92
96
  });
93
97
  client.on('MESSAGE_UPDATE', event => {
94
98
  if (!event.author) {
package/lib/send.js CHANGED
@@ -11,7 +11,7 @@ const createButtonsData = (rows) => rows.map(row => ({
11
11
  type: 1,
12
12
  components: row.value.map(button => ({
13
13
  type: 2,
14
- custom_id: button.options?.data ?? '',
14
+ custom_id: button.options?.notAutoConfirmation ? `notAutoConfirmation:${button.options.data}` : (button.options?.data ?? ''),
15
15
  style: 1,
16
16
  label: button.value
17
17
  }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/discord",
3
- "version": "2.1.17",
3
+ "version": "2.1.19",
4
4
  "description": "discord platform connection",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",