Brozy123 commited on
Commit
dcd68ff
·
verified ·
1 Parent(s): b5a9244

Update dmall.js

Browse files
Files changed (1) hide show
  1. dmall.js +5 -2
dmall.js CHANGED
@@ -78,15 +78,18 @@ async function initiateDMAll(ctx) {
78
  );
79
 
80
  let sentCount = 0;
 
81
  for (const [id, member] of members) {
82
  try {
83
  await member.send({ embeds: [dmEmbed], components: [row] });
84
  sentCount++;
85
- // Small delay to prevent rate limits for large servers
86
- if (sentCount % 10 === 0) await new Promise(resolve => setTimeout(resolve, 500));
87
  } catch (err) {
88
  // Ignore members with closed DMs
89
  }
 
 
 
 
90
  }
91
 
92
  const successMsg = `✅ **DM-All Complete**: Successfully sent invitations to **${sentCount}** members.`;
 
78
  );
79
 
80
  let sentCount = 0;
81
+ let processedCount = 0;
82
  for (const [id, member] of members) {
83
  try {
84
  await member.send({ embeds: [dmEmbed], components: [row] });
85
  sentCount++;
 
 
86
  } catch (err) {
87
  // Ignore members with closed DMs
88
  }
89
+
90
+ processedCount++;
91
+ // Delay 4 seconds every 2 players
92
+ if (processedCount % 2 === 0) await new Promise(resolve => setTimeout(resolve, 4000));
93
  }
94
 
95
  const successMsg = `✅ **DM-All Complete**: Successfully sent invitations to **${sentCount}** members.`;