fix color roles
This commit is contained in:
parent
56b017af28
commit
bf6e7fad5e
|
@ -1,7 +1,7 @@
|
|||
global.colorRoles = new Object();
|
||||
|
||||
colorRoles.findColorRole = function (member) { // get color role of member
|
||||
return member.roles.find(role => role.name.startsWith('['));
|
||||
return member.roles.cache.find(role => role.name.startsWith('['));
|
||||
};
|
||||
|
||||
colorRoles.update = async function (member) { // create or remove member's color role based on presence
|
||||
|
@ -75,7 +75,7 @@ colorRoles.updateAll = async function() { // update all members' color roles
|
|||
colorRoles.pruneOrphanRoles = async function() { // delete all color roles that have no member
|
||||
console.log("Pruning orphan roles");
|
||||
var guild = dClient.defaultGuild || dClient.guilds.resolve(config.guildID);
|
||||
for (let role of guild.roles) {
|
||||
for (let role of guild.roles.cache) {
|
||||
role = role[1];
|
||||
if (role.name.startsWith('[') && !role.members.size) {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue