Ejemplo n.º 1
0
        public async Task <ICollection <Lobby> > GetArenas(DiscordGuild guild, DiscordChannel channel, DateTimeOffset queryTime, bool specialChannel)
        {
            var lobbies = specialChannel ?
                          await LobbyController.GetGlobalLobbies(_context) :
                          await LobbyController.GetLobbies(_context, guild, channel);

            var lobbies2Delete = (from l in lobbies where l.RemovalReferenceTime.AddHours(Lobby.HourLimit) <= queryTime select l).ToArray();

            if (lobbies2Delete.Length == 0)
            {
                return(lobbies);
            }

            await LobbyController.DeleteLobbies(_context, lobbies2Delete);

            return(await LobbyController.GetLobbies(_context, guild, channel));
        }