Skip to content

Commit bc27fbe

Browse files
plun1331OmLanke
authored andcommitted
fix: user context command members having a None guild (Pycord-Development#2573)
* fix: user context command member having a `None` guild Signed-off-by: plun1331 <[email protected]> * Update CHANGELOG.md Signed-off-by: plun1331 <[email protected]> --------- Signed-off-by: plun1331 <[email protected]>
1 parent 3a5a7ad commit bc27fbe

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ These changes are available on the `master` branch, but have not yet been releas
5252
`SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
5353
- Fixed `PartialMessage`s causing errors when created from `PartialMessageable`.
5454
([#2568](https://github.com/Pycord-Development/pycord/pull/2500))
55+
- Fixed the `guild` attribute of `Member`s recieved from a `UserCommand` being `None`.
56+
([#2573](https://github.com/Pycord-Development/pycord/pull/2573))
5557

5658
## [2.6.0] - 2024-07-09
5759

discord/commands/core.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,12 +1786,8 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
17861786
v["id"] = int(i)
17871787
user = v
17881788
member["user"] = user
1789-
target = Member(
1790-
data=member,
1791-
guild=ctx.interaction._state._get_guild(ctx.interaction.guild_id),
1792-
state=ctx.interaction._state,
1793-
)
1794-
1789+
cache_flag = ctx.interaction._state.member_cache_flags.interaction
1790+
target = ctx.guild._get_and_update_member(member, user["id"], cache_flag)
17951791
if self.cog is not None:
17961792
await self.callback(self.cog, ctx, target)
17971793
else:

0 commit comments

Comments
 (0)