Example #1
0
        public async Task LastMatch()
        {
            var discordUser = Context.User;

            using (var context = new BotDBContext())
            {
                var user = await context.Users.FirstOrDefaultAsync(u => u.DiscordId == discordUser.Id);

                if (user != null)
                {
                    var usersPlayers = await context.UsersPlayers.Where(u => u.UserID == user.ID).Include(p => p.Players).FirstOrDefaultAsync();

                    if (usersPlayers != null)
                    {
                        StringBuilder builder = new StringBuilder();
                        builder.AppendLine(Strings.YourPlayers);
                        foreach (var player in usersPlayers.Players)
                        {
                            using (var con = new PubgDB())
                            {
                                var playerInDB = await con.Players.FirstOrDefaultAsync(p => p.Id == player.PubgID);

                                builder.AppendLine(playerInDB.Name);
                            }
                        }
                        await ReplyAsync(builder.ToString());
                    }
                    else
                    {
                        await ReplyAsync(Strings.NoWatchFound);
                    }
                }
                else
                {
                    await ReplyAsync(Strings.NoWatchFound);
                }
            }
        }
Example #2
0
 public PlayerRepository()
 {
     PubgDB        = new PubgDB();
     playerService = new PubgPlayerService();
 }
Example #3
0
 public PlayerRepository(Player player)
 {
     playerService = new PubgPlayerService();
     PubgDB        = new PubgDB();
     Player        = player;
 }
Example #4
0
 public PubgModule()
 {
     pubgDB = new PubgDB();
     botDB  = new BotDBContext();
 }