Persist: fix errors when the leaving member was not cached

This commit is contained in:
Miikka 2018-12-25 09:21:29 +02:00 committed by GitHub
parent d0f8ec2b57
commit 96953ce159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
} }