diff options
| author | Anurag Singh <[email protected]> | 2020-05-20 16:12:42 +0530 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-05-29 23:21:36 -0400 |
| commit | 12e31bb9339b8cb81c40ee798558340ca4a90fb2 (patch) | |
| tree | 64b4985d4d778a9ca2aeca7335cfe71e01015774 | |
| parent | implement AllowedMentions.__repr__ (diff) | |
| download | discord.py-12e31bb9339b8cb81c40ee798558340ca4a90fb2.tar.xz discord.py-12e31bb9339b8cb81c40ee798558340ca4a90fb2.zip | |
Fix KeyError on Member Channels not in JSON
| -rw-r--r-- | discord/widget.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/discord/widget.py b/discord/widget.py index 11037fbb..291b70ef 100644 --- a/discord/widget.py +++ b/discord/widget.py @@ -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): |