refactor: hardcode Elysian role ID instead of env var

This commit is contained in:
2026-03-24 18:15:27 -07:00
committed by Naomi Carrigan
parent 2c34fe2c81
commit 8ccc3f4d0d
3 changed files with 7 additions and 20 deletions
+6 -3
View File
@@ -15,6 +15,11 @@ const discordApi = "https://discord.com/api/v10";
*/
const suppressNotifications = 4096;
/**
* The Discord role ID for the Elysian role granted to all Elysium players.
*/
const elysianRoleId = "1486144823684628490";
/**
* Grants the Elysian Discord role to the given player and returns whether they are in the guild.
* Fails silently so role grant errors do not affect the auth flow.
@@ -24,19 +29,17 @@ const suppressNotifications = 4096;
const grantElysianRole = async(discordId: string): Promise<boolean> => {
const botToken = process.env.DISCORD_BOT_TOKEN;
const guildId = process.env.DISCORD_GUILD_ID;
const roleId = process.env.DISCORD_ELYSIAN_ROLE_ID;
if (
botToken === undefined || botToken === ""
|| guildId === undefined || guildId === ""
|| roleId === undefined || roleId === ""
) {
return false;
}
try {
const response = await fetch(
`${discordApi}/guilds/${guildId}/members/${discordId}/roles/${roleId}`,
`${discordApi}/guilds/${guildId}/members/${discordId}/roles/${elysianRoleId}`,
{
headers: {
"Authorization": `Bot ${botToken}`,