Vylpes
e6c845e3b2
Some checks failed
continuous-integration/drone/push Build is failing
- Switch to TypeORM's DataSource API, rather than using the now deprecated ormconfig.json - This will fix stage deployment not knowing how to deploy the database migrations #297 > **NOTE:** This change requires the deployment scripts to be updated, please update them on the server before merging Co-authored-by: Ethan Lane <ethan@vylpes.com> Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/299
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { CommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js";
|
|
import IgnoredChannel from "../database/entities/IgnoredChannel";
|
|
import { Command } from "../type/command";
|
|
|
|
export default class Ignore extends Command {
|
|
constructor() {
|
|
super();
|
|
|
|
super.CommandBuilder = new SlashCommandBuilder()
|
|
.setName('ignore')
|
|
.setDescription('Ignore events in this channel')
|
|
.setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator);
|
|
}
|
|
|
|
public override async execute(interaction: CommandInteraction) {
|
|
if (!interaction.guildId) return;
|
|
|
|
const isChannelIgnored = await IgnoredChannel.IsChannelIgnored(interaction.guildId);
|
|
|
|
if (isChannelIgnored) {
|
|
const entity = await IgnoredChannel.FetchOneById(IgnoredChannel, interaction.guildId);
|
|
|
|
if (!entity) {
|
|
await interaction.reply('Unable to find channel.');
|
|
return;
|
|
}
|
|
|
|
await IgnoredChannel.Remove(IgnoredChannel, entity);
|
|
|
|
await interaction.reply('This channel will start being logged again.');
|
|
} else {
|
|
const entity = new IgnoredChannel(interaction.guildId);
|
|
|
|
await entity.Save(IgnoredChannel, entity);
|
|
|
|
await interaction.reply('This channel will now be ignored from logging.');
|
|
}
|
|
}
|
|
} |