diff --git a/src/structure/components/observers/GuildLogging.js b/src/structure/components/observers/GuildLogging.js index a8feb64..77767cd 100644 --- a/src/structure/components/observers/GuildLogging.js +++ b/src/structure/components/observers/GuildLogging.js @@ -97,7 +97,7 @@ class GuildLogger extends Observer { if (!logChannel) return; const owner = await guild.resolveUser(ownerId); - const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); + const missing = logChannel.permissionsFor(this.client.user).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild, logger: 'threadLogger', reason: 'MSGLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -527,7 +527,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(_channel); if (!logChannel) return undefined; - const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages', 'ManageWebhooks']); + const missing = logChannel.permissionsFor(this.client.user).missing(['ViewChannel', 'EmbedLinks', 'SendMessages', 'ManageWebhooks']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'messageLogger', reason: 'MSGLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -643,7 +643,7 @@ class GuildLogger extends Observer { async voiceState(oldState, newState) { if (oldState.channel && newState.channel && oldState.channel === newState.channel) return; - const { guild, member, guildWrapper: wrapper } = oldState; + const { member, guildWrapper: wrapper } = oldState; //TODO: add checks for disconnecting bot from vc when left alone in one (music player) @@ -654,7 +654,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(setting.channel); if (!logChannel) return; - const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); + const missing = logChannel.permissionsFor(this.client.user).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'vcLogger', reason: 'VCLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -690,7 +690,7 @@ class GuildLogger extends Observer { async memberJoin(member) { - const { guild, guildWrapper: wrapper } = member; + const { guildWrapper: wrapper } = member; const settings = await wrapper.settings(); const setting = settings.members; if (!setting.channel || !setting.enabled) return; @@ -698,13 +698,13 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(setting.channel); if (!logChannel) return; - const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); + const missing = logChannel.permissionsFor(this.client.user).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'vcLogger', reason: 'MEMBERLOG_NO_PERMS', params: { missing: missing.join(', ') } }); let { join: joinMessage } = setting; joinMessage = this._replaceTags(joinMessage, member); - this.client.rateLimiter.queueSend(logChannel, joinMessage); + await this.client.rateLimiter.queueSend(logChannel, joinMessage); } @@ -718,13 +718,13 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(setting.channel); if (!logChannel) return; - const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); + const missing = logChannel.permissionsFor(this.client.user).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'vcLogger', reason: 'MEMBERLOG_NO_PERMS', params: { missing: missing.join(', ') } }); let { leave: leaveMessage } = setting; leaveMessage = this._replaceTags(leaveMessage, member); - this.client.rateLimiter.queueSend(logChannel, leaveMessage); + await this.client.rateLimiter.queueSend(logChannel, leaveMessage); } @@ -740,7 +740,7 @@ class GuildLogger extends Observer { const logChannel = await wrapper.resolveChannel(setting.channel); if (!logChannel) return; - const missing = logChannel.permissionsFor(guild.members.me).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); + const missing = logChannel.permissionsFor(this.client.user).missing(['ViewChannel', 'EmbedLinks', 'SendMessages']); if (missing.length) return this.client.emit('logError', { guild: wrapper, logger: 'vcLogger', reason: 'NICKLOG_NO_PERMS', params: { missing: missing.join(', ') } }); @@ -756,7 +756,7 @@ class GuildLogger extends Observer { color: CONSTANTS.COLORS.BLUE }; - logChannel.send({ embeds: [embed] }); + await logChannel.send({ embeds: [embed] }); }