APRK01 commited on
Commit
628c8dc
Β·
1 Parent(s): 264934b

fix: resolve discord api interaction failures on massdrop dashboard

Browse files
Files changed (1) hide show
  1. src/systems/massdrop.js +34 -17
src/systems/massdrop.js CHANGED
@@ -128,26 +128,36 @@ function generateDashboard(session) {
128
  // though the core engine still processes all 50+.
129
  const safeOptions = options.slice(0, 25);
130
 
131
- const row1 = new ActionRowBuilder().addComponents(
132
- new StringSelectMenuBuilder()
133
- .setCustomId('mass_select_edit')
134
- .setPlaceholder('✏️ Select a drop to edit text...')
135
- .addOptions(safeOptions)
136
- );
 
 
 
 
 
137
 
138
- const row2 = new ActionRowBuilder().addComponents(
139
- new StringSelectMenuBuilder()
140
- .setCustomId('mass_select_image')
141
- .setPlaceholder('πŸ–ΌοΈ Select a drop to attach an image...')
142
- .addOptions(safeOptions)
143
- );
 
 
 
144
 
145
- const row3 = new ActionRowBuilder().addComponents(
146
- new ButtonBuilder().setCustomId('mass_deploy').setLabel(`Deploy ${session.files.length} Drops`).setStyle(ButtonStyle.Success).setEmoji('πŸš€'),
147
- new ButtonBuilder().setCustomId('mass_cancel').setLabel('Cancel All').setStyle(ButtonStyle.Danger)
 
 
148
  );
149
 
150
- return { embeds: [embed], components: [row1, row2, row3] };
151
  }
152
 
153
  /**
@@ -401,6 +411,13 @@ async function handleMassDropInteraction(interaction) {
401
  return true;
402
  }
403
 
 
 
 
 
 
 
 
404
  if (customId === 'mass_deploy') {
405
  session.step = 'deploying';
406
  await interaction.update({
@@ -476,7 +493,7 @@ async function handleMassDropInteraction(interaction) {
476
  })],
477
  components: [
478
  new ActionRowBuilder().addComponents(
479
- new ButtonBuilder().setCustomId('mass_finish').setLabel('Cancel Attachment').setStyle(ButtonStyle.Secondary)
480
  )
481
  ]
482
  });
 
128
  // though the core engine still processes all 50+.
129
  const safeOptions = options.slice(0, 25);
130
 
131
+ const components = [];
132
+
133
+ if (safeOptions.length > 0) {
134
+ components.push(
135
+ new ActionRowBuilder().addComponents(
136
+ new StringSelectMenuBuilder()
137
+ .setCustomId('mass_select_edit')
138
+ .setPlaceholder('✏️ Select a drop to edit text...')
139
+ .addOptions(safeOptions)
140
+ )
141
+ );
142
 
143
+ components.push(
144
+ new ActionRowBuilder().addComponents(
145
+ new StringSelectMenuBuilder()
146
+ .setCustomId('mass_select_image')
147
+ .setPlaceholder('πŸ–ΌοΈ Select a drop to attach an image...')
148
+ .addOptions(safeOptions)
149
+ )
150
+ );
151
+ }
152
 
153
+ components.push(
154
+ new ActionRowBuilder().addComponents(
155
+ new ButtonBuilder().setCustomId('mass_deploy').setLabel(`Deploy ${session.files.length} Drops`).setStyle(ButtonStyle.Success).setEmoji('πŸš€'),
156
+ new ButtonBuilder().setCustomId('mass_cancel').setLabel('Cancel All').setStyle(ButtonStyle.Danger)
157
+ )
158
  );
159
 
160
+ return { embeds: [embed], components };
161
  }
162
 
163
  /**
 
411
  return true;
412
  }
413
 
414
+ if (customId === 'mass_cancel_image') {
415
+ session.step = 'dashboard';
416
+ session.pendingImageIndex = null;
417
+ await interaction.update(generateDashboard(session));
418
+ return true;
419
+ }
420
+
421
  if (customId === 'mass_deploy') {
422
  session.step = 'deploying';
423
  await interaction.update({
 
493
  })],
494
  components: [
495
  new ActionRowBuilder().addComponents(
496
+ new ButtonBuilder().setCustomId('mass_cancel_image').setLabel('Cancel Attachment').setStyle(ButtonStyle.Secondary)
497
  )
498
  ]
499
  });