Files
blitzcrank/plugins/nag/unnag.ts

26 lines
670 B
TypeScript

import {
type ChatInputCommandInteraction,
SlashCommandBuilder,
} from 'discord.js';
import type {Settings} from '../../plugin';
import {Nag} from './models';
export default function (_settings: Settings) {
return {
data: new SlashCommandBuilder()
.setName('unnag')
.setDescription('Remove a nag'),
execute: async (interaction: ChatInputCommandInteraction) => {
// Find all nags for this user and delete them.
// TODO In the future, we should support having multiple nags
const results = await Nag.findAll({
where: {userId: interaction.user.id},
});
for (const result of results) {
await result.destroy();
}
return;
},
};
}