Why does guild not exist on interaction at one point?
Here is my declaration I'm using to get a channel using an interaction, when I run this code and pass in the ModalInteraction type of interaciton, when I pass in Command interaction it returns:
TypeError: Cannot read properties of undefined (reading 'channels')
. What gives?6 Replies
Depending on which line the error is being thrown on, either
this.interaction.guild
is undefined, or botConfig
is undefined
The latter is more likely, depending on what this
is defined as
But all Interaction instances have a .guild property so it cannot be undefined (even if it can be null)well since it says
(reading channels)
i presume its at the this.interaction lineIt means that whatever comes before .channels is undefined, but you have two spots where
something.channels
exists
If you log this.interaction.guild
at the top within the try block, what does it return?It could if the channel is a DM
Make sure no one is running ur suggestion channel in DM's or it could always be that
this
is undefinedUnknown User•3y ago
Message Not Public
Sign In & Join Server To View
ahh yes, correct. mb