diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-06 15:20:46 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-06 15:20:46 -0400 |
commit | 13306f17accea5d3653dd4b8670ba0d6ab69c7c5 (patch) | |
tree | 7075dcca19ed1164a166efac19c49311e93ffeee /src/listeners/custom | |
parent | a8386e756758f243b75e5df4886224d2bf9f241c (diff) | |
download | tanzanite-13306f17accea5d3653dd4b8670ba0d6ab69c7c5.tar.gz tanzanite-13306f17accea5d3653dd4b8670ba0d6ab69c7c5.tar.bz2 tanzanite-13306f17accea5d3653dd4b8670ba0d6ab69c7c5.zip |
evidence command and more logging
Diffstat (limited to 'src/listeners/custom')
-rw-r--r-- | src/listeners/custom/bushUpdateModlog.ts | 33 | ||||
-rw-r--r-- | src/listeners/custom/bushUpdateSettings.ts | 36 |
2 files changed, 69 insertions, 0 deletions
diff --git a/src/listeners/custom/bushUpdateModlog.ts b/src/listeners/custom/bushUpdateModlog.ts new file mode 100644 index 0000000..16e0dbf --- /dev/null +++ b/src/listeners/custom/bushUpdateModlog.ts @@ -0,0 +1,33 @@ +import { BushListener } from '@lib'; +import { MessageEmbed } from 'discord.js'; +import { BushClientEvents } from '../../lib/extensions/discord.js/BushClientEvents'; + +export default class BushUpdateModlogListener extends BushListener { + public constructor() { + super('bushUpdateModlog', { + emitter: 'client', + event: 'bushUpdateModlog', + category: 'custom' + }); + } + + public override async exec( + ...[moderator, modlogID, key, oldModlog, newModlog]: BushClientEvents['bushUpdateModlog'] + ): Promise<unknown> { + const logChannel = await moderator.guild.getLogChannel('moderation'); + if (!logChannel) return; + + const logEmbed = new MessageEmbed() + .setColor(util.colors.discord.BLURPLE) + .setTimestamp() + .setAuthor(moderator.user.tag, moderator.user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined) + .addField('**Action**', `${'Update Modlog'}`) + .addField('**Moderator**', `${moderator} (${moderator.user.tag})`) + .addField('**ModLog Changed**', modlogID) + .addField('**Value Changed**', key) + .addField('**Old Value**', await util.inspectCleanRedactCodeblock(oldModlog, undefined, undefined, 1024)) + .addField('**New Value**', await util.inspectCleanRedactCodeblock(newModlog, undefined, undefined, 1024)); + + return await logChannel.send({ embeds: [logEmbed] }); + } +} diff --git a/src/listeners/custom/bushUpdateSettings.ts b/src/listeners/custom/bushUpdateSettings.ts new file mode 100644 index 0000000..eae3062 --- /dev/null +++ b/src/listeners/custom/bushUpdateSettings.ts @@ -0,0 +1,36 @@ +import { BushListener } from '@lib'; +import { MessageEmbed } from 'discord.js'; +import { BushClientEvents } from '../../lib/extensions/discord.js/BushClientEvents'; + +export default class BushUpdateSettingsListener extends BushListener { + public constructor() { + super('bushUpdateSettings', { + emitter: 'client', + event: 'bushUpdateSettings', + category: 'custom' + }); + } + + public override async exec( + ...[setting, guild, oldSettings, newSettings, moderator]: BushClientEvents['bushUpdateSettings'] + ): Promise<unknown> { + const logChannel = await guild.getLogChannel('moderation'); + if (!logChannel) return; + + const logEmbed = new MessageEmbed().setColor(util.colors.discord.BLURPLE).setTimestamp(); + + if (moderator) + logEmbed.setAuthor( + moderator.user.tag, + moderator.user.avatarURL({ dynamic: true, format: 'png', size: 4096 }) ?? undefined + ); + logEmbed.addField('**Action**', `${'Update Settings'}`); + if (moderator) logEmbed.addField('**Moderator**', `${moderator} (${moderator.user.tag})`); + logEmbed + .addField('**Setting Changed**', setting) + .addField('**Old Value**', await util.inspectCleanRedactCodeblock(oldSettings, 'js', undefined, 1024)) + .addField('**New Value**', await util.inspectCleanRedactCodeblock(newSettings, 'js', undefined, 1024)); + + return await logChannel.send({ embeds: [logEmbed] }); + } +} |