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