discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.38k stars 3.97k forks source link

Using `Client.fetchInvite` to fetch Group DM Invite metadata results in a missing (null) channel property on the returned Invite object #3345

Closed wasdennnoch closed 4 years ago

wasdennnoch commented 5 years ago

Please describe the problem you are having in as much detail as possible:

When using Client.fetchInvite to fetch metadata about a Group DM Invite code, the returned Invite object has the channel property set to null, even though the API returns a partial DM Group Channel object. Additionally, DJS will emit the debug event Failed to find guild, or unknown type for channel <channel ID> 3. This is probably because DJS doesn't support Group DMs anymore in v12 and as such it doesn't know how to resolve the channel type 3.

Currently the documentation for the Invite object states that channel is a non-nullable property, which appears to be wrong in the case of Group Invites. If this is intended behavior the docuentation and typings should be adjusted to reflect that channel might be null. However I've also asked on the Support Server and we came to the conclusion that it would be nice to have a partial channel object for Group Invites; after all the channel data is included in the API response (relevant message link).

Reproduction steps:

Further details:

JackCrispy commented 5 years ago

Same