Beispiel #1
0
        public async Task ClearReservationsAsync(
            [Summary("The three-letter code which identifies the server to clear.")]
            string serverCode = null)
        {
            if (serverCode == null)
            {
                await _playtesting.ClearServerReservations();
            }
            else
            {
                await _playtesting.ClearServerReservations(serverCode);
            }

            await ReplyAsync(string.Empty, false, _playtesting.DisplayServerReservations());

            await DataBaseUtil.AddCommandAsync("ClearReservations", Context);
        }
        public async Task ReleasePublicTestCommandAsync([Remainder] string command = null)
        {
            Server server = null;

            if (!_playtesting.CanReserve)
            {
                await ReplyAsync($"```Servers cannot be reserved at this time." +
                                 $"\nServer reservation is blocked 1 hour before a scheduled test, and resumes once the calendar event has passed.```");

                return;
            }
            bool hasServer = false;

            foreach (UserData u in _playtesting.UserData)
            {
                if (u.User != Context.Message.Author)
                {
                    continue;
                }
                server    = u.ReservedServer;
                hasServer = true;
            }

            if (hasServer)
            {
                await ReplyAsync("```Releasing Server reservation.```");

                await _playtesting.ClearServerReservations(server.name);
            }
            else
            {
                await ReplyAsync("```I could not locate a server reservation for your account.```");
            }

            await DataBaseUtil.AddCommandAsync("ReleaseServer", Context);
        }