From 9ca14d5e399bc8193fd17a1867202184ce12647a Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Thu, 1 Sep 2022 18:40:43 +0300 Subject: [PATCH] bugfix --- src/structure/components/observers/Automoderation.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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);