Skip to content
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

fix: channel id might be null #2078

Merged
merged 10 commits into from
May 23, 2023
17 changes: 12 additions & 5 deletions discord/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1637,13 +1637,20 @@ def parse_webhooks_update(self, data) -> None:
)
return

channel = guild.get_channel(int(data["channel_id"]))
if channel is not None:
self.dispatch("webhooks_update", channel)
channel_id = data["channel_id"]
Lulalaby marked this conversation as resolved.
Show resolved Hide resolved
if channel_id is not None:
channel = guild.get_channel(int(channel_id))
if channel is not None:
self.dispatch("webhooks_update", channel)
else:
_log.debug(
"WEBHOOKS_UPDATE referencing an unknown channel ID: %s. Discarding.",
data["channel_id"],
)
else:
_log.debug(
"WEBHOOKS_UPDATE referencing an unknown channel ID: %s. Discarding.",
data["channel_id"],
"WEBHOOKS_UPDATE channel ID was null for guild: %s. Discarding.",
data["guild_id"],
)

def parse_stage_instance_create(self, data) -> None:
Expand Down