Penitent
Penitent
DIAdiscord.js - Imagine an app
Created by Penitent on 3/27/2024 in #djs-questions
Using collector.on('end') to edit reply?
I'm trying to create a polling bot that edits their reply once the poll has concluded, but i can't figure out how to do that, and was wondering if anyone had any advice? I'm not sure if I should figure out a way to do it through collector.on('collect') or if there is a way to do it with collector.on('end'). If the right way to do it is through collector.on('collect'), i'm not sure if i can combine a switch statement with an await 60 _ 000 to update the message when the timer has ticked down
35 replies
DIAdiscord.js - Imagine an app
Created by Penitent on 3/18/2024 in #djs-questions
Collector.on('collect') not collecting for createMessageComponentCollector.
I'm having trouble figuring out why my bot wont fire on Collector.on('collect'). I tried putting a console.log('test') in there but it's never registering. Any idea how to fix this?
const response = await modalSubmission.reply({ embeds: [pollEmbed], components: [row] });

const collector = response.createMessageComponentCollector({ componentType: ComponentType.Button, time: 15_000 });

collector.on('collect', i => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} clicked on the ${i.customId} button.`);
} else {
i.reply({ content: `These buttons aren't for you!`, ephemeral: true });
}
});
const response = await modalSubmission.reply({ embeds: [pollEmbed], components: [row] });

const collector = response.createMessageComponentCollector({ componentType: ComponentType.Button, time: 15_000 });

collector.on('collect', i => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} clicked on the ${i.customId} button.`);
} else {
i.reply({ content: `These buttons aren't for you!`, ephemeral: true });
}
});
12 replies
DIAdiscord.js - Imagine an app
Created by Penitent on 3/18/2024 in #djs-questions
how to set up action row such that each user can interact with a button only once?
I'm trying to set up an action row with multiple buttons (for example A, B, C), and I want each user in my server to be able to interact with these buttons, however each user gets a max of only one interaction. The reason for this is a polling system; I want each user to vote only once. How can I achieve this?
45 replies
DIAdiscord.js - Imagine an app
Created by Penitent on 3/12/2024 in #djs-questions
Creating an embed for polling
hey guys, i was wondering where I can find some info on fields for embeds in discord js. I'm trying to recreate the following embed; I cant seem to figure out how to make a field with no title, and also how to make a progress bar? the bar under "yes" updates depending on the number of votes (i know how i would do that, just dont know how to get a progress bar into an embed). Any information is helpful, or if you guys could redirect me to the appropriate documentation that would also help (was not able to find something on the discordjs tutorial myself). Thanks in advance!!
34 replies