32 lines
669 B
TypeScript
32 lines
669 B
TypeScript
import {
|
|
type ChatInputCommandInteraction,
|
|
SlashCommandBuilder,
|
|
} from 'discord.js';
|
|
|
|
import {type Settings, Nag} from './service';
|
|
|
|
const data = new SlashCommandBuilder()
|
|
.setName('unnag')
|
|
.setDescription('Remove a nag');
|
|
|
|
async function initialize(settings: Settings) {}
|
|
|
|
async function execute(interaction: ChatInputCommandInteraction) {
|
|
// Find all nags for this user
|
|
const results = await Nag.findAll({
|
|
where: {userId: interaction.user.id},
|
|
});
|
|
for (const result of results) {
|
|
await result.destroy();
|
|
}
|
|
return;
|
|
}
|
|
|
|
export default function (settings: Settings) {
|
|
return {
|
|
data,
|
|
execute,
|
|
initialize: async () => await initialize(settings),
|
|
};
|
|
}
|