public async Task InfoAboutMeAsync() { var user = Context.User is SocketGuildUser usr ? usr : await Context.Guild.GetUserFromGuildAsync(Context.User.Id); using var service = GetService <UserService>(); var detail = await service.Service.GetUserAsync(Context.Guild, user); if (detail == null) { await ReplyAsync("Uživatel nebyl v databázi nalezen. Buď ještě není na tomto serveu, nebo neprojevil aktivitu."); return; } var embed = await UserInfoHelper.CreateSimpleEmbedAsync(detail, Context); await ReplyAsync(embed : embed.Build()); }
public async Task InfoAsync(IUser userMention) { var user = userMention is SocketGuildUser usr ? usr : await Context.Guild.GetUserFromGuildAsync(userMention.Id); if (user == null) { await ReplyAsync("Uživatel nebyl na tomto serveru nalezen."); return; } using var service = GetService <UserService>(); var userDetail = await service.Service.GetUserAsync(Context.Guild, user); if (userDetail == null) { await ReplyAsync("Uživatel nebyl v databázi nalezen. Buď ještě není na tomto serveru, nebo neprojevil aktivitu."); return; } var mostActiveChannel = userDetail.GetMostActiveChannel(); var lastActiveChannel = userDetail.GetLastActiveChannel(); var detailFlags = userDetail.GetDetailFlags(); var clients = userDetail.User.ActiveClients.Select(o => o.ToString()); var embed = await UserInfoHelper.CreateSimpleEmbedAsync(userDetail, Context); embed .AddField("Práva", string.Join(", ", userDetail.User.GuildPermissions.GetPermissionsNames()), false); if (clients.Any()) { embed.AddField("Aktivní klienti", string.Join(", ", clients), false); } if (mostActiveChannel != null) { embed.AddField("Nejaktivnější kanál", $"<#{mostActiveChannel.Channel.Id}> ({mostActiveChannel.Count.FormatWithSpaces()})", false); } if (lastActiveChannel != null) { embed.AddField("Poslední zpráva v", $"<#{lastActiveChannel.Channel.Id}> ({lastActiveChannel.LastMessageAt.ToLocaleDatetime()})", false); } embed .AddField("Detaily", detailFlags.Count == 0 ? "-" : string.Join(", ", detailFlags), false); if (userDetail.ApiAccessCount != null) { embed.AddField("Počet volání API", userDetail.ApiAccessCount.Value.FormatWithSpaces(), true); } if (userDetail.WebAdminLoginCount != null) { embed.AddField("Počet přihlášení", userDetail.WebAdminLoginCount.Value.FormatWithSpaces(), true); } await ReplyAsync(embed : embed.Build()); }