Fix AutoMod audit log entry error due to empty channel_id

This commit is contained in:
Lilly Rose Berner 2023-05-03 02:19:21 +02:00 committed by GitHub
parent c8e2644497
commit 34a434b2af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -652,7 +652,9 @@ class AuditLogEntry(Hashable):
):
channel_id = utils._get_as_snowflake(extra, 'channel_id')
channel = None
if channel_id is not None:
# May be an empty string instead of None due to a Discord issue
if channel_id:
channel = self.guild.get_channel_or_thread(channel_id) or Object(id=channel_id)
self.extra = _AuditLogProxyAutoModAction(