mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-18 23:55:02 +00:00
Work on better error messages for mod actions, allow muting users that are not on the server; WIP
This commit is contained in:
parent
1f79ea7e90
commit
4e5f87fb49
9 changed files with 272 additions and 125 deletions
|
@ -69,35 +69,36 @@ export class PersistPlugin extends ZeppelinPlugin<IPersistPluginConfig> {
|
|||
const persistedData = await this.persistedData.find(member.id);
|
||||
if (!persistedData) return;
|
||||
|
||||
let restore = false;
|
||||
const toRestore: MemberOptions = {};
|
||||
const config = this.getConfig();
|
||||
const restoredData = [];
|
||||
|
||||
const persistedRoles = config.persisted_roles;
|
||||
if (persistedRoles.length) {
|
||||
const rolesToRestore = intersection(persistedRoles, persistedData.roles);
|
||||
if (rolesToRestore.length) {
|
||||
restore = true;
|
||||
restoredData.push("roles");
|
||||
toRestore.roles = rolesToRestore;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.persist_nicknames && persistedData.nickname) {
|
||||
restore = true;
|
||||
restoredData.push("nickname");
|
||||
toRestore.nick = persistedData.nickname;
|
||||
}
|
||||
|
||||
if (config.persist_voice_mutes && persistedData.is_voice_muted) {
|
||||
restore = true;
|
||||
restoredData.push("voice mute");
|
||||
toRestore.mute = true;
|
||||
}
|
||||
|
||||
if (restore) {
|
||||
if (restoredData.length) {
|
||||
await member.edit(toRestore, "Restored upon rejoin");
|
||||
await this.persistedData.clear(member.id);
|
||||
|
||||
this.logs.log(LogType.MEMBER_RESTORE, {
|
||||
member: stripObjectToScalars(member, ["user"]),
|
||||
restoredData: restoredData.join(", "),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue