mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
fix(bot-discord): rename unban command name
This commit is contained in:
@@ -4,24 +4,14 @@ import reportToLogs from '../utils/reportToLogs.js';
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('ban')
|
||||
.setDescription('Ban a member.')
|
||||
.setName('unban')
|
||||
.setDescription('Unban a member.')
|
||||
.setDMPermission(false)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('user')
|
||||
.setDescription('The member to ban')
|
||||
.setRequired(true)
|
||||
)
|
||||
.addIntegerOption(option =>
|
||||
option
|
||||
.setName('dmd')
|
||||
.setDescription('Amount of days to delete messages')
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('reason')
|
||||
.setDescription('Reason for the ban')
|
||||
),
|
||||
async execute(_, config, interaction) {
|
||||
if (!checkForPerms(config, interaction.member)) return interaction.reply({
|
||||
|
||||
@@ -1,35 +1,36 @@
|
||||
import { REST, Routes } from 'discord.js';
|
||||
import { readdirSync, readFileSync } from 'node:fs';
|
||||
const configJSON = readFileSync('../config.json', 'utf-8');
|
||||
const configJSON = readFileSync('./config.json', 'utf-8');
|
||||
const config = JSON.parse(configJSON);
|
||||
|
||||
const commands = [];
|
||||
// Grab all the command files from the commands directory you created earlier
|
||||
const commandFiles = readdirSync('./commands').filter((file) =>
|
||||
file.endsWith('.js')
|
||||
file.endsWith('.js')
|
||||
);
|
||||
|
||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||
for (const file of commandFiles) {
|
||||
const command = await import(`./commands/${file}`);
|
||||
commands.push(command.default.data.toJSON());
|
||||
const command = await import(`./commands/${file}`);
|
||||
if (!command.default.data.toJSON) continue;
|
||||
commands.push(command.default.data.toJSON());
|
||||
}
|
||||
|
||||
// Construct and prepare an instance of the REST module
|
||||
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
|
||||
|
||||
try {
|
||||
console.log(
|
||||
`Started refreshing ${commands.length} application (/) commands.`
|
||||
);
|
||||
console.log(
|
||||
`Started refreshing ${commands.length} application (/) commands.`
|
||||
);
|
||||
|
||||
// The put method is used to fully refresh all commands in the guild with the current set
|
||||
const data = await rest.put(Routes.applicationCommands(config.discord.botId), {
|
||||
body: commands
|
||||
});
|
||||
// The put method is used to fully refresh all commands in the guild with the current set
|
||||
const data = await rest.put(Routes.applicationCommands(config.discord.botId), {
|
||||
body: commands
|
||||
});
|
||||
|
||||
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
|
||||
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
|
||||
} catch (error) {
|
||||
// And of course, make sure you catch and log any errors!
|
||||
console.error(error);
|
||||
}
|
||||
// And of course, make sure you catch and log any errors!
|
||||
console.error(error);
|
||||
}
|
||||
Reference in New Issue
Block a user