diff options
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/moderation/massBan.ts | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/commands/moderation/massBan.ts b/src/commands/moderation/massBan.ts index 499bcd4..3a613cd 100644 --- a/src/commands/moderation/massBan.ts +++ b/src/commands/moderation/massBan.ts @@ -94,15 +94,23 @@ export default class MassBanCommand extends BushCommand { const success = (res: BanResponse): boolean => [banResponse.SUCCESS, banResponse.DM_ERROR].includes(res as any); - const embed = new Embed() - .setTitle(`Mass Ban Results`) - .setDescription( - res - .map((r, i) => `${success(r) ? util.emojis.success : util.emojis.error} ${ids[i]}${success(r) ? '' : ` - ${r}`}`) - .join('\n') - ) - .setColor(util.colors.DarkRed); - - return message.util.send({ embeds: [embed] }); + const embeds: Embed[] = []; + + for (let i = 0; i < res.length; i++) { + const embed = ()=> embeds[embeds.push(new Embed().setColor(util.colors.DarkRed))-1] + + const row = `${success(res[i]) ? util.emojis.success : util.emojis.error} ${ids[i]}${success(res[i]) ? '' : ` - ${res[i]}`}` + + let currentEmbed = embeds.length ? embeds[embeds.length-1] : embed() + + if (`${currentEmbed.description}\n${row}`.length >= 2048) currentEmbed = embed() + currentEmbed.setDescription(`${currentEmbed.description}\n${row}`) + } + + assert(embeds.length >=1) + + embeds[0].setTitle(`Mass Ban Results`) + + return message.util.send({ embeds }); } } |