Bug fix to allow the calls to webhook APIs to succeed when using GuildThread.#351
Bug fix to allow the calls to webhook APIs to succeed when using GuildThread.#351AraHaan wants to merge 3 commits into
Conversation
…dThread. This fixes a bug where when using classes based on GuildThread (ones that most likely inherits from it), because GuildThread inherits from TextGuildChannel the inherited CreateWebhookAsync and the GetChannelWebhooksAsync methods would pass in only the Id (which for normal channels works), but for threads this would always fail as the thread Id would be used as a channel Id and Discord's API does not consider them to be valid channels. As such it is better to attempt to use ParentId (if not null), otherwise use Id (if ParentId is null). Signed-off-by: AraHaan <seandhunt_7@yahoo.com>
|
That is more like a Discord API quirk and I am not sure invoking these methods for the thread parent is a good idea. It introduces a confusing behavior and moves logic to autogenerated methods. |
|
Well, maybe this method simply shouldn't exist on channels where it would always return 404 and instead of introducing logic for passing the parent ID within NetCord, the developer can decide on what to do (notice the method doesn't exist and use it explicitly on the parent channel). |
Since A few years ago I had an idea of flattening the channel structure into just something like class Channel;
class GuildChannel : Channel;I think it would make the structure clearer but at the same time it would introduce lots of null/useless property values and basically every channel would have all possible channel-related methods so it would only make this issue worse. |
…l untouched. Instead we hjide them by generating these methods in GuildThread.
…tGuildChannel in GuildThread.
This fixes a bug where when using classes based on GuildThread (ones that most likely inherits from it), because GuildThread inherits from TextGuildChannel the inherited CreateWebhookAsync and the GetChannelWebhooksAsync methods would pass in only the Id (which for normal channels works), but for threads this would always fail as the thread Id would be used as a channel Id and Discord's API does not consider them to be valid channels. As such it is better to attempt to use ParentId (if not null), otherwise use Id (if ParentId is null).