Implement Nag service
This commit is contained in:
@@ -1,26 +1,31 @@
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
Client,
|
||||
SlashCommandBuilder,
|
||||
} from 'discord.js';
|
||||
import {Sequelize} from 'sequelize';
|
||||
type ChatInputCommandInteraction,
|
||||
SlashCommandBuilder,
|
||||
} from "discord.js";
|
||||
|
||||
import {Settings} from './common';
|
||||
import { type Settings, Nag } from "./service";
|
||||
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('unnag')
|
||||
.setDescription('Remove a nag');
|
||||
.setName("unnag")
|
||||
.setDescription("Remove a nag");
|
||||
|
||||
async function initialize(settings: Settings) {}
|
||||
|
||||
async function execute(interaction: ChatInputCommandInteraction) {
|
||||
return;
|
||||
// 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),
|
||||
};
|
||||
return {
|
||||
data,
|
||||
execute,
|
||||
initialize: async () => await initialize(settings),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user