I have a method to get mentioned Users:
public DiscordSocketClient client;
public static SocketUser FromMention(string mention) {
Regex regex = new Regex("^<@!{0,1}(\\d+)>$");
Match match = regex.Match(mention);
if (!match.Success) {
return null;
}
ulong id = ulong.Parse(match.Groups.Values.ToArray()[1].Value);
return client.GetUser(id);
}
which stopped working like a week ago (maybe I just didnt notice it before) because GetUser started to return null for active online users. These users are not invisible, offline or inactive. I also tried this with a testinstance of the bot with just 2 servers and less than 50 users and the problem still occures. Some users are null everytime.
I also tried to use the DownloadUsersAsync functions but it didnt help either.
There is a TypeReader for users... why aren't you using that?
I just tried this right now, and it does successfully get the user. How many guilds is the bot in?
Related to https://github.com/discord-net/Discord.Net/issues/1656 (some temporary solutions are over there already)
This issue is caused by Discord recently disabling "privileged intents" in their gateway. It does not appear Discord.Net has updated the public release to meet the new requirements for accessing the members list from a single guild. The dev release has a fix.
https://support-dev.discord.com/hc/en-us/articles/360056426994
Ok its really easy to fix.
You just have to enable intents for your bot in the discord developer portal.

Most helpful comment
Related to https://github.com/discord-net/Discord.Net/issues/1656 (some temporary solutions are over there already)
This issue is caused by Discord recently disabling "privileged intents" in their gateway. It does not appear Discord.Net has updated the public release to meet the new requirements for accessing the members list from a single guild. The dev release has a fix.
https://support-dev.discord.com/hc/en-us/articles/360056426994