Skip to content

Commit

Permalink
feature: get messages by pagination (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: Can Sirin <[email protected]>
  • Loading branch information
cansirin and cansirin authored Mar 30, 2024
1 parent 72072e4 commit 1d5b1e6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/commands/recycle-v2-roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,22 @@ const recycleV2Roles = {
}
});

const removedUserListNames = removedUsers.join(", ");

let removedUserListNames = removedUsers.join(", ");

let message = dryRun
? `[DRYRUN] Done. ${count} members will be purged from v2 role.`
: `Done. ${count} members were removed from v2 role.`;
: `Done. ${count} members were removed from v2 role.\nMembers: ${removedUserListNames}`;

const channel = interaction.client.channels.cache.get(
process.env.GIDENLER_CHANNEL_ID
) as TextChannel;
if (!channel) return;
await channel.send(`${message} ${removedUserListNames}`);

const totalMessagePage = Math.ceil(message.length / 2000);
const offset = 2000;
for (let i = 0; i < totalMessagePage; i++) {
await channel.send(message.slice(i * offset, (i + 1) * offset));
}
},
};

Expand Down

0 comments on commit 1d5b1e6

Please sign in to comment.