Compare commits
No commits in common. "0b01712712ee74feb7d15ec4a34d58c50f2a56b5" and "f8cf11e7ff17da8006078e15f5a04f45395de489" have entirely different histories.
0b01712712
...
f8cf11e7ff
3 changed files with 0 additions and 72 deletions
|
@ -1,22 +0,0 @@
|
||||||
import { SlashCommandBuilder } from 'discord.js';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('load')
|
|
||||||
.setDescription('load a command.')
|
|
||||||
.addStringOption(option =>
|
|
||||||
option.setName('file')
|
|
||||||
.setDescription('File location of the command.')
|
|
||||||
.setRequired(true)),
|
|
||||||
category: 'owner',
|
|
||||||
ownerOnly: true,
|
|
||||||
async execute(interaction, args, client) {
|
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
let command = await import(`../../${args.file}`);
|
|
||||||
command = command.default;
|
|
||||||
|
|
||||||
client.commands.set(command.data.name, command);
|
|
||||||
return await interaction.editReply(`${command.data.name} has been loaded.`);
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,50 +0,0 @@
|
||||||
import { SlashCommandBuilder } from 'discord.js';
|
|
||||||
import fs from 'node:fs';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('unload')
|
|
||||||
.setDescription('Unload a command and replace it with a placeholder')
|
|
||||||
.addStringOption(option =>
|
|
||||||
option.setName('commandname')
|
|
||||||
.setDescription('The command to unload.')
|
|
||||||
.setRequired(true))
|
|
||||||
.addStringOption(option =>
|
|
||||||
option.setName('placeholder')
|
|
||||||
.setDescription('The placeholder message you want for the command.'))
|
|
||||||
.addBooleanOption(option =>
|
|
||||||
option.setName('nofile')
|
|
||||||
.setDescription('Don\'t create the placeholder file')),
|
|
||||||
category: 'owner',
|
|
||||||
ownerOnly: true,
|
|
||||||
async execute(interaction, args, client) {
|
|
||||||
await interaction.deferReply();
|
|
||||||
if (!client.commands.has(args.commandname)) return await interaction.editReply('Command not found.');
|
|
||||||
if (!args.placeholder) args.placeholder = 'This command is unloaded, please check back later.';
|
|
||||||
|
|
||||||
if (!args.nofile) {
|
|
||||||
fs.writeFileSync(`./unloaded/${args.commandname}.js`, `
|
|
||||||
import { SlashCommandBuilder } from 'discord.js';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data: ${JSON.stringify(client.commands.get(args.commandname).data)},
|
|
||||||
category: '${client.commands.get(args.commandname).category}',
|
|
||||||
async execute(interaction) {
|
|
||||||
return interaction.reply('${args.placeholder}');
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.commands.delete(args.commandname);
|
|
||||||
if (!args.nofile) {
|
|
||||||
let command = await import(`../../unloaded/${args.commandname}.js`);
|
|
||||||
command = command.default;
|
|
||||||
|
|
||||||
client.commands.set(args.commandname, command);
|
|
||||||
}
|
|
||||||
|
|
||||||
return await interaction.editReply(`${args.commandname} has been unloaded.`);
|
|
||||||
},
|
|
||||||
};
|
|
Loading…
Reference in a new issue