Fix Interaction.channel being None in threads

This commit is contained in:
Nadir Chowdhury
2021-07-01 12:49:44 +01:00
committed by GitHub
parent d001b9d0ee
commit 2d597e310b
3 changed files with 16 additions and 7 deletions

View File

@@ -586,6 +586,12 @@ class Guild(Hashable):
channels.sort(key=lambda c: (c._sorting_bucket, c.position, c.id))
return as_list
def _resolve_channel(self, id: Optional[int], /) -> Optional[Union[GuildChannel, Thread]]:
if id is None:
return
return self._channels.get(id) or self._threads.get(id)
def get_channel(self, channel_id: int, /) -> Optional[GuildChannel]:
"""Returns a channel with the given ID.