Object destructuring causes undefined (interaction.options
)
#8865
-
I recently stumbled upon this weird behaviour of the get methods for When getting the const { getInteger } = interaction.options;
const id = getInteger('optname'); it causes this error:
I tried with Now i'm asking myself if i'm missing something, i'm just bad at TS/JS or if this is actually a bug. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This would be due to you unbinding the Destructuring these methods is not a good idea. If you really wanted to, make sure you bind it to the |
Beta Was this translation helpful? Give feedback.
This would be due to you unbinding the
this
, when destructuring. As you can see here, it tries to accessthis
interallydiscord.js/packages/discord.js/src/structures/CommandInteractionOptionResolver.js
Line 171 in d275480
Destructuring these methods is not a good idea. If you really wanted to, make sure you bind it to the
interaction.options
object again.