Skip to content

Commit

Permalink
add linked roles
Browse files Browse the repository at this point in the history
keeps a secondary role persistent
based on a primary role
(normal and heroic raid roles)
  • Loading branch information
waggz81 committed Dec 18, 2023
1 parent 1ba3450 commit f5877c3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions events/guildMemberUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import {
} from "discord.js";
import {client, myLog, updateStatus} from "../index";

const linkedroles: (string | [string, unknown])[] = []
Object.entries(config.linkedroles).forEach((entry) => {
linkedroles.push([entry[0],entry[1]]);
})

client.on(Events.GuildMemberUpdate, async (oldMember, newMember) => {
let changes = '';
let rolechanges = false;
Expand Down Expand Up @@ -39,6 +44,10 @@ client.on(Events.GuildMemberUpdate, async (oldMember, newMember) => {
welcome = true;
}
}
const thisRole = role.id;
if (config.linkedroles[thisRole]) {
newMember.roles.add(config.linkedroles[thisRole]).catch(myLog);
}
});
if (rolechanges) {
changes += `**__Role Changes:__**\n${changedroles}`;
Expand Down

0 comments on commit f5877c3

Please sign in to comment.