What's the best way of storing an interaction in a Redis instance for a later reply?
Hi there,
I have a command that takes awhile to process, so I'm using a queue to do each one, one at a time. I'm running into an issue when trying to store the interaction object in my redis instance which I'm using to hold the queue. Whenveer I used
interaction.toJson()
I get an error saying TypeError: Do not know how to serialize a BigInt
. As anyone come across this issue before and is there any good way around it?4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!Is it possible to fetch an instance of a interaction a few minutes later, after it's sent to the bot?
yes, the problem you're facing happens because BigInt values can't be converted into a JSON string using the
JSON.stringify()
method, which is what the toJson()
method uses to turn the interaction object into a JSON string
use a library like flatted
or json-bigint
that supports BigInt serialization
no, it is not possible to fetch an instance of an interaction a few minutes later after it has been sent to the botThanks so much, I appreciate your help!