refactor(commands/moderation): now using the new log system
This commit is contained in:
parent
745b7d5690
commit
9f545203f3
1 changed files with 10 additions and 3 deletions
|
|
@ -1,7 +1,13 @@
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||||
import { MessageFlags, ChannelType, TextChannel, ChatInputCommandInteraction } from 'discord.js';
|
import {
|
||||||
|
MessageFlags,
|
||||||
|
ChannelType,
|
||||||
|
TextChannel,
|
||||||
|
ChatInputCommandInteraction,
|
||||||
|
} from 'discord.js';
|
||||||
import emoji from '../../../assets/emoji.json' with { type: 'json' };
|
import emoji from '../../../assets/emoji.json' with { type: 'json' };
|
||||||
import { isWhitelisted } from '../../lib/perm.js';
|
import { isWhitelisted } from '../../lib/perm.js';
|
||||||
|
import { log } from '@lib/log';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|
@ -28,7 +34,8 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const oldChannel = (interaction.options.getChannel('channel') ?? interaction.channel) as TextChannel | null;
|
const oldChannel = (interaction.options.getChannel('channel') ??
|
||||||
|
interaction.channel) as TextChannel | null;
|
||||||
if (!oldChannel) {
|
if (!oldChannel) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.error} | Invalid or missing text channel.`,
|
content: `${emoji.answer.error} | Invalid or missing text channel.`,
|
||||||
|
|
@ -56,7 +63,7 @@ export default {
|
||||||
await oldChannel.delete();
|
await oldChannel.delete();
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(`⚠️ | Error when nuking the channel\n\t${err as Error}`);
|
log.error(err, 'Error when nuking the channel');
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | An error occurred while nuking the channel.`,
|
content: `${emoji.answer.no} | An error occurred while nuking the channel.`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue