make jf roles configurable via env vars
This commit is contained in:
parent
e234e9f68f
commit
3294d9ca77
@ -20,6 +20,8 @@ export interface Config {
|
|||||||
jellyfin_url: string
|
jellyfin_url: string
|
||||||
port: number
|
port: number
|
||||||
workaround_token: string
|
workaround_token: string
|
||||||
|
watcher_role: string
|
||||||
|
jf_admin_role: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const config: Config = {
|
export const config: Config = {
|
||||||
@ -49,6 +51,8 @@ export const config: Config = {
|
|||||||
client_id: process.env.CLIENT_ID ?? "",
|
client_id: process.env.CLIENT_ID ?? "",
|
||||||
jellfin_token: process.env.JELLYFIN_TOKEN ?? "",
|
jellfin_token: process.env.JELLYFIN_TOKEN ?? "",
|
||||||
jellyfin_url: process.env.JELLYFIN_URL ?? "",
|
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 ?? ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Collection, GuildMember } from "discord.js"
|
import { Collection, GuildMember } from "discord.js"
|
||||||
import { ChangedRoles, PermissionLevel } from "../interfaces"
|
import { ChangedRoles, PermissionLevel } from "../interfaces"
|
||||||
import { logger } from "../logger"
|
import { logger } from "../logger"
|
||||||
|
import { config } from "../configuration"
|
||||||
|
|
||||||
export function filterRolesFromMemberUpdate(oldMember: GuildMember, newMember: GuildMember): ChangedRoles {
|
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> {
|
export function getGuildSpecificTriggerRoleId(guildId: string): Collection<string, PermissionLevel> {
|
||||||
const outVal = new Collection<string, PermissionLevel>()
|
const outVal = new Collection<string, PermissionLevel>()
|
||||||
outVal.set('1096819983889215659', "VIEWER")
|
outVal.set(config.bot.watcher_role, "VIEWER")
|
||||||
outVal.set('1097990848613986526', "ADMIN")
|
outVal.set(config.bot.jf_admin_role, "ADMIN")
|
||||||
return outVal
|
return outVal
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user