Create ignore command tests
All checks were successful
Test / build (push) Successful in 17s

This commit is contained in:
Ethan Lane 2024-05-11 10:58:50 +01:00
parent ac51eb7f40
commit 2841ed5463
2 changed files with 76 additions and 15 deletions

View file

@ -13,23 +13,16 @@ export default class Ignore extends Command {
}
public override async execute(interaction: CommandInteraction) {
if (!interaction.guildId) return;
const isChannelIgnored = await IgnoredChannel.IsChannelIgnored(interaction.guildId);
const isChannelIgnored = await IgnoredChannel.IsChannelIgnored(interaction.channelId);
if (isChannelIgnored) {
const entity = await IgnoredChannel.FetchOneById(IgnoredChannel, interaction.guildId);
const entity = await IgnoredChannel.FetchOneById(IgnoredChannel, interaction.channelId);
if (!entity) {
await interaction.reply('Unable to find channel.');
return;
}
await IgnoredChannel.Remove(IgnoredChannel, entity);
await IgnoredChannel.Remove(IgnoredChannel, entity!);
await interaction.reply('This channel will start being logged again.');
} else {
const entity = new IgnoredChannel(interaction.guildId);
const entity = new IgnoredChannel(interaction.channelId);
await entity.Save(IgnoredChannel, entity);