Skip to content

Commit

Permalink
Merge pull request #361 from lenisko/fix_roles_check
Browse files Browse the repository at this point in the history
Fix roles change check
  • Loading branch information
TurtIeSocks authored Apr 12, 2021
2 parents aec6487 + cc370fd commit f57e26a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/services/events/guildMemberUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ module.exports = async (client, oldPresence, newPresence) => {
const rolesAfter = newPresence.roles.cache
.filter(x => BigInt(x.id).toString())
.keyArray();
const perms = Object.values(client.config.discord.perms)
.map(x => x.roles)
.reduce(x => [...x]);
const perms = [...new Set(
Object.values(client.config.discord.perms)
.map(x => x.roles)
.flat()
)];
const roleDiff = rolesBefore
.filter(x => !rolesAfter.includes(x))
.concat(rolesAfter
Expand Down

0 comments on commit f57e26a

Please sign in to comment.