mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Add DM support
This commit is contained in:
parent
2e0c30eb5d
commit
a2c8cbb560
9 changed files with 79 additions and 45 deletions
|
|
@ -55,16 +55,5 @@ namespace Myriad.Cache
|
|||
foreach (var mention in evt.Mentions)
|
||||
await cache.SaveUser(mention);
|
||||
}
|
||||
|
||||
public static async ValueTask<User?> GetOrFetchUser(this IDiscordCache cache, DiscordApiClient rest, ulong userId)
|
||||
{
|
||||
if (cache.TryGetUser(userId, out var cacheUser))
|
||||
return cacheUser;
|
||||
|
||||
var restUser = await rest.GetUser(userId);
|
||||
if (restUser != null)
|
||||
await cache.SaveUser(restUser);
|
||||
return restUser;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue