createMessageComponentCollector on a followUp is causing all sorts of inexplicable errors
So I don't really know how else to explain it. First and foremost, here is my code:
https://pastebin.com/ezhdgMvT
Now onto the explanation:
In that command I pasted above, when I run it, if certain conditions are met (
countCheck.Character2
not being null, plus the switch case being either ab
or arch
), it requires me to use two string menus (one when the user first runs the command, and another after the user picks an option from the 1st string menu), but upon picking the option from the 2nd string menu, the bot simply crashes, and the error is the most unhelpful of all time as it actually seems to be random, even going as far as presenting the error (sometimes) on an unrelated command that works fine on its own and causes no issues whatsoever.Pastebin
const { SlashCommandBuilder, ActionRowBuilder, StringSelectMenuBuil...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
20 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!My discord is version 14.13.0
My node is v18.17.0
It would still be helpful to us to know what the errors are
So
j.reply
instead of interaction.followUp
?
As I said before, the errors seem to randomize each time, but here is an instance of me running the command, crashing the bot, restarting the bot, running the command and using the exact same choices and options on it, yet getting two different errors in two different unrelated commands despite not being interconnected to one another, and despite no changes happening in the code in between restarts:
They can't be database errors, because when the command is run without the double menu, it works perfectly despite using the same queries. If you check the pastebin of the command, you can see that it only uses two menus when countCheck.Character2 !== null
then switch case is either ab
or arch
. In any other instance, it only requires sending one (or zero menus) despite using the same db collections and queries and saves... No issue on those cases.
Still looking for help with this if anyone can helpUnknown User•15mo ago
Message Not Public
Sign In & Join Server To View
Then why does it work when there's only one menu (and therefore the
createMessageComponentCollector
is used on a reply rather than a followUp), despite using the same database, the same query, the same fields, the same values and the same calculation?Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
Okay, but how is the data not null when I'm using createMessageComponentCollector on a reply, but is somehow null when used on a followUp?
Additionally, how does it inexplicably give me the error message from a completely unrelated command?
The command with the problem is
progress
, and yet as you can see in the first error, it's outlying the stats
command for some inexplicable reason.Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
It's getting the objectId from the database and then fetching another document using that objectId
Yes. I give it the Id, it returns a document with that _id
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
I use this method in other commands and it works flawlessly.
I know. But my problem isn't a database one, despite what you and Qjuh keep insisting on.
If it were a database problem, why would it mention an unrelated command? And why would it work when there's only a single menu but fail with two menus?
Again, the database is the same in all instances, the queries are the same, the collections and fields are the same. The only differences are the amount of menus (0, 1 or 2), and whether I'm collecting a component response from a reply or a followUp
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
But you both keep saying it's a database issue while continuously ignoring my valid arguments as to why it's not at all database related.
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
But I already told you why it isn't database related, multiple times...
- I am running the exact same query in that exact same command just an if-statement above, using one menu instead of two, the process works flawlessly without a hitch whatsoever.
- The errors are random and different each time the command with the double menu is run, despite no code or option/choices being changed.
- The errors even go as far as mentioning completely unrelated commands.
Here, now I completely removed this portion of the code:
Which is what reads and writes to the database.
Instead, I left it as this:
I'm still getting a random error.
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
What attitude? I'm just explaining my issue...