@alemonjs/discord 2.1.18 → 2.1.20

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,9 +67,10 @@ 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 customId = isCustom ? event.data.custom_id : '';
71
- const notAutoConfirmation = isCustom ? /^autoConfirmation:/.test(customId) : false;
72
- const currentMessageText = notAutoConfirmation ? customId.replace(/^autoConfirmation:/, '') : customId;
70
+ const isName = !!event.data?.name;
71
+ const command = isCustom ? event.data.custom_id : (isName ? `/${event.data.name}` : '');
72
+ const notAutoConfirmation = isCustom ? /^notAutoConfirmation:/.test(command) : false;
73
+ const currentMessageText = notAutoConfirmation ? command.replace(/^notAutoConfirmation:/, '') : command;
73
74
  if (isPrivate) {
74
75
  cbp.send(FormatEvent.create('private.interaction.create')
75
76
  .addPlatform({ Platform: platform, value: event, BotId: botId })
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?.notAutoConfirmation ? `notAutoConfirmation:${button.options.data}` : 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.18",
3
+ "version": "2.1.20",
4
4
  "description": "discord platform connection",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",