Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: member not being cached in Guild.getch_members in the case of user_ids of length one #974

Merged
merged 4 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/974.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :meth:`Guild.get_or_fetch_members` not caching anything in the case of 1 unresolved ID.
5 changes: 4 additions & 1 deletion disnake/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -4294,7 +4294,10 @@ async def get_or_fetch_members(
if len(unresolved_ids) == 1:
# fetch_member is cheaper than query_members
EQUENOS marked this conversation as resolved.
Show resolved Hide resolved
try:
members.append(await self.fetch_member(unresolved_ids[0]))
member = await self.fetch_member(unresolved_ids[0])
members.append(member)
if cache:
self._add_member(member)
except HTTPException:
pass
else:
Expand Down