Delete redundant commands

This commit is contained in:
baz 2023-12-30 00:49:50 +00:00
parent 9d1c6ecfb6
commit 87fa9e762d
5 changed files with 0 additions and 81 deletions

View File

@ -1,14 +0,0 @@
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('avatar')
.setDescription('Get the avatar URL of the selected user, or your own avatar.')
.addUserOption(option => option.setName('user').setDescription('The user\'s avatar to show')),
async execute(interaction) {
const user = interaction.options.getUser('user');
if (user) return interaction.reply(`${user.username}'s avatar: ${user.displayAvatarURL()}`);
return interaction.reply(`Your avatar: ${interaction.user.displayAvatarURL()}`);
},
};

View File

@ -1,11 +0,0 @@
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};

View File

@ -1,32 +0,0 @@
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('reload')
.setDescription('Reload a command.')
.addStringOption(option =>
option.setName('command')
.setDescription('The command to reload.')
.setRequired(true)),
async execute(interaction) {
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);
if (!command) {
return interaction.reply(`There is no command with name \`${commandName}\`!`);
}
delete require.cache[require.resolve(`./${command.data.name}.js`)];
try {
interaction.client.commands.delete(command.data.name);
const newCommand = require(`./${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply(`Command \`${newCommand.data.name}\` was reloaded!`);
} catch (error) {
console.error(error);
await interaction.reply(`There was an error while reloading a command \`${command.data.name}\`:\n\`${error.message}\``);
}
},
};

View File

@ -1,10 +0,0 @@
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('server')
.setDescription('Provides information about the server.'),
async execute(interaction) {
await interaction.reply(`This server is ${interaction.guild.name} and has ${interaction.guild.memberCount} members.`);
},
};

View File

@ -1,14 +0,0 @@
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('user')
.setDescription('Provides information about the user.'),
async execute(interaction) {
// interaction.user is the object representing the user who ran the command
// interaction.member is the GuildMember object, which represents the user in the specific guild
await interaction.reply(`This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`);
},
};