Browse Source

Ruff format

pull/10285/head
Soheab_ 3 weeks ago
parent
commit
93fafb669a
  1. 2
      discord/enums.py
  2. 16
      discord/member.py
  3. 1
      discord/types/member.py

2
discord/enums.py

@ -1029,7 +1029,7 @@ class DisplayNameEffect(Enum):
neon = 3
toon = 4
pop = 5
glow = 6
glow = 6
def create_unknown_value(cls: Type[E], val: Any) -> E:

16
discord/member.py

@ -668,16 +668,16 @@ class Member(discord.abc.Messageable, _UserTag):
if self._banner is None:
return None
return Asset._from_guild_banner(self._state, self.guild.id, self.id, self._banner)
@property
def display_name_style(self) -> Optional[DisplayNameStyle]:
"""Optional[:class:`DisplayNameStyle`]: Returns the member's guild display name style if they have one,
"""Optional[:class:`DisplayNameStyle`]: Returns the member's guild display name style if they have one,
otherwise their global display name style if they have one, otherwise ``None``.
.. versionadded:: 2.8
"""
return self.guild_display_name_style or self.global_display_name_style
@property
def guild_display_name_style(self) -> Optional[DisplayNameStyle]:
"""Optional[:class:`DisplayNameStyle`]: Returns the member's guild specific display name style.
@ -688,7 +688,7 @@ class Member(discord.abc.Messageable, _UserTag):
if self._display_name_style is None:
return None
return DisplayNameStyle(data=self._display_name_style)
@property
def global_display_name_style(self) -> Optional[DisplayNameStyle]:
"""Optional[:class:`DisplayNameStyle`]: Returns the user's global display name style.
@ -947,7 +947,7 @@ class Member(discord.abc.Messageable, _UserTag):
display_name_font: Optional[:class:`DisplayNameFont`]
The new display name font for the member. Use ``None`` to remove the display name font.
This can only be set when editing the bot's own member.
.. versionadded:: 2.8
display_name_effect: Optional[:class:`DisplayNameEffect`]
The new display name effect for the member. Use ``None`` to remove the display name effect.
@ -1022,10 +1022,8 @@ class Member(discord.abc.Messageable, _UserTag):
if not me and self_payload:
only_fields = {'avatar', 'banner', 'bio', 'display_name_font', 'display_name_effect', 'display_name_colors'}
current_fields = utils._human_join(list(only_fields.intersection(set(self_payload.keys()))), final="and")
raise ValueError(
f'Editing {current_fields} can only happen when editing the bot\'s own member.'
)
current_fields = utils._human_join(list(only_fields.intersection(set(self_payload.keys()))), final='and')
raise ValueError(f"Editing {current_fields} can only happen when editing the bot's own member.")
if deafen is not MISSING:
payload['deaf'] = deafen

1
discord/types/member.py

@ -63,6 +63,7 @@ class _OptionalMemberWithUser(PartialMember, total=False):
avatar_decoration_data: NotRequired[AvatarDecorationData]
display_name_style: NotRequired[DisplayNameStyle]
class MemberWithUser(_OptionalMemberWithUser):
user: User

Loading…
Cancel
Save