#SlashComamnd argument

45 messages · Page 1 of 1 (latest)

mellow shale
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

prisma briar
faint walrus
#

always check the discordjs guide before creating a post

vital horizon
#

full code pls?

vital horizon
#

im new in slash commands

faint walrus
#

you should execute that command

#

follow the whole guide

#

that command does nothing

vital horizon
#

@faint walrus can you help me?

faint walrus
vital horizon
#

This interaction failed

faint walrus
#

send the whole code

vital horizon
#

const Discord = require('discord.js');
const { MessageActionRow, MessageSelectMenu } = require('discord.js');

module.exports = {
name: 'ticket',
descriptopn: "ticket panel",
execute(message) {
if (message.member.roles.cache.has("1061256584321318982")) {
const ticketEmbed = new Discord.MessageEmbed()
.setTitle("Ticket")
.setDescription("> Pro vytvoření ticketu klikni na Button!")

    // ...
    const row = new MessageActionRow().addComponents(
        new MessageSelectMenu()
        .setCustomId('row')
        .setPlaceholder('Letter')
        .addOptions([
            {
                label: 'A',
                value: 'A',
            },
            {
                 label: 'B',
                 value: 'B',
            },
            {
                label: 'C',
                value: 'C',
            },
            {
                label: 'D',
                value: 'D',
            },
        ]),
);

    message.channel.send({ embeds: [ticketEmbed], components: [row]})
    message.delete()
}

}

}

#

const Discord = require("discord.js");
const client = new Discord.Client({intents:["GUILDS","GUILD_MEMBERS","GUILD_MESSAGES"]});
const config = require('./config.json');
const prefix = config.prefix;
const token = config.token;
const fs = require('fs');

client.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
const command = require(./commands/${file});

client.commands.set(command.name, command);

}
client.on("interactionCreate", async menuInteraction => {
if (!menuInteraction.isSelectMenu()) return;

switch (menuInteraction.values[0]) {
    case "A":  
    interaction.editReply("A")
        break;
    case "B":  
        interaction.editReply("B")
        break;
    case "C": 
        interaction.editReply("C")
        break;
    case "D":
        interaction.editReply("D")
        break;
};                

});

faint walrus
#

there are many things wrong

#

wait

vital horizon
#

okey

faint walrus
vital horizon
#

clasic

faint walrus
#

oh well it's a lot easier

#

the error you got literally said what you have to do

faint walrus
faint walrus
#

yeah

#

but I have a doubt

#

I don't think editReply() will work if you are using classic commands

#

@vital horizon is it working?

vital horizon
faint walrus
#

as the console says, you should type client.on('messageCreate' .... instead of only 'message', but that's not the problem here

faint walrus
#

of course I recommend you to switch to slash commands, but if you really don't then you can edit the reply by saving the message id when you send it and fetching it when you want to edit the message

vital horizon
faint walrus
#

with a database

#

something very simple like quick.db

#

obviously it's not suitable if that command has to be executed multiple times

#

I think you're trying to create a role selection bot for your server, right?

#

or just creating a ticket

#

in that case you can

vital horizon
#

yeah tickets

faint walrus
#

yeah you can use quick.db https://www.npmjs.com/package/quick.db

exotic spireBOT
#

Suggestion for @vital horizon:
guide Databases: Storing data with Keyv
read more