1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import { BotListener, colors, Emitter, TanzaniteEvent, type BotClientEvents } from '#lib';
import { EmbedBuilder } from 'discord.js';
export default class UpdateModlogListener extends BotListener {
public constructor() {
super(TanzaniteEvent.UpdateModlog, {
emitter: Emitter.Client,
event: TanzaniteEvent.UpdateModlog
});
}
public async exec(...[moderator, modlogID, key, oldModlog, newModlog]: BotClientEvents[TanzaniteEvent.UpdateModlog]) {
const logChannel = await moderator.guild.getLogChannel('moderation');
if (!logChannel) return;
const logEmbed = new EmbedBuilder()
.setColor(colors.Blurple)
.setTimestamp()
.setAuthor({
name: moderator.user.tag,
iconURL: moderator.user.avatarURL({ extension: 'png', size: 4096 }) ?? undefined
})
.addFields(
{ name: '**Action**', value: 'Update Modlog' },
{ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` },
{ name: '**ModLog Changed**', value: modlogID },
{ name: '**Value Changed**', value: key },
{
name: '**Old Value**',
value: await this.client.utils.inspectCleanRedactCodeblock(oldModlog, undefined, undefined, 1024)
},
{
name: '**New Value**',
value: await this.client.utils.inspectCleanRedactCodeblock(newModlog, undefined, undefined, 1024)
}
);
return await logChannel.send({ embeds: [logEmbed] });
}
}
|