DiscordClient.GetUserAsync() is bugged
Created by: 13xforever
Summary
client.GetUserAsync(userId)
will always return empty DiscordUser
object unless said user will be populated in the client cache by some other mean (e.g. when guild info is downloaded)
Details
DiscordClient.GetUserAsync()
calls BaseDiscordClient.InternalGetCachedUser()
then checks the result object for null
, and only when it's null
will it make an API call to get user info.
However BaseDiscordClient.InternalGetCachedUser()
was changed in 7df4373f to always return a non-null object.
Notes
IMHO InternalGetCachedUser
signature should be changed to the TryGet
pattern and return explicit bool
value as a result.