From 5a0f8badcaa4ecc1784db75996fc31ad3491f695 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 12 Jan 2020 17:05:55 +0200 Subject: [PATCH] Persist: remove voice mute persist support Since voice mutes cannot be re-applied unless the member is in voice, we can't re-apply the voice mute automatically on join and would have to do it later when they first join voice, which could get messy if they were not supposed to be voice muted anymore after all (if they e.g. don't use voice for a long time). --- backend/src/data/GuildPersistedData.ts | 2 -- backend/src/plugins/Persist.ts | 12 ------------ 2 files changed, 14 deletions(-) diff --git a/backend/src/data/GuildPersistedData.ts b/backend/src/data/GuildPersistedData.ts index 544581df..2120916b 100644 --- a/backend/src/data/GuildPersistedData.ts +++ b/backend/src/data/GuildPersistedData.ts @@ -5,7 +5,6 @@ import { getRepository, Repository } from "typeorm"; export interface IPartialPersistData { roles?: string[]; nickname?: string; - is_voice_muted?: boolean; } export class GuildPersistedData extends BaseGuildRepository { @@ -29,7 +28,6 @@ export class GuildPersistedData extends BaseGuildRepository { const finalData: any = {}; if (data.roles) finalData.roles = data.roles.join(","); if (data.nickname) finalData.nickname = data.nickname; - if (data.is_voice_muted != null) finalData.is_voice_muted = data.is_voice_muted ? 1 : 0; const existing = await this.find(userId); if (existing) { diff --git a/backend/src/plugins/Persist.ts b/backend/src/plugins/Persist.ts index 4b543b11..181679aa 100644 --- a/backend/src/plugins/Persist.ts +++ b/backend/src/plugins/Persist.ts @@ -11,7 +11,6 @@ import * as t from "io-ts"; const ConfigSchema = t.type({ persisted_roles: t.array(t.string), persist_nicknames: t.boolean, - persist_voice_mutes: t.boolean, }); type TConfigSchema = t.TypeOf; @@ -34,7 +33,6 @@ export class PersistPlugin extends ZeppelinPlugin { config: { persisted_roles: [], persist_nicknames: false, - persist_voice_mutes: false, }, }; } @@ -64,11 +62,6 @@ export class PersistPlugin extends ZeppelinPlugin { persistData.nickname = member.nick; } - if (config.persist_voice_mutes && member.voiceState && member.voiceState.mute) { - persist = true; - persistData.is_voice_muted = true; - } - if (persist) { this.persistedData.set(member.id, persistData); } @@ -97,11 +90,6 @@ export class PersistPlugin extends ZeppelinPlugin { toRestore.nick = persistedData.nickname; } - if (config.persist_voice_mutes && persistedData.is_voice_muted) { - restoredData.push("voice mute"); - toRestore.mute = true; - } - if (restoredData.length) { await member.edit(toRestore, "Restored upon rejoin"); await this.persistedData.clear(member.id);