Refactor to more consistent structure (e.g. "plugins")
This commit is contained in:
25
plugins/nag/unnag.ts
Normal file
25
plugins/nag/unnag.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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;
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user