jorrell
jorrell
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
alr
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
const { SlashCommandBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ModalSubmitFields } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('modal')
.setDescription('Shows a modal'),
async execute(interaction) {
try {
const modal = new ModalBuilder()
.setCustomId('modal')
.setTitle('Modal Title');

const favoriteColorInput = new TextInputBuilder()
.setCustomId('favoriteColorInput')
.setLabel("What's your favorite color?")
.setStyle(TextInputStyle.Short)
.setRequired(true);

const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);

modal.addComponents(firstActionRow, secondActionRow);

await interaction.showModal(modal);

await interaction.submitModal(modal)

}
catch (error) {
console.log(error)
}
}
}
const { SlashCommandBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ModalSubmitFields } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('modal')
.setDescription('Shows a modal'),
async execute(interaction) {
try {
const modal = new ModalBuilder()
.setCustomId('modal')
.setTitle('Modal Title');

const favoriteColorInput = new TextInputBuilder()
.setCustomId('favoriteColorInput')
.setLabel("What's your favorite color?")
.setStyle(TextInputStyle.Short)
.setRequired(true);

const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);

modal.addComponents(firstActionRow, secondActionRow);

await interaction.showModal(modal);

await interaction.submitModal(modal)

}
catch (error) {
console.log(error)
}
}
}
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
No description
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
when i type something in the modal and press submit nothing happens
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
ok
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
can u use collectors with modals?🤔
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
thanks for the help
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
oh ok
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
so ima just use collectors when im using buttons and also can collectors be used for modals select menus etc?
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
:spincat:
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
ok it works with no errors
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
ill remove it and run it again to see what happens
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
so basically remove
if (interaction.isButton()) {
const button = interaction.client.buttons.get(interaction.customId);
if (!button) {
console.error(`No button matching ${interaction.customId} was found.`);
return;
}
try {
await button.execute(interaction);
} catch (error) {
console.error(
`Error executing button interaction with customId: ${interaction.customId}`
);
console.error(error);
}
if (interaction.isButton()) {
const button = interaction.client.buttons.get(interaction.customId);
if (!button) {
console.error(`No button matching ${interaction.customId} was found.`);
return;
}
try {
await button.execute(interaction);
} catch (error) {
console.error(
`Error executing button interaction with customId: ${interaction.customId}`
);
console.error(error);
}
from interactionCreate?
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
this is what happend when i used the collectors
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
thats what came from the console
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
node:fs:1508 const result = binding.readdir( ^ Error: ENOENT: no such file or directory, scandir '/home/jorrell/Desktop/Xen/Src/Buttons' at Object.readdirSync (node:fs:1508:26) at Object.<anonymous> (/home/jorrell/Desktop/Xen/Src/Core/index.js:70:26)
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
alr
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
client.buttons = new Collection(); const buttonsPath = path.join(__dirname, '../Buttons'); const buttonFolders = fs.readdirSync(buttonsPath); for (const folder of buttonFolders) { const folderPath = path.join(buttonsPath, folder); const buttonFiles = fs.readdirSync(folderPath).filter(file => file.endsWith('.js')); for (const file of buttonFiles) { const filePath = path.join(folderPath, file); const button = require(filePath); if ('data' in button && 'execute' in button) { client.buttons.set(button.data.customId, button); } } }
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
so add this in my index.js?
79 replies
DIAdiscord.js - Imagine an app
Created by jorrell on 4/21/2024 in #djs-questions
error shows that No command matching ban was found.
oh
79 replies