~av and .uinfo now show gif avatars properly
This commit is contained in:
parent
cf13e95951
commit
1c142a0fc5
@ -618,9 +618,13 @@ namespace NadekoBot.Modules.Searches
|
||||
if (usr == null)
|
||||
usr = Context.User;
|
||||
|
||||
var avatarUrl = usr.RealAvatarUrl();
|
||||
var shortenedAvatarUrl = await NadekoBot.Google.ShortenUrl(avatarUrl).ConfigureAwait(false);
|
||||
await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
||||
.WithTitle($"{usr}'s Avatar")
|
||||
.WithImageUrl(usr.AvatarUrl)).ConfigureAwait(false);
|
||||
.AddField(efb => efb.WithName("Username").WithValue(usr.ToString()).WithIsInline(false))
|
||||
.AddField(efb => efb.WithName("Avatar Url").WithValue(shortenedAvatarUrl).WithIsInline(false))
|
||||
//.AddField(efb => efb.WithName("Avatar Id").WithValue(usr.AvatarId).WithIsInline(false))
|
||||
.WithThumbnailUrl(avatarUrl), Context.User.Mention).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
|
@ -97,7 +97,7 @@ namespace NadekoBot.Modules.Utility
|
||||
.AddField(fb => fb.WithName("**Joined Server**").WithValue($"{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm")}").WithIsInline(true))
|
||||
.AddField(fb => fb.WithName("**Joined Discord**").WithValue($"{user.CreatedAt.ToString("dd.MM.yyyy HH:mm")}").WithIsInline(true))
|
||||
.AddField(fb => fb.WithName("**Roles**").WithValue($"**({user.RoleIds.Count - 1})** - {string.Join("\n", user.GetRoles().Where(r => r.Id != r.Guild.EveryoneRole.Id).Select(r => r.Name)).SanitizeMentions()}").WithIsInline(true))
|
||||
.WithThumbnailUrl(user.AvatarUrl)
|
||||
.WithThumbnailUrl(user.RealAvatarUrl())
|
||||
.WithColor(NadekoBot.OkColor);
|
||||
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -425,5 +425,12 @@ namespace NadekoBot.Extensions
|
||||
|
||||
public static bool IsDiscordInvite(this string str)
|
||||
=> filterRegex.IsMatch(str);
|
||||
|
||||
public static string RealAvatarUrl(this IUser usr)
|
||||
{
|
||||
return usr.AvatarId.StartsWith("a_")
|
||||
? $"{DiscordConfig.CDNUrl}avatars/{usr.Id}/{usr.AvatarId}.gif"
|
||||
: usr.AvatarUrl;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user