Remove Orga members from discord role assignments

This commit is contained in:
pikiou 2023-03-21 14:11:47 +01:00
parent 71fd770a27
commit 5b9c12cd7e

View File

@ -265,16 +265,25 @@ async function setAllRoles(client: Client) {
"0": "", "0": "",
} }
const volunteerByDiscordIdNoOrga = _.pickBy(
volunteerByDiscordId,
(volunteer: Volunteer) => volunteer.team !== 13
)
const teamRoleIds: { [key: string]: string } = _.mapValues(teamIds, (v) => const teamRoleIds: { [key: string]: string } = _.mapValues(teamIds, (v) =>
_.isEmpty(v) _.isEmpty(v)
? "" ? ""
: guild.roles.cache.find((role) => role.name === `Team-${v}`)?.id || "" : guild.roles.cache.find((role) => role.name === `Team-${v}`)?.id || ""
) )
await setVolunteersRoles(guild, volunteerByDiscordId, teamRoleIds, (volunteer: Volunteer) => await setVolunteersRoles(
_.includes(["oui", "peut-etre", "à distance"], volunteer.active) guild,
? `${volunteer.team}` volunteerByDiscordIdNoOrga,
: "" teamRoleIds,
(volunteer: Volunteer) =>
_.includes(["oui", "peut-etre", "à distance"], volunteer.active)
? `${volunteer.team}`
: ""
) )
const referentRoleIds: { [key: string]: string } = _.mapValues(teamIds, (v) => const referentRoleIds: { [key: string]: string } = _.mapValues(teamIds, (v) =>
@ -285,7 +294,7 @@ async function setAllRoles(client: Client) {
await setVolunteersRoles( await setVolunteersRoles(
guild, guild,
volunteerByDiscordId, volunteerByDiscordIdNoOrga,
referentRoleIds, referentRoleIds,
(volunteer: Volunteer) => (volunteer: Volunteer) =>
_.includes(["oui", "peut-etre", "à distance"], volunteer.active) && _.includes(["oui", "peut-etre", "à distance"], volunteer.active) &&