Honieween
DIAdiscord.js - Imagine an app
•Created by Honieween on 11/25/2023 in #djs-questions
Collector buttons work but just once
Hello! I'm working on a leaderboard system that lets you swap through pages by clicking buttons as a menu of sorts. It seems to work fine enough the first time you click a button (with the slight annoyance that the three loading dots disappear way too early). By the second time something goes off, and the bot crashes with a
DiscordAPIError[10062]: Unknown interaction
error. Anyone got an idea of why that might be?
16 replies
DIAdiscord.js - Imagine an app
•Created by Honieween on 7/28/2023 in #djs-questions
Creating a modal after a button click shows an "Unknown Interaction" error
I've created a system which dynamically creates a sequence of embeds, components and select fields for a Setup command. My hope is that I can also add into it an option for creating a Modal, so when I need a text input from the user I can show it in a more elegant way than just "type a message in chat".
Whenever I send a modal using this system (clicking a button can generate a Modal element), the modal shows up on Discord, but the bot crashes with an
DiscordAPIError[10062]: Unknown interaction
error.
Researching, I came across this:
Showing a modal must be the first response to an interaction. You cannot defer() or deferUpdate() then show a modal later.Does this mean that this kind of action is not possible, and that modals are exclusive to being used immediately after a Slash Command is executed, or is there a way to implement this? Error code: Code:
11 replies
DIAdiscord.js - Imagine an app
•Created by Honieween on 8/21/2022 in #djs-questions
Sending an error to the channel the error was caught on
I have a simple error handling script that checks for
uncaughtException
s, and if one pops up sends an error log both to the bot's console and to a dedicated error channel for internal use as an embed. If possible, I'd also like to send this embed to the user - for example, if a Slash Command fails, generate an error message and send it to the same channel the Slash Command was sent on.
Is it possible to somehow get the sent interaction (and with it, the channel) that caused the error? I know I could encase my commands in a try-catch loop, but if possible, I'd rather not do that for every command I have.
6 replies
DIAdiscord.js - Imagine an app
•Created by Honieween on 8/17/2022 in #djs-questions
Creating a MessageComponentCollector in a function separate to the base command
To clean up a bit of code, I'm trying to send a couple collectors to a function in a different class. As is, my code creates an embed with a set of buttons, then attempts to run the
channel.createMessageComponentCollector
function. This works as intended in the base command, but doesn't work at all on the function I am delegating this to.
The stacktrace:
Command code (Note, using WOKCommands for this part, though it should be irrelevant to this problem.):
Function code:
4 replies