public async Task ClearReservationsAsync(string serverStr = null) { if (Context.IsPrivate) { await ReplyAsync("***This command can not be used in a DM***"); return; } if ((Context.User as SocketGuildUser).Roles.Contains(_dataServices.ModRole)) { if (serverStr == null) { await _levelTesting.ClearServerReservations(); } else { await _levelTesting.ClearServerReservations(serverStr); } await ReplyAsync("", false, _levelTesting.DisplayServerReservations()); } else { await _dataServices.ChannelLog($"{Context.User} is trying to clear reservations without the right permissions!"); await ReplyAsync("```You cannot use this command with your current permission level!```"); } }
public async Task ReleasePublicTestCommandAsync([Remainder] string command = null) { if (Context.IsPrivate) { await ReplyAsync("***This command can not be used in a DM***"); return; } if ((Context.User as SocketGuildUser).Roles.Contains(_dataServices.ActiveRole)) { JsonServer server = null; if (!_levelTesting.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; } Boolean hasServer = false; foreach (UserData u in _levelTesting.userData) { if (u.User == Context.Message.Author) { server = u.Server; hasServer = true; } } if (hasServer) { await ReplyAsync("```Releasing Server reservation.```"); await _levelTesting.ClearServerReservations(server.Name); } else { await ReplyAsync("```I could not locate a server reservation for your account.```"); } } else { await _dataServices.ChannelLog($"{Context.User} is trying to use public playtest commands without permission."); await ReplyAsync($"```You cannot use this command with your current permission level! You need {_dataServices.ActiveRole.Name} role.```"); } }