#SlashComamnd argument
45 messages · Page 1 of 1 (latest)
always check the discordjs guide before creating a post
full code pls?
it's here
@faint walrus can you help me?
what's the issue?
send the whole code
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;
};
});
okey
uhm are you trying to create a slash command or a classic prefix command?
clasic
here in the switch you typed interaction instead of menuInteraction
like that?
yeah
but I have a doubt
I don't think editReply() will work if you are using classic commands
@vital horizon is it working?
nope
as the console says, you should type client.on('messageCreate' .... instead of only 'message', but that's not the problem here
this is the problem
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
how do i go about saving the message id?
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
yeah tickets
yeah you can use quick.db https://www.npmjs.com/package/quick.db
Databases: Storing data with Keyv