fix color roles

This commit is contained in:
Lamp 2020-04-14 11:20:43 -07:00
parent 56b017af28
commit bf6e7fad5e
1 changed files with 2 additions and 2 deletions

View File

@ -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 {