mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-06-08 08:34:20 +02:00
Add assigning Référent role
This commit is contained in:
parent
90571c59ea
commit
ca52d1a108
@ -286,7 +286,7 @@ async function setAllRoles(client: Client) {
|
||||
: ""
|
||||
)
|
||||
|
||||
const referentRoleIds: { [key: string]: string } = _.mapValues(teamIds, (v) =>
|
||||
const teamReferentRoleIds: { [key: string]: string } = _.mapValues(teamIds, (v) =>
|
||||
_.isEmpty(v)
|
||||
? ""
|
||||
: guild.roles.cache.find((role) => role.name === `Référent-${v}`)?.id || ""
|
||||
@ -295,13 +295,26 @@ async function setAllRoles(client: Client) {
|
||||
await setVolunteersRoles(
|
||||
guild,
|
||||
volunteerByDiscordIdNoOrga,
|
||||
referentRoleIds,
|
||||
teamReferentRoleIds,
|
||||
(volunteer: Volunteer) =>
|
||||
_.includes(["oui", "peut-etre", "à distance"], volunteer.active) &&
|
||||
volunteer.roles.includes("référent")
|
||||
? `${volunteer.team}`
|
||||
: "0"
|
||||
)
|
||||
|
||||
const referentRoleId = guild.roles.cache.find((role) => role.name === `Référent`)?.id
|
||||
|
||||
await setVolunteersRoles(
|
||||
guild,
|
||||
volunteerByDiscordIdNoOrga,
|
||||
referentRoleId ? { ref: referentRoleId } : {},
|
||||
(volunteer: Volunteer) =>
|
||||
_.includes(["oui", "peut-etre", "à distance"], volunteer.active) &&
|
||||
volunteer.roles.includes("référent")
|
||||
? "ref"
|
||||
: ""
|
||||
)
|
||||
} catch (error) {
|
||||
console.error("Error in setAllRoles", error)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user