public async Task ShowUserProfileAsync([Summary("użytkownik(opcjonalne)")] SocketGuildUser user = null) { var usr = user ?? Context.User as SocketGuildUser; if (usr == null) { return; } using (var db = new Database.UserContext(Config)) { var allUsers = await db.GetCachedAllUsersAsync(); var botUser = allUsers.FirstOrDefault(x => x.Id == usr.Id); if (botUser == null) { await ReplyAsync("", embed : "Ta osoba nie ma profilu bota.".ToEmbedMessage(EMType.Error).Build()); return; } using (var stream = await _profile.GetProfileImageAsync(usr, botUser, allUsers.OrderByDescending(x => x.ExpCnt).ToList().IndexOf(botUser) + 1)) { await Context.Channel.SendFileAsync(stream, $"{usr.Id}.png"); } } }
public async Task ShowTopAsync([Summary("rodzaj topki(poziom/sc/tc/posty(m/ms)/karty)")] TopType type = TopType.Level) { var session = new ListSession <string>(Context.User, Context.Client.CurrentUser); await _session.KillSessionIfExistAsync(session); using (var db = new Database.UserContext(Config)) { var users = await db.GetCachedAllUsersAsync(); session.ListItems = _profile.BuildListView(_profile.GetTopUsers(users, type), type, Context.Guild); } session.Event = ExecuteOn.ReactionAdded; session.Embed = new EmbedBuilder { Color = EMType.Info.Color(), Title = $"Topka {type.Name()}" }; var msg = await ReplyAsync("", embed : session.BuildPage(0)); await msg.AddReactionsAsync(new[] { new Emoji("⬅"), new Emoji("➡") }); session.Message = msg; await _session.TryAddSession(session); }