work-around d.js bug
This commit is contained in:
parent
61c9df599b
commit
2b8f616efe
|
@ -85,13 +85,18 @@ colorRoles.pruneOrphanRoles = async function() { // delete all color roles that
|
||||||
|
|
||||||
// event listeners
|
// event listeners
|
||||||
|
|
||||||
dClient.on('presenceUpdate', async (oldMember, newMember) => { // update color role on presence update // emitted also on member join
|
dClient.on('presenceUpdate', async (oldMember, newMember) => { // update color role on presence update // emitted also on member join (iirc)
|
||||||
if (!oldMember || !newMember) return; //TODO debug
|
/* if (!oldMember || !newMember) return;
|
||||||
if (!oldMember.presence || !newMember.presence) return;
|
if (!oldMember.presence || !newMember.presence) return;
|
||||||
|
// TODO discord.js bug?
|
||||||
|
// oldMember.presence & newMember.presence are undefined
|
||||||
|
|
||||||
if (oldMember.presence.status != newMember.presence.status) {
|
if (oldMember.presence.status != newMember.presence.status) {
|
||||||
await colorRoles.update(newMember);
|
await colorRoles.update(newMember);
|
||||||
}
|
}*/
|
||||||
|
await colorRoles.update(newMember.user.presence.status);
|
||||||
});
|
});
|
||||||
|
|
||||||
dClient.on('guildMemberRemove', async member => { // update (delete) color role on member leave
|
dClient.on('guildMemberRemove', async member => { // update (delete) color role on member leave
|
||||||
await colorRoles.update(member);
|
await colorRoles.update(member);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue