mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 13:54:12 +02:00
feat(arabot): add logging for sus note purges
This commit is contained in:
parent
b762ae3bc8
commit
6172dc6ac6
@ -507,6 +507,7 @@ export class SusCommand extends Subcommand {
|
||||
) {
|
||||
// Get the arguments
|
||||
const user = interaction.options.getUser('user', true);
|
||||
const mod = interaction.user;
|
||||
const { guild, channel } = interaction;
|
||||
|
||||
// Checks if all the variables are of the right type
|
||||
@ -616,6 +617,8 @@ export class SusCommand extends Subcommand {
|
||||
embeds: [],
|
||||
});
|
||||
}
|
||||
|
||||
await this.deleteAllNotesLogger(user, mod, guild);
|
||||
});
|
||||
|
||||
// Remove the buttons after they have been clicked
|
||||
@ -628,4 +631,37 @@ export class SusCommand extends Subcommand {
|
||||
// Remove sus role from the user
|
||||
await member.roles.remove(IDs.roles.restrictions.sus);
|
||||
}
|
||||
|
||||
// Logs removal of 1 sus note
|
||||
private async deleteAllNotesLogger(user: User, mod: User, guild: Guild) {
|
||||
// Log the sus note
|
||||
let logChannel = guild.channels.cache.get(IDs.channels.logs.sus) as
|
||||
| TextChannel
|
||||
| undefined;
|
||||
|
||||
if (logChannel === undefined) {
|
||||
logChannel = (await guild.channels.fetch(IDs.channels.logs.sus)) as
|
||||
| TextChannel
|
||||
| undefined;
|
||||
if (logChannel === undefined) {
|
||||
this.container.logger.error('Sus Error: Could not fetch log channel');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor('#28A745')
|
||||
.setAuthor({
|
||||
name: `Purged all sus notes for ${user.tag}`,
|
||||
iconURL: `${user.displayAvatarURL()}`,
|
||||
})
|
||||
.addFields(
|
||||
{ name: 'User', value: `${user}`, inline: true },
|
||||
{ name: 'Moderator', value: `${mod}`, inline: true },
|
||||
)
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `ID: ${user.id}` });
|
||||
|
||||
await logChannel.send({ embeds: [embed] });
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user