Fix role member counts, add threads to channel info command

This commit is contained in:
Dark 2021-07-29 18:46:52 +02:00
parent 3c6c9ebecf
commit 0053f55576
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
2 changed files with 38 additions and 17 deletions

View file

@ -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());