mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-18 15:45:03 +00:00
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).
This commit is contained in:
parent
72783628b4
commit
4c404aa2a3
2 changed files with 0 additions and 14 deletions
|
@ -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) {
|
||||
|
|
|
@ -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<typeof ConfigSchema>;
|
||||
|
||||
|
@ -34,7 +33,6 @@ export class PersistPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
config: {
|
||||
persisted_roles: [],
|
||||
persist_nicknames: false,
|
||||
persist_voice_mutes: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -64,11 +62,6 @@ export class PersistPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
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<TConfigSchema> {
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue