Skip to content

Commit a250bda

Browse files
committed
fix: Incorrect merges
1 parent 901ce25 commit a250bda

2 files changed

Lines changed: 64 additions & 63 deletions

File tree

discord/member.py

Lines changed: 51 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,18 @@ class VoiceState:
132132
)
133133

134134
def __init__(
135-
self,
136-
*,
137-
data: VoiceStatePayload | GuildVoiceStatePayload,
138-
channel: VocalGuildChannel | None = None,
135+
self,
136+
*,
137+
data: VoiceStatePayload | GuildVoiceStatePayload,
138+
channel: VocalGuildChannel | None = None,
139139
):
140140
self.session_id: str = data.get("session_id")
141141
self._update(data, channel)
142142

143143
def _update(
144-
self,
145-
data: VoiceStatePayload | GuildVoiceStatePayload,
146-
channel: VocalGuildChannel | None,
144+
self,
145+
data: VoiceStatePayload | GuildVoiceStatePayload,
146+
channel: VocalGuildChannel | None,
147147
):
148148
self.self_mute: bool = data.get("self_mute", False)
149149
self.self_deaf: bool = data.get("self_deaf", False)
@@ -187,7 +187,7 @@ def _create_default(cls, channel: VocalGuildChannel, client: Client) -> VoiceSta
187187

188188
def flatten_user(cls):
189189
for attr, value in itertools.chain(
190-
BaseUser.__dict__.items(), User.__dict__.items()
190+
BaseUser.__dict__.items(), User.__dict__.items()
191191
):
192192
# ignore private/special methods
193193
if attr.startswith("_"):
@@ -335,7 +335,7 @@ class Member(discord.abc.Messageable, _UserTag):
335335
avatar_decoration: Asset | None
336336

337337
def __init__(
338-
self, *, data: MemberWithUserPayload, guild: Guild, state: ConnectionState
338+
self, *, data: MemberWithUserPayload, guild: Guild, state: ConnectionState
339339
):
340340
self._state: ConnectionState = state
341341
self._user: User = state.store_user(data["user"])
@@ -405,11 +405,11 @@ def _update_from_message(self, data: MemberPayload) -> None:
405405

406406
@classmethod
407407
def _try_upgrade(
408-
cls: type[M],
409-
*,
410-
data: UserWithMemberPayload,
411-
guild: Guild,
412-
state: ConnectionState,
408+
cls: type[M],
409+
*,
410+
data: UserWithMemberPayload,
411+
guild: Guild,
412+
state: ConnectionState,
413413
) -> User | M:
414414
# A User object with a 'member' key
415415
try:
@@ -472,7 +472,7 @@ def _update(self, data: MemberPayload | MemberUpdateEventPayload) -> None:
472472
self._avatar_decoration = data.get("avatar_decoration_data")
473473

474474
def _presence_update(
475-
self, data: PartialPresenceUpdate, user: UserPayload
475+
self, data: PartialPresenceUpdate, user: UserPayload
476476
) -> tuple[User, User] | None:
477477
self.activities = tuple(map(create_activity, data["activities"]))
478478
self._client_status = {
@@ -499,7 +499,7 @@ def _update_inner_user(self, user: UserPayload) -> tuple[User, User] | None:
499499
)
500500
# These keys seem to always be available
501501
if (
502-
new_primary_guild_data := user.get("primary_guild")
502+
new_primary_guild_data := user.get("primary_guild")
503503
) and new_primary_guild_data.get("identity_enabled"):
504504
new_primary_guild: PrimaryGuild | None = PrimaryGuild(
505505
new_primary_guild_data, state=self._state
@@ -663,8 +663,9 @@ def display_name(self) -> str:
663663
def display_avatar(self) -> Asset:
664664
"""Returns the member's display avatar.
665665
666-
Returns the user's guild avatar.
667-
If the user does not have a guild avatar, their global avatar is returned instead.
666+
For regular members this is just their avatar, but
667+
if they have a guild specific avatar then that
668+
is returned instead.
668669
669670
.. versionadded:: 2.0
670671
"""
@@ -687,8 +688,9 @@ def guild_avatar(self) -> Asset | None:
687688
def display_avatar_decoration(self) -> Asset | None:
688689
"""Returns the member's displayed avatar decoration.
689690
690-
Returns the user's guild avatar decoration.
691-
If the user does not have a guild avatar decoration, their global avatar decoration is returned instead.
691+
For regular members this is just their avatar decoration, but
692+
if they have a guild specific avatar decoration then that
693+
is returned instead.
692694
693695
.. versionadded:: 2.8
694696
"""
@@ -711,8 +713,9 @@ def guild_avatar_decoration(self) -> Asset | None:
711713
def display_banner(self) -> Asset | None:
712714
"""Returns the member's display banner.
713715
714-
Returns the user's guild banner.
715-
If the user does not have a guild banner, their global banner is returned instead.
716+
For regular members this is just their banner, but
717+
if they have a guild specific banner then that
718+
is returned instead.
716719
717720
.. versionadded:: 2.7
718721
"""
@@ -820,16 +823,16 @@ def timed_out(self) -> bool:
820823
.. versionadded:: 2.0
821824
"""
822825
return (
823-
self.communication_disabled_until is not None
824-
and self.communication_disabled_until
825-
> datetime.datetime.now(datetime.timezone.utc)
826+
self.communication_disabled_until is not None
827+
and self.communication_disabled_until
828+
> datetime.datetime.now(datetime.timezone.utc)
826829
)
827830

828831
async def ban(
829-
self,
830-
*,
831-
delete_message_seconds: int | None = None,
832-
reason: str | None = None,
832+
self,
833+
*,
834+
delete_message_seconds: int | None = None,
835+
reason: str | None = None,
833836
) -> None:
834837
"""|coro|
835838
@@ -856,20 +859,20 @@ async def kick(self, *, reason: str | None = None) -> None:
856859
await self.guild.kick(self, reason=reason)
857860

858861
async def edit(
859-
self,
860-
*,
861-
nick: str | None = MISSING,
862-
mute: bool = MISSING,
863-
deafen: bool = MISSING,
864-
suppress: bool = MISSING,
865-
roles: list[discord.abc.Snowflake] = MISSING,
866-
voice_channel: VocalGuildChannel | None = MISSING,
867-
reason: str | None = None,
868-
communication_disabled_until: datetime.datetime | None = MISSING,
869-
bypass_verification: bool | None = MISSING,
870-
banner: bytes | None = MISSING,
871-
avatar: bytes | None = MISSING,
872-
bio: str | None = MISSING,
862+
self,
863+
*,
864+
nick: str | None = MISSING,
865+
mute: bool = MISSING,
866+
deafen: bool = MISSING,
867+
suppress: bool = MISSING,
868+
roles: list[discord.abc.Snowflake] = MISSING,
869+
voice_channel: VocalGuildChannel | None = MISSING,
870+
reason: str | None = None,
871+
communication_disabled_until: datetime.datetime | None = MISSING,
872+
bypass_verification: bool | None = MISSING,
873+
banner: bytes | None = MISSING,
874+
avatar: bytes | None = MISSING,
875+
bio: str | None = MISSING,
873876
) -> Member | None:
874877
"""|coro|
875878
@@ -1072,7 +1075,7 @@ async def edit(
10721075
return Member(data=data, guild=self.guild, state=self._state)
10731076

10741077
async def timeout(
1075-
self, until: datetime.datetime | None, *, reason: str | None = None
1078+
self, until: datetime.datetime | None, *, reason: str | None = None
10761079
) -> None:
10771080
"""|coro|
10781081
@@ -1097,7 +1100,7 @@ async def timeout(
10971100
await self.edit(communication_disabled_until=until, reason=reason)
10981101

10991102
async def timeout_for(
1100-
self, duration: datetime.timedelta, *, reason: str | None = None
1103+
self, duration: datetime.timedelta, *, reason: str | None = None
11011104
) -> None:
11021105
"""|coro|
11031106
@@ -1182,7 +1185,7 @@ async def request_to_speak(self) -> None:
11821185
await self._state.http.edit_my_voice_state(self.guild.id, payload)
11831186

11841187
async def move_to(
1185-
self, channel: VocalGuildChannel | None, *, reason: str | None = None
1188+
self, channel: VocalGuildChannel | None, *, reason: str | None = None
11861189
) -> None:
11871190
"""|coro|
11881191
@@ -1207,7 +1210,7 @@ async def move_to(
12071210
await self.edit(voice_channel=channel, reason=reason)
12081211

12091212
async def add_roles(
1210-
self, *roles: Snowflake, reason: str | None = None, atomic: bool = True
1213+
self, *roles: Snowflake, reason: str | None = None, atomic: bool = True
12111214
) -> None:
12121215
r"""|coro|
12131216
@@ -1250,7 +1253,7 @@ async def add_roles(
12501253
await req(guild_id, user_id, role.id, reason=reason)
12511254

12521255
async def remove_roles(
1253-
self, *roles: Snowflake, reason: str | None = None, atomic: bool = True
1256+
self, *roles: Snowflake, reason: str | None = None, atomic: bool = True
12541257
) -> None:
12551258
r"""|coro|
12561259

discord/user.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
from .types.user import PartialUser as PartialUserPayload
5151
from .types.user import User as UserPayload
5252

53-
5453
__all__ = (
5554
"User",
5655
"ClientUser",
@@ -100,7 +99,7 @@ class BaseUser(_UserTag):
10099
collectibles: Collectibles
101100

102101
def __init__(
103-
self, *, state: ConnectionState, data: UserPayload | PartialUserPayload
102+
self, *, state: ConnectionState, data: UserPayload | PartialUserPayload
104103
) -> None:
105104
self._state = state
106105
self._update(data)
@@ -249,9 +248,8 @@ def default_avatar(self) -> Asset:
249248

250249
@property
251250
def display_avatar(self) -> Asset:
252-
"""Returns the user's display avatar.
251+
"""Returns the user's uploaded avatar.
253252
254-
Returns the user's uploaded avatar.
255253
If the user has not uploaded any avatar, their default avatar is returned instead.
256254
257255
.. versionadded:: 2.0
@@ -467,11 +465,11 @@ def _update(self, data: UserPayload) -> None:
467465

468466
# TODO: Username might not be able to edit anymore.
469467
async def edit(
470-
self,
471-
*,
472-
username: str = MISSING,
473-
avatar: bytes = MISSING,
474-
banner: bytes = MISSING,
468+
self,
469+
*,
470+
username: str = MISSING,
471+
avatar: bytes = MISSING,
472+
banner: bytes = MISSING,
475473
) -> ClientUser:
476474
"""|coro|
477475
@@ -686,12 +684,12 @@ async def create_test_entitlement(self, sku: discord.abc.Snowflake) -> Entitleme
686684
return Entitlement(data=data, state=self._state)
687685

688686
def entitlements(
689-
self,
690-
skus: list[Snowflake] | None = None,
691-
before: SnowflakeTime | None = None,
692-
after: SnowflakeTime | None = None,
693-
limit: int | None = 100,
694-
exclude_ended: bool = False,
687+
self,
688+
skus: list[Snowflake] | None = None,
689+
before: SnowflakeTime | None = None,
690+
after: SnowflakeTime | None = None,
691+
limit: int | None = 100,
692+
exclude_ended: bool = False,
695693
) -> EntitlementIterator:
696694
"""Returns an :class:`.AsyncIterator` that enables fetching the user's entitlements.
697695

0 commit comments

Comments
 (0)