mirror of
https://github.com/Ryubing/RyujinxHelper.git
synced 2025-05-13 02:30:36 +01:00
21 lines
No EOL
819 B
C#
21 lines
No EOL
819 B
C#
namespace RyuBot.Commands.Text.Modules;
|
|
|
|
public sealed partial class UtilityModule
|
|
{
|
|
[Command("Avatar")]
|
|
[Description("Shows the mentioned user's avatar, or yours if no one is mentioned.")]
|
|
public Task<ActionResult> AvatarAsync(
|
|
[Remainder, Description("The user whose avatar you want to get. Defaults to yourself.")]
|
|
SocketGuildUser user = null)
|
|
{
|
|
user ??= Context.User;
|
|
|
|
return Ok(Context.CreateEmbedBuilder(formatAvatarSizesToUrls(128, 256, 512, 1024))
|
|
.WithAuthor(user)
|
|
.WithImageUrl(user.GetEffectiveAvatarUrl()));
|
|
|
|
string formatAvatarSizesToUrls(params ushort[] sizes) =>
|
|
sizes.Select(x => $"{Format.Url(x.ToString(), user.GetEffectiveAvatarUrl(size: x))} ")
|
|
.JoinToString('|').Trim();
|
|
}
|
|
} |