Skip to content

Commit

Permalink
fix(members): Use cached members for efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Crespi committed Dec 10, 2019
1 parent 1b6faf3 commit e5fe390
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/framework/commands/info/members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ export default class extends Command {

const msg = await this.sendReply(message, 'Checking all members...');

let lastId: string;
const steps = Math.ceil(guild.memberCount / 1000);
for (let i = 0; i < steps; i++) {
const mems = await guild.getRESTMembers(1000, lastId);
if (mems.length > 0) {
lastId = mems[mems.length - 1].id;
}
}

const botCount = guild.members.filter(m => m.user.bot).length;
const humanCount = guild.memberCount - botCount;
const offlineCount = guild.members.filter(m => m.status === 'offline').length;
Expand Down

0 comments on commit e5fe390

Please sign in to comment.