-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ChannelManager#fetch without a guild #4929
Comments
the channel you're trying to fetch is from a guild which is not on the current shard, that seems to be the only explanation for this discord.js/src/managers/ChannelManager.js Lines 32 to 35 in 94c9cc2
ChannelManager#fetch would return a promise resolving with null
either way there is definetly a problem here, perhaps an error should be thrown if the guild is for another shard, this would have to be for v13 however |
@NotSugden It's fetching from the Rest API which is agnostic of shards/clusters meaning it should still work. Using the same method ChannelManager#fetch uses to fetch the channel from the API works as seen in this image so I'm not quite sure what's happening here. |
The issue lies in discord.js/src/structures/Channel.js Line 122 in 94c9cc2
Since this shard is not aware of the guild the channel you're fetching is in, that method will never create a d.js Channel object, since that requires a parent guild object to exist in the current shard's client. So the issue is not the API call - that works just fine - but the internal structure of Discord.js, in which a GuildChannel always has to have a known parent Guild object. |
Well that kinda ruins what I was working on. Maybe instead of this being a bug report, it could be a suggestion to make fetching a channel without a guild possible. |
Please describe the problem you are having in as much detail as possible:
When using ChannelManager#fetch for a channel that is not cached and is not in any guilds on the current cluster, I get null rather than the channel
Using
client.api
works fineInclude a reproducible code sample here, if possible:
Further details:
Relevant client options:
The text was updated successfully, but these errors were encountered: