diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 20:24:50 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 20:24:50 -0400 |
commit | c4c1d9ffeb179e208792c88dd099caea5030581b (patch) | |
tree | dc075bda115de5f6cec925c398f3c9547d1bad55 /src/listeners/message | |
parent | c238b0279c7686ca45506b0909e376f241cf0e30 (diff) | |
download | tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.tar.gz tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.tar.bz2 tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.zip |
add moderation logging, fixes, hide modlog, jank
Diffstat (limited to 'src/listeners/message')
-rw-r--r-- | src/listeners/message/automodCreate.ts | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts index 94b73c7..ae1bd21 100644 --- a/src/listeners/message/automodCreate.ts +++ b/src/listeners/message/automodCreate.ts @@ -5,7 +5,7 @@ import _badLinks from '@root/lib/badlinks'; // Stolen from https://github.com/na import _badLinksSecret from '@root/lib/badlinks-secret'; // shhhh // @ts-expect-error: ts doesn't recognize json5 import badWords from '@root/lib/badwords'; -import { MessageEmbed, TextChannel } from 'discord.js'; +import { MessageEmbed } from 'discord.js'; import { BushClientEvents } from '../../lib/extensions/discord.js/BushClientEvents'; export default class AutomodMessageCreateListener extends BushListener { @@ -100,14 +100,11 @@ export default class AutomodMessageCreateListener extends BushListener { ? util.colors.orange : util.colors.red; - const automodChannel = (await message.guild.getSetting('logChannels')).automod; + const automodChannel = await message.guild.getLogChannel('automod'); if (!automodChannel) return; - const fetchedChannel = (message.guild.channels.cache.get(automodChannel) ?? - (await message.guild.channels.fetch(automodChannel).catch(() => null))) as TextChannel; - if (!fetchedChannel) return; - if (fetchedChannel.permissionsFor(message.guild.me!.id)?.has(['VIEW_CHANNEL', 'SEND_MESSAGES', 'EMBED_LINKS'])) - void fetchedChannel.send({ + if (automodChannel.permissionsFor(message.guild.me!.id)?.has(['VIEW_CHANNEL', 'SEND_MESSAGES', 'EMBED_LINKS'])) + void automodChannel.send({ embeds: [ new MessageEmbed() .setTitle(`[Severity ${highestOffence}] Automod Action Performed`) |