mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-06-08 08:34:20 +02:00
Remove Orga members from discord role assignments
This commit is contained in:
parent
71fd770a27
commit
5b9c12cd7e
@ -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) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user