[Feature] Support for the new username system (#2696)

* update a lot of stuff

* update CDN for new avatar calculation

* whoops, forgot to commit

* handle `null` values

* Remove duplicate line

Co-authored-by: Dmitry <dimson-n@users.noreply.github.com>

* updates

* Apply suggestions from code review

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>

* Apply suggestion

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>

* update `SocketThreadUSer`

---------

Co-authored-by: Dmitry <dimson-n@users.noreply.github.com>
Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
This commit is contained in:
Misha133
2023-06-27 17:11:32 +03:00
committed by GitHub
parent 9ddd922d2f
commit df717e6b2c
22 changed files with 113 additions and 39 deletions

View File

@@ -72,6 +72,7 @@ namespace Discord
string extension = FormatToExtension(format, bannerId);
return $"{DiscordConfig.CDNUrl}banners/{userId}/{bannerId}.{extension}?size={size}";
}
/// <summary>
/// Returns the default user avatar URL.
/// </summary>
@@ -83,6 +84,19 @@ namespace Discord
{
return $"{DiscordConfig.CDNUrl}embed/avatars/{discriminator % 5}.png";
}
/// <summary>
/// Returns the default user avatar URL.
/// </summary>
/// <param name="userId">The Id of a user.</param>
/// <returns>
/// A URL pointing to the user's default avatar when one isn't set.
/// </returns>
public static string GetDefaultUserAvatarUrl(ulong userId)
{
return $"{DiscordConfig.CDNUrl}embed/avatars/{(userId >> 22) % 6}.png";
}
/// <summary>
/// Returns an icon URL.
/// </summary>