public static EmbedAuthorBuilder ToEmbedAuthorBuilder(this SocketUser user) { var builder = new EmbedAuthorBuilder { IconUrl = user.GetEffectiveAvatarUrl(), Name = user.Format() }; return(builder); }
public Task <BaseResult> Command_GetAvatarAsync( [Name("User")][Description("The user who you wish to get the avatar for.")][DefaultValueDescription("The user who invoked this command.")] SocketUser target = null, [Name("Image_Size")][Description("The size of the resulting image.")] int size = 1024) { target = target ?? Context.Invoker; return(Ok(new EmbedBuilder { Author = target.ToEmbedAuthorBuilder().WithName($"Avatar for {target}"), ImageUrl = target.GetEffectiveAvatarUrl(Convert.ToUInt16(size)) })); }
public Task <BaseResult> Command_GetUserInfoAsync( [Name("Member")][Description("The user to get information for.")][DefaultValueDescription("The user who invoked this command.")] SocketUser member = null) { member = member ?? Context.Invoker; var embed = new EmbedBuilder { ThumbnailUrl = member.GetEffectiveAvatarUrl(256), Title = $"Information for user {member}", Color = member.GetHighestRoleColourOrDefault() }; embed.AddField("Created", FormatOffset(member.CreatedAt), true); if (member is SocketGuildUser guildUser) { if (guildUser.JoinedAt != null) { embed.AddField("Joined", FormatOffset(guildUser.JoinedAt.Value), true); } embed.AddField("Position", guildUser.Hierarchy == int.MaxValue ? "Server Owner" : "Position " + guildUser.Hierarchy, true); embed.AddField("Deafened", guildUser.IsDeafened, true); embed.AddField("Muted", guildUser.IsMuted, true); embed.AddField("Nickname", guildUser.Nickname ?? "None", true); embed.AddField("Voice Status", GetVoiceChannelStatus(guildUser), true); var roles = guildUser.Roles.Where(r => !r.IsEveryone); var socketRoles = roles as SocketRole[] ?? roles.ToArray(); if (socketRoles.Length != 0) { embed.AddField("Roles", string.Join(", ", socketRoles.Select(r => r.Name))); } } if (member.Activity != null) { embed.AddField("Activity", $"{member.Activity.Type.Humanize()} {member.Activity.Name}", true); } embed.AddField("Status", member.Status.Humanize(), true); embed.AddField("Is Bot or Webhook", member.IsBot || member.IsWebhook, true); return(Ok(embed)); }