From 75d57ab3cee640a5960d4a9c78ee5003c14d11a1 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 6 Jun 2022 12:26:05 -0400 Subject: [PATCH] Fix warning in entity_type reassignment --- discord/guild.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/discord/guild.py b/discord/guild.py index ee9666e06..ef8182256 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -2746,14 +2746,16 @@ class Guild(Hashable): if channel is MISSING: entity_type = EntityType.external else: - entity_type = getattr(channel, '_scheduled_event_entity_type', MISSING) - if entity_type is None: + _entity_type = getattr(channel, '_scheduled_event_entity_type', MISSING) + if _entity_type is None: raise TypeError( f'invalid GuildChannel type passed, must be VoiceChannel or StageChannel not {channel.__class__!r}' ) - if entity_type is MISSING: + if _entity_type is MISSING: raise TypeError('entity_type must be passed in when passing an ambiguous channel type') + entity_type = _entity_type + if not isinstance(entity_type, EntityType): raise TypeError('entity_type must be of type EntityType')