Fix role member counts, add threads to channel info command
This commit is contained in:
parent
3c6c9ebecf
commit
0053f55576
2 changed files with 38 additions and 17 deletions
|
@ -34,13 +34,9 @@ export const RolesCmd = utilityCmd({
|
|||
if (args.counts) {
|
||||
await refreshMembersIfNeeded(guild);
|
||||
|
||||
// If the user requested role member counts as well, calculate them and sort the roles by their member count
|
||||
const roleCounts: Map<string, number> = Array.from(guild.members.cache.values()).reduce((map, member) => {
|
||||
for (const roleId of member.roles.cache) {
|
||||
if (!map.has(roleId)) map.set(roleId, 0);
|
||||
map.set(roleId, map.get(roleId) + 1);
|
||||
}
|
||||
|
||||
// If the user requested role member counts as well, fetch them and sort the roles by their member count
|
||||
const roleCounts: Map<string, number> = Array.from(guild.roles.cache.values()).reduce((map, role) => {
|
||||
map.set(role.id, role.members.size);
|
||||
return map;
|
||||
}, new Map());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue