Update commands to slash commands

This commit is contained in:
Logan Cusano
2023-02-25 03:25:07 -05:00
parent 49c80b7f5e
commit 02bf0ebda2
16 changed files with 370 additions and 223 deletions

View File

@@ -1,17 +1,20 @@
var libUtils = require("../libUtils.js");
const libUtils = require("../libUtils.js");
const discordAuth = require("../utilities/discordAuthorization");
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
name: 'exit',
description: 'Exit the current application.',
data: new SlashCommandBuilder()
.setName('exit')
.setDescription('Exit the current application.'),
example: "exit",
isPrivileged: true,
async execute(message) {
isPrivileged: true,
async execute(interaction) {
// TODO - Need to add middleware for admins
if (message.member.user.tag !== "Logan#3331") message.reply(`Sorry ${message.member.user.tag}, you are not allowed to use this command.`);
message.reply(
`Goodbye world - Disconnection imminent.`
);
await libUtils.sleep(5000);
await new Promise(resolve => setTimeout(process.exit(), 5000));
discordAuth.authorizeCommand(interaction, this.data.name, async () => {
await interaction.reply(
`Goodbye world - Disconnection imminent.`
);
libUtils.runAfter(process.exit, 5000);
})
}
};