Unicorn.
Unicorn.
DIAdiscord.js - Imagine an app
Created by Unicorn. on 6/22/2024 in #djs-questions
How to send custom emoji in embed description
that done
12 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 6/22/2024 in #djs-questions
How to send custom emoji in embed description
so i uploaded it to my server
12 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 6/22/2024 in #djs-questions
How to send custom emoji in embed description
my bot doesnt in the server which has that emoji
12 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 6/22/2024 in #djs-questions
How to send custom emoji in embed description
i get where that problem be
12 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 6/22/2024 in #djs-questions
How to send custom emoji in embed description
:blobreachReverse:
12 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 6/22/2024 in #djs-questions
How to send custom emoji in embed description
:Warning:
12 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
it done
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
:blobreachReverse: :blobreachReverse: :blobreachReverse:
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
thx:huge: :huge: :huge: :huge: :huge: :huge:
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
it did the work but modal replies error
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
No description
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
if i used interaciton.show Modal it will has the promise of main not the modal
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
oh i get it
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
i want to let it as this
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
No description
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
interaciton will has a command row
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
due to i want to let it as all could using
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
const { ActionRowBuilder,PermissionFlagsBits,PermissionsBitField, ModalBuilder, TextInputBuilder, TextInputStyle, ButtonBuilder, ButtonStyle, SlashCommandBuilder,EmbedBuilder, } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ticketmessinit')
.setDescription('add')
.setDMPermission(false),
async execute(interaction) {
await interaction.reply({content:'test' , ephemeral:true});
const eventtic = new EmbedBuilder()
···;
const create = new ButtonBuilder()
.setCustomId('ticketinit')
.setLabel('Create a ticket')
.setStyle(ButtonStyle.Primary);

const cancel = new ButtonBuilder()
.setCustomId('cancel')
.setLabel('Cancel')
.setStyle(ButtonStyle.Secondary);
const row = new ActionRowBuilder()
.addComponents(create,cancel);
const msg = await interaction.channel.send({
embeds:[eventtic],
components: [row],
});
const collector = msg.createMessageComponentCollector();
collector.on('collect',async i =>{
if (i.customId=='ticketinit'){
// Create the modal
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
// Add components to modal
// Create the text input components
const favoriteColorInput = new TextInputBuilder()
.setCustomId('Eventid')
// The label is the prompt the user sees for this input
.setLabel("What's the ID of your VTC's event?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
// An action row only holds one text input,
// so you need one action row per text input.
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
// Add inputs to the modal
modal.addComponents(firstActionRow);
// Show the modal to the user
await interaction.showModal(modal);
const filter = (o) => o.customId === 'myModal';
interaction.awaitModalSubmit({ time: 50_000, filter })
.then(async(interaction) => {
···
if (data.error == false){
···
return;
} else {
interaction.channel.send({content:'Can\'t find the event!',ephemeral:true});
}
})
.catch(err => console.log('No modal submit interaction was collected'));
} else if(i.customId=='cancel'){
interaction.channel.send({content:'canceled',ephemeral:true})
}
});
},
};
const { ActionRowBuilder,PermissionFlagsBits,PermissionsBitField, ModalBuilder, TextInputBuilder, TextInputStyle, ButtonBuilder, ButtonStyle, SlashCommandBuilder,EmbedBuilder, } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ticketmessinit')
.setDescription('add')
.setDMPermission(false),
async execute(interaction) {
await interaction.reply({content:'test' , ephemeral:true});
const eventtic = new EmbedBuilder()
···;
const create = new ButtonBuilder()
.setCustomId('ticketinit')
.setLabel('Create a ticket')
.setStyle(ButtonStyle.Primary);

const cancel = new ButtonBuilder()
.setCustomId('cancel')
.setLabel('Cancel')
.setStyle(ButtonStyle.Secondary);
const row = new ActionRowBuilder()
.addComponents(create,cancel);
const msg = await interaction.channel.send({
embeds:[eventtic],
components: [row],
});
const collector = msg.createMessageComponentCollector();
collector.on('collect',async i =>{
if (i.customId=='ticketinit'){
// Create the modal
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
// Add components to modal
// Create the text input components
const favoriteColorInput = new TextInputBuilder()
.setCustomId('Eventid')
// The label is the prompt the user sees for this input
.setLabel("What's the ID of your VTC's event?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
// An action row only holds one text input,
// so you need one action row per text input.
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
// Add inputs to the modal
modal.addComponents(firstActionRow);
// Show the modal to the user
await interaction.showModal(modal);
const filter = (o) => o.customId === 'myModal';
interaction.awaitModalSubmit({ time: 50_000, filter })
.then(async(interaction) => {
···
if (data.error == false){
···
return;
} else {
interaction.channel.send({content:'Can\'t find the event!',ephemeral:true});
}
})
.catch(err => console.log('No modal submit interaction was collected'));
} else if(i.customId=='cancel'){
interaction.channel.send({content:'canceled',ephemeral:true})
}
});
},
};
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
it shows
if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.showModal (E:\htcqqcom\桌面\bot\marking main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:255:46)
at InteractionCollector.<anonymous> (E:\htcqqcom\桌面\bot\marking main\commands\slash\ticketmessinit.js:49:29)
at InteractionCollector.emit (node:events:526:35)
at InteractionCollector.handleCollect (E:\htcqqcom\桌面\bot\marking main\node_modules\discord.js\src\structures\interfaces\Collector.js:133:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'InteractionAlreadyReplied'
}

Node.js v18.17.1
if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.showModal (E:\htcqqcom\桌面\bot\marking main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:255:46)
at InteractionCollector.<anonymous> (E:\htcqqcom\桌面\bot\marking main\commands\slash\ticketmessinit.js:49:29)
at InteractionCollector.emit (node:events:526:35)
at InteractionCollector.handleCollect (E:\htcqqcom\桌面\bot\marking main\node_modules\discord.js\src\structures\interfaces\Collector.js:133:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'InteractionAlreadyReplied'
}

Node.js v18.17.1
28 replies
DIAdiscord.js - Imagine an app
Created by Unicorn. on 5/30/2024 in #djs-questions
Can't use modal after button
i used as this
28 replies