admin管理员组

文章数量:1313916

So I've just pleted writing a ping.js, echo.js, guildMemberAdd.js, and guildMemberRemove.js and I'm moving on to writing a ban.js and kick.js and currently all slash mands work except the latest mands which is kick and ban. I keep getting the error that "The reply to this interaction has not been sent or deferred." and I have no idea how to find a solution to it. I originally had it written "return interaction.followUp" and I switched them all to "await interaction.followUp" hoping it'd be the solution the problem, but it seems like that wasn't it. I originally also had it written "run: async (interaction) => {" but then I get the error that "mand.execute" is not a function so I switched it to "async execute (intereaction) {" I've also tried a couple of other things, but still can't seem to find a fix, does anyone have any idea on this? I'll leave my interactionCreate.js and kick.js below

interactionCreate.js


    module.exports = {
        name: "interactionCreate",
        async execute(interaction) {
            if (!interaction.isCommand()) return;
    
            const mand = interaction.clientmands.get(interactionmandName);
    
            if (!mand) return;
    
            try {
                await mand.execute(interaction);
            } catch (err) {
                if (err) console.error(err);
    
                await interaction.reply({
                    content: "An error occured while executing that mand.",
                    ephemeral: true
                });
            }
    
        }
    }

kick.js


    const { SlashCommandBuilder } = require('@discordjs/builders');
    const { MessageEmbed } = require("discord.js")
    
    module.exports = {
        data: new SlashCommandBuilder()
        .setName("kick")
        .setDescription("Allows the admin or owner to kick the member.")
        .addUserOption((option) => option.setName('user').setDescription('The person who you want to kick').setRequired(true))
        .addStringOption(option => option.setName('reason').setDescription('Reason to kick member').setRequired(true)),
        async execute (interaction) {
    
           if(!interaction.member.permissions.has("KICK_MEMBERS")) return interaction.followUp({ content: "You do not have the power to kick that member.", ephemeral: true })
    
            const user = interaction.options.getUser('user')
            const member = interaction.guild.members.cache.get(user.id) || await interaction.guild.members.fetch(user.id).catch(err => {})
    
            if(!member) return interaction.followUp({ content: "

本文标签: