_Rob
DIAdiscord.js - Imagine an app
•Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
I'm working on a bot that handles interactions via a webhook url, and am processing them in AWS Lambda. I have everything set up properly, including responding to the ping interaction, but no matter what I do, I keep getting an
Unknown Interaction
error.
In the above, I'm creating the apis from a custom context being passed in, and attempting to just respond to any non-ping interaction with 'Pong!', but every time the function is invoked, I get the following error:
Any idea what's going on?16 replies
DIAdiscord.js - Imagine an app
•Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
I'm trying to implement some buttons on a command interaction, and I have successfully added the buttons, but when creating a message component collector, the 'collect' callback is not being called.
I'm creating it as follows:
Am I missing something here?
23 replies
DIAdiscord.js - Imagine an app
•Created by _Rob on 4/7/2023 in #djs-questions
Retrieving an already running Client
I'm generating AWS SQS messages based on Discord interaction events and using an AWS Lambda function to respond to them through webhooks. Currently, I'm sending the webhook ID and token in the body of the SQS message and constructing a webhook in the Lambda function to respond to.
I want to streamline my processes and reconstruct the interaction object downstream from its ID to use the normal DiscordJS functions. Is there a way to connect to, and get a reference to, an existing client running somewhere to fetch the interaction by ID?
If not, is there any other way to recreate DiscordJS objects downstream to interact with instead of the webhook approach?
2 replies
DIAdiscord.js - Imagine an app
•Created by _Rob on 12/22/2022 in #djs-questions
Replying to interactions that wait for modal submission
I may be approaching this wrong, but I haven't found a successful combination of deferring/replying/updating for when an interaction is submitted that displays a modal and awaits the modal submission.
My issue is when the user submits the interaction, I can't defer or reply to the interaction before calling
.showModal(...)
on it, otherwise I get an error stating that the interaction has already been replied to. Once the modal is displayed, I'm calling .awaitModalSubmit(...)
on the interaction, which returns a ModalSubmitInteraction
. It seems as though the modal submit interaction returned isn't tied to the original interaction, so if replied to, it generates a new message in Discord, leaving the original interaction in the Sending command...
state. If I instead follow up or edit the original interaction, the modal submit interaction gets stuck in a an un-replied state.
Is there a way to a) have the modal submission not generate a second message, but instead update the original one? or b) satisfy both interactions so neither of them get stuck in a weird state?
I do also want to point out, that for uninteresting reasons, when replying to these messages, I'm calling through the webhook client to send responses, and not directly through the interaction itself.8 replies
DIAdiscord.js - Imagine an app
•Created by _Rob on 9/20/2022 in #djs-questions
Interaction (De)Serialization
I’m in the process of rearchitecting my bot and am migrating over to AWS for my infrastructure. I’m planning on using SQS to process events and then handle them downstream through handlers.
I’ve been looking through the docs and I can’t quite find if this is possible, but does Discord JS allow for serialization/deserialization of interactions?
I know I can convert the interaction to a JSON format with
toJSON()
, but that doesn’t afford me the ability to process interactions later as I would when handing them immediately.
I can utilize the JSON to an extent with some concessions on certain processing aspects and UX degradations, but it would be fantastic if I could just recall the interaction object by its ID and then continue processing as one would normally.10 replies
DIAdiscord.js - Imagine an app
•Created by _Rob on 7/30/2022 in #djs-questions
Unit Testing DiscordJS Types
I'm trying to write some unit tests for my bot and I need to generate some instances of some DiscordJS classes, but I'm having a hard time figuring out how to do so easily. Is there a quick/easy way to create instances of classes like Users, Guilds, Channels, etc, without having to implement all of the properties/functions/etc?
16 replies