h3rm3s
h3rm3s
DIAdiscord.js - Imagine a boo! 👻
Created by h3rm3s on 8/10/2023 in #djs-questions
Re-run bot command
I'm creating a bot that has multiple steps that a user navigates using buttons. I have a "back" button that I would like to trigger a restart, as if the user had abandoned the current bot session and entered the slash command to run the bot again. Is there a way to do this? I've tried interaction.client.commands.get('command').execute(); and it fires but it seems that there's no interaction object when it runs. I would like it to create a whole new slash command interaction. Does anyone know how I can achieve this?
7 replies
DIAdiscord.js - Imagine a boo! 👻
Created by h3rm3s on 6/7/2023 in #djs-questions
State management
I'm building a bot and am wondering the best way to manage state within the app? For example, once a user executes a command we begin a flow that asks them various questions and then will provide them with a custom message at the end based on all of the answers they've given. Is there a standard to maintain state in discord.js that will allow us to keep all these answers? Thanks!
10 replies
DIAdiscord.js - Imagine a boo! 👻
Created by h3rm3s on 6/4/2023 in #djs-questions
Unable to collect reactions
Hey guys, I could use some help with an issue I'm seeing using discord.js 🙂 I'm trying to register when a user reacts to a message that my bot sends out. I have
await interaction.deferReply();
const message = await interaction.editReply({
content: 'Message',
});

message.react(':rewind:');
const collector = await message.createReactionCollector({ filter: () => true, time: 15000 });

collector.on('collect', (reaction, user) => {
console.log(`Reaction collected`);
});
await interaction.deferReply();
const message = await interaction.editReply({
content: 'Message',
});

message.react(':rewind:');
const collector = await message.createReactionCollector({ filter: () => true, time: 15000 });

collector.on('collect', (reaction, user) => {
console.log(`Reaction collected`);
});
For record, this response is a follow up from another message that my bot sends previously, that's why I'm using editReply. The message is being sent, and I'm seeing the automated ⏪ reaction. However when I click a reaction to the message I'm not seeing anything happen. Does anyone have any idea why I might be having this issue?
20 replies