mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Fix KeyError on Member Channels not in JSON
This commit is contained in:
parent
b15571455f
commit
12e31bb933
@ -204,8 +204,10 @@ class Widget:
|
||||
channels = {channel.id: channel for channel in self.channels}
|
||||
for member in data.get('members', []):
|
||||
connected_channel = _get_as_snowflake(member, 'channel_id')
|
||||
if connected_channel:
|
||||
if connected_channel in channels:
|
||||
connected_channel = channels[connected_channel]
|
||||
elif connected_channel:
|
||||
connected_channel = WidgetChannel(id=connected_channel, name='', position=0)
|
||||
|
||||
self.members.append(WidgetMember(state=self._state, data=member, connected_channel=connected_channel))
|
||||
|
||||
@ -230,7 +232,7 @@ class Widget:
|
||||
|
||||
@property
|
||||
def invite_url(self):
|
||||
"""Optiona[:class:`str`]: The invite URL for the guild, if available."""
|
||||
"""Optional[:class:`str`]: The invite URL for the guild, if available."""
|
||||
return self._invite
|
||||
|
||||
async def fetch_invite(self, *, with_counts=True):
|
||||
|
Loading…
x
Reference in New Issue
Block a user