make jf roles configurable via env vars

This commit is contained in:
mightypanders 2023-06-08 17:10:06 +02:00
parent e234e9f68f
commit 3294d9ca77
2 changed files with 9 additions and 4 deletions

View File

@ -20,6 +20,8 @@ export interface Config {
jellyfin_url: string
port: number
workaround_token: string
watcher_role: string
jf_admin_role: string
}
}
export const config: Config = {
@ -49,6 +51,8 @@ export const config: Config = {
client_id: process.env.CLIENT_ID ?? "",
jellfin_token: process.env.JELLYFIN_TOKEN ?? "",
jellyfin_url: process.env.JELLYFIN_URL ?? "",
workaround_token: process.env.TOKEN ?? ""
workaround_token: process.env.TOKEN ?? "",
watcher_role: process.env.WATCHER_ROLE ?? "",
jf_admin_role: process.env.ADMIN_ROLE ?? ""
}
}

View File

@ -1,6 +1,7 @@
import { Collection, GuildMember } from "discord.js"
import { ChangedRoles, PermissionLevel } from "../interfaces"
import { logger } from "../logger"
import { config } from "../configuration"
export function filterRolesFromMemberUpdate(oldMember: GuildMember, newMember: GuildMember): ChangedRoles {
@ -17,7 +18,7 @@ export function filterRolesFromMemberUpdate(oldMember: GuildMember, newMember: G
export function getGuildSpecificTriggerRoleId(guildId: string): Collection<string, PermissionLevel> {
const outVal = new Collection<string, PermissionLevel>()
outVal.set('1096819983889215659', "VIEWER")
outVal.set('1097990848613986526', "ADMIN")
outVal.set(config.bot.watcher_role, "VIEWER")
outVal.set(config.bot.jf_admin_role, "ADMIN")
return outVal
}
}