diff --git a/discord/abc.py b/discord/abc.py index ee50b5f9f6..eba3389e8a 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -351,8 +351,7 @@ def __init__( ): ... def __str__(self) -> str: - flags = getattr(self, "flags", None) - if flags is not None and getattr(flags, "obfuscated", False): + if self.obfuscated: return f"Obfuscated Channel ({self.id})" return self.name @@ -697,6 +696,16 @@ def permissions_synced(self) -> bool: category = self.guild.get_channel(self.category_id) return bool(category and category.overwrites == self.overwrites) + @property + def obfuscated(self) -> bool: + """Whether the channel is obfuscated. + + This is an alias for :attr:`~ChannelFlags.channel_obfuscated`. + + .. versionadded:: 2.9 + """ + return self.flags.channel_obfuscated + def permissions_for(self, obj: Member | Role, /) -> Permissions: """Handles permission resolution for the :class:`~discord.Member` or :class:`~discord.Role`. diff --git a/discord/flags.py b/discord/flags.py index 524ed3c593..29ce87b8fb 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -1619,7 +1619,7 @@ def hide_media_download_options(self): return 1 << 15 @flag_value - def obfuscated(self): + def channel_obfuscated(self): """:class:`bool`: Returns ``True`` if the channel is obfuscated by the gateway.""" return 1 << 17