mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
housekeeping/discord: respect remove role on disable setting
only remove it if it's set to true.
This commit is contained in:
@@ -31,6 +31,7 @@ func (app *appContext) clearEmails() {
|
|||||||
func (app *appContext) clearDiscord() {
|
func (app *appContext) clearDiscord() {
|
||||||
app.debug.Println(lm.HousekeepingDiscord)
|
app.debug.Println(lm.HousekeepingDiscord)
|
||||||
discordUsers := app.storage.GetDiscord()
|
discordUsers := app.storage.GetDiscord()
|
||||||
|
removeRoleOnDisable := app.config.Section("discord").Key("disable_enable_role").MustBool(false)
|
||||||
for _, discordUser := range discordUsers {
|
for _, discordUser := range discordUsers {
|
||||||
user, err := app.jf.UserByID(discordUser.JellyfinID, false)
|
user, err := app.jf.UserByID(discordUser.JellyfinID, false)
|
||||||
// Make sure the user doesn't exist, and no other error has occured
|
// Make sure the user doesn't exist, and no other error has occured
|
||||||
@@ -40,7 +41,7 @@ func (app *appContext) clearDiscord() {
|
|||||||
app.discord.RemoveRole(discordUser.MethodID().(string))
|
app.discord.RemoveRole(discordUser.MethodID().(string))
|
||||||
app.storage.DeleteDiscordKey(discordUser.JellyfinID)
|
app.storage.DeleteDiscordKey(discordUser.JellyfinID)
|
||||||
default:
|
default:
|
||||||
if user.Policy.IsDisabled {
|
if removeRoleOnDisable && user.Policy.IsDisabled {
|
||||||
app.discord.RemoveRole(discordUser.MethodID().(string))
|
app.discord.RemoveRole(discordUser.MethodID().(string))
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user