You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a listener for the GuildMemberAdd/GuildMemberRemove events
Attempt to get/fetch a VoiceChannel type to send a message alert
Print out the channel type
Code sample
// GuildMemberAdd & GuildMemberRemove event listeners:// 'entry' references a database entryletchannel=member.guild.channels.cache.get(entry.alerts.memberPart);if(!channel){channel=awaitmember.guild.channels.fetch(entry.alerts.memberPart).catch(()=>{// This isn't important, but I'll leave it here just in casethis.database.guilds.update(member.guild.id,{alerts: {memberPart: null}})});if(!channel){return;}}if(channel.type>0)return;// channel.type is returning undefined when it is a VoiceChannel instance. I ran an eval command to get the same channel by its ID and it shows channel.type as 2, so I'm not sure why this is happening. I
Versions
Discord.js: 14.15.2
Node: v20.15.1
npm: 10.8.3
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Not applicable
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered:
Normally when I see this sort of issue, channel isn't actually a Channel type object at all. Could you log it and confirm that other than channel.type, the rest of the properties are as expected? My guess, without additional info, would be that you're fetching channels with an undefined value and actually returning a Collection.
I apologize for the delayed response. I had to wait until the issue reoccurred so I can see what happened. I made a silly mistake. What happened was the channel id was being set (in the database) to false instead of null, and I was checking if it wasn't null, so it was returning a Collection instead of the target channel.
Which package is this bug report for?
discord.js
Issue description
Code sample
Versions
Discord.js: 14.15.2
Node: v20.15.1
npm: 10.8.3
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Not applicable
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: