mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-20 20:16:06 -04:00
bug: When fetching a member by user id from a server guild: the returned Member does not have a user property. #21
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BoQsc on GitHub (Dec 2, 2022).
What happened?
Clarifications
Affected
I'm trying to get the username of a member on the server/guild.
For fetching a member I use
.fetchMember.user property/accessor is missing when fetching a member from a server using a user id.
Returned member object. (missing user: property/accessor )
Example:
Example output:
@BoQsc commented on GitHub (Dec 2, 2022):
As you can see in the example output
username property is undefined.
@BoQsc commented on GitHub (Dec 3, 2022):
Turns out to be very easy to reproduce.
I've tested this example with 4 bots and three separate servers, out of which one was completely new.
It happens to be that only the first invited bot is the only one capable of returning.
guild_member.user.usernameand the wholeguild_member.userobject.@BoQsc commented on GitHub (Dec 3, 2022):
So yeah, this whole issue seems to be only about invited bots that are second or third or fourth... in the server.
@BoQsc commented on GitHub (Dec 3, 2022):
Temporary untested workaround for other bot developers:
There is a chance that it is possible to do a workaround by fetching all members of the server/guild and selecting the user object.
https://revolt.js.org/classes/maps_Servers.Server.html#fetchMembers
Again, haven't tried that. Might not work as well.
@insertish commented on GitHub (Jan 26, 2023):
The library is designed around the client so this is sort of intended behavior, users aren't fetched automatically with members. I am working towards figuring this out in the near future.