From c4c1d9ffeb179e208792c88dd099caea5030581b Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 5 Sep 2021 20:24:50 -0400 Subject: add moderation logging, fixes, hide modlog, jank --- src/listeners/message/automodCreate.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/listeners/message') 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`) -- cgit