Persist: fix errors when the leaving member was not cached
This commit is contained in:
parent
d0f8ec2b57
commit
96953ce159
1 changed files with 2 additions and 2 deletions
|
@ -31,7 +31,7 @@ export class PersistPlugin extends Plugin {
|
||||||
const persistData: IPartialPersistData = {};
|
const persistData: IPartialPersistData = {};
|
||||||
|
|
||||||
const persistedRoles = this.configValue("persisted_roles");
|
const persistedRoles = this.configValue("persisted_roles");
|
||||||
if (persistedRoles.length) {
|
if (persistedRoles.length && member.roles) {
|
||||||
const rolesToPersist = intersection(persistedRoles, member.roles);
|
const rolesToPersist = intersection(persistedRoles, member.roles);
|
||||||
if (rolesToPersist.length) {
|
if (rolesToPersist.length) {
|
||||||
persist = true;
|
persist = true;
|
||||||
|
@ -44,7 +44,7 @@ export class PersistPlugin extends Plugin {
|
||||||
persistData.nickname = member.nick;
|
persistData.nickname = member.nick;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.configValue("persist_voice_mutes") && member.voiceState.mute) {
|
if (this.configValue("persist_voice_mutes") && member.voiceState && member.voiceState.mute) {
|
||||||
persist = true;
|
persist = true;
|
||||||
persistData.is_voice_muted = true;
|
persistData.is_voice_muted = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue