public async Task WhoIsAsync(EventContext e) { ArgObject arg = e.Arguments.Join(); if (arg == null) { throw new ArgumentNullException(); } IDiscordGuildUser user = await arg.GetUserAsync(e.Guild); //if (user == null) //{ // user = e.Author as IGuildUser; //} var embed = e.CreateEmbedBuilder(); embed.WithTitle("whois_title", user.Username); embed.EmbedBuilder.SetColor(0.5f, 0f, 1.0f); embed.EmbedBuilder.ImageUrl = user.GetAvatarUrl(); var roles = (await e.Guild.GetRolesAsync()).Where(x => user.RoleIds.Contains(x.Id) && x.Color.Value != 0).OrderByDescending(x => x.Position); Color c = roles.FirstOrDefault()?.Color ?? new Color(0); StringBuilder builder = new StringBuilder(); builder.AppendLine($"User Id : **{user.Id}**"); builder.AppendLine( $"Username: **{user.Username}#{user.Discriminator} {(string.IsNullOrEmpty((user as IDiscordGuildUser).Nickname) ? "" : $"({(user as IDiscordGuildUser).Nickname})")}**"); //builder.AppendLine($"Created at: **{user.CreatedAt.ToString()}**"); builder.AppendLine($"Joined at : **{user.JoinedAt.ToString()}**"); builder.AppendLine($"Color Hex : **#{c.ToHexString()}**"); embed.AddField( e.CreateResource("miki_module_whois_tag_personal"), new StringResource(builder.ToString()) ); string r = string.Join(" ", roles.Select(x => x.Name)); if (string.IsNullOrEmpty(r)) { r = "none (yet!)"; } if (r.Length <= 1000) { embed.AddField( e.CreateResource("miki_module_general_guildinfo_roles"), new StringResource(r) ); } embed.Build().QueueToChannel(e.Channel); }