diff --git a/server/events/guildMemberUpdate.ts b/server/events/guildMemberUpdate.ts index 7820d70..5949ec9 100644 --- a/server/events/guildMemberUpdate.ts +++ b/server/events/guildMemberUpdate.ts @@ -2,22 +2,23 @@ import { Collection, GuildMember } from "discord.js" import { filterRolesFromMemberUpdate } from "../helper/roleFilter" import { ChangedRoles, PermissionLevel } from "../interfaces" import { jellyfinHandler } from "../.." +import { v4 as uuid } from "uuid" export const name = 'guildMemberUpdate' export async function execute(oldMember: GuildMember, newMember: GuildMember) { try { - + const requestId = uuid() const changedRoles: ChangedRoles = filterRolesFromMemberUpdate(oldMember, newMember) const triggerRoleIds: Collection = getGuildSpecificTriggerRoleId(oldMember.guild.id) triggerRoleIds.forEach((level, key) => { const addedRoleMatches = changedRoles.addedRoles.find(aRole => aRole.id === key) if (addedRoleMatches) { - jellyfinHandler.upsertUser(newMember, level) + jellyfinHandler.upsertUser(newMember, level, requestId) } const removedRoleMatches = changedRoles.removedRoles.find(rRole => rRole.id === key) if (removedRoleMatches) { - jellyfinHandler.removeUser(newMember) + jellyfinHandler.removeUser(newMember, requestId) } }) } catch (error) {