diff --git a/src/structure/components/observers/Automoderation.js b/src/structure/components/observers/Automoderation.js index 8d3b8e5..903c785 100644 --- a/src/structure/components/observers/Automoderation.js +++ b/src/structure/components/observers/Automoderation.js @@ -212,12 +212,13 @@ module.exports = class AutoModeration extends Observer { filterResult.filter = 'word'; log += `\nFilter result: ${inspect(filterResult)}`; - if (!silent) { - const res = await this.client.rateLimiter.limitSend(msg.channel, wrapper.format('W_FILTER_DELETE', { user: author.id }), undefined, 'wordFilter').catch(catcher(255)); + + if (!silent && channel.permissionsFor(this.client.user)?.has('SendMessages')) { + const res = await this.client.rateLimiter.limitSend(msg.channel, wrapper.format('W_FILTER_DELETE', { user: author.id }), undefined, 'wordFilter').catch(() => null); //const res = await msg.formattedRespond('W_FILTER_DELETE', { params: { user: author.id } }); //if (res) res.delete({ timeout: 10000 }).catch(catcher(240)); setTimeout(() => { - res.delete?.().catch(() => { /**/ }); + res?.delete?.().catch(() => { /**/ }); }, 10000); } this.client.rateLimiter.queueDelete(msg.channel, msg).catch(() => null);