public override async Task PlaytestCommandStart(bool replyInContext, RconService rconService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("TF2 class PlaytestCommandStart", false, color: LOG_COLOR); } await base.PlaytestCommandStart(replyInContext, rconService); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"exec {_dataService.RSettings.General.TF2Config}; mp_restartgame 3"); await Task.Delay(3000); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"tv_record {PlaytestCommandInfo.DemoName}; say Recording {PlaytestCommandInfo.DemoName}"); _ = Task.Run(async() => { for (var i = 0; i < 4; i++) { _ = rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"say Playtest of {PlaytestCommandInfo.Title} is live! Be respectful and GLHF!", false); await Task.Delay(3000); } }); PlaytestCommandRunning = false; }
public override async Task PlaytestCommandPre(bool replyInContext, SrcdsLogService srcdsLogService, RconService rconService) { await base.PlaytestCommandPre(replyInContext, srcdsLogService, rconService); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("CSGO class PlaytestCommandPre", false, color: LOG_COLOR); } var config = IsCasual ? _dataService.RSettings.General.CSGOCasualConfig : _dataService.RSettings.General.CSGOCompConfig; await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"exec {config}"); await Task.Delay(1000); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"host_workshop_map {PlaytestCommandInfo.WorkshopId}"); _ = Task.Run(async() => { //Wait some, reset password await Task.Delay(10000); if (!IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {CompPassword}"); } }); PlaytestCommandRunning = false; }
/// <summary> /// Gets list of users from a test server and displays it in channel. /// You can then kick a user from the test server based on the list. /// </summary> /// <param name="serverAddress">Server address to get users from</param> /// <returns></returns> public async Task KickPlaytestUser(string serverAddress) { string description = null; //Get the raw status data var input = await _rconService.RconCommand(serverAddress, "status"); //Format the raw data into an array and do some cleanup var players = input.Replace('\r', '\0').Split('\n').Where(x => x.StartsWith("#")) .Select(y => y.Trim('#').Trim()).ToList(); //Remove the first and last index and they are a header and footer players.RemoveAt(0); players.RemoveAt(players.Count - 1); foreach (var player in players) { //Parse out the data from each line. var userId = player.Substring(0, player.IndexOf(' ')); var name = Regex.Match(player, "\"([^\"]*)\"").Value.Trim('"'); var steamId = Regex.Match(player, @"(STEAM_[\d]:[\d]:\d+)").Value; if (string.IsNullOrEmpty(steamId)) { steamId = "BOT"; } description += $"[{userId}] **{name}** - `{steamId}`\n"; } var embed = new EmbedBuilder() .WithAuthor("Type ID of player to kick, or exit to cancel") .WithColor(new Color(165, 55, 55)).WithDescription(description); var display = await _context.Channel.SendMessageAsync(embed : embed.Build()); var choice = await _interactive.NextMessageAsync(_context, timeout : TimeSpan.FromSeconds(20)); if (choice != null && !choice.Content.Equals("exit")) { var kickMessage = await _rconService.RconCommand(serverAddress, $"kickid {choice.Content}"); await choice.DeleteAsync(); embed.WithColor(new Color(55, 165, 55)).WithAuthor(kickMessage).WithDescription(""); await display.ModifyAsync(x => x.Embed = embed.Build()); await _log.LogMessage($"`{_context.User.Username}` kicked a user from a playtest.```{kickMessage}```"); return; } await display.DeleteAsync(); await choice.DeleteAsync(); }
public override async Task PlaytestTwentyMinuteTask(RconService rconService, SrcdsLogService srcdsLogService) { await base.PlaytestTwentyMinuteTask(rconService, srcdsLogService); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("CSGO class PlaytestTwentyMinuteTask", false, color: LOG_COLOR); } var wsId = GeneralUtil.GetWorkshopIdFromFqdn(WorkshopLink.ToString()); await rconService.RconCommand(ServerLocation, $"host_workshop_map {wsId}"); if (!IsCasual) { //Delay before setting password again. await Task.Delay(15000); await rconService.RconCommand(ServerLocation, $"sv_password {CompPassword}"); } //Run a loop to validate that the level has actually changed. _ = Task.Run(async() => { var tries = 0; //Loop until timeout, or success while (tries < 10) { //Wait before retry await Task.Delay(30 * 1000); var runningLevel = await rconService.GetRunningLevelAsync(ServerLocation); if (runningLevel != null && runningLevel.Length == 3 && runningLevel[1] == wsId) { break; } tries++; await _log.LogMessage($"Level not set after {tries} attempts. Trying again.", color: LOG_COLOR); await rconService.RconCommand(ServerLocation, $"host_workshop_map {wsId}"); } if (tries <= 10) { await _log.LogMessage($"Level changed after {tries} attempts!", color: LOG_COLOR); } else { await _log.LogMessage($"Failed to change level after {tries} attempts!", color: LOG_COLOR); } }); }
public override async Task PlaytestFifteenMinuteTask(RconService rconService, SrcdsLogService srcdsLogService) { await base.PlaytestFifteenMinuteTask(rconService, srcdsLogService); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("CSGO class PlaytestFifteenMinuteTask", false, color: LOG_COLOR); } var gameMode = IsCasual ? "casual" : "comp"; var embed = new EmbedBuilder() .WithAuthor($"Setting up test server for {CleanedTitle}") .WithTitle("Workshop Link") .WithUrl(WorkshopLink.ToString()) .WithThumbnailUrl(CanUseGallery ? GalleryImages[0] : _dataService.RSettings.General.FallbackTestImageUrl) .WithDescription( $"{DatabaseUtil.GetTestServer(ServerLocation).Description}" + $"\n{Description}") .WithColor(new Color(51, 100, 173)); //Set password as needed, again just in case RCON wasn't listening / server wasn't ready. if (IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {_dataService.RSettings.General.CasualPassword}"); embed.AddField("Connect To", $"`connect {ServerLocation}; password {_dataService.RSettings.General.CasualPassword}`"); } else { await rconService.RconCommand(ServerLocation, $"sv_password {CompPassword}"); } //Delay to make sure level has actually changed await Task.Delay(10000); await rconService.RconCommand(ServerLocation, $"exec {_dataService.RSettings.General.PostgameConfig}; bot_stop 1"); await rconService.RconCommand(ServerLocation, "say No damage activated!; script_execute nodamage"); await TestingChannel.SendMessageAsync(embed : embed.Build()); }
public override async Task PlaytestFifteenMinuteTask(RconService rconService, SrcdsLogService srcdsLogService) { await base.PlaytestFifteenMinuteTask(rconService, srcdsLogService); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("TF2 class PlaytestFifteenMinuteTask", false, color: LOG_COLOR); } var embed = new EmbedBuilder() .WithAuthor($"Setting up test server for {CleanedTitle}") .WithTitle("Workshop Link") .WithUrl(WorkshopLink.ToString()) .WithThumbnailUrl(CanUseGallery ? GalleryImages[0] : _dataService.RSettings.General.FallbackTestImageUrl) .WithDescription( $"{DatabaseUtil.GetTestServer(ServerLocation).Description}" + $"\n{Description}") .WithColor(new Color(51, 100, 173)); embed.AddField("Connect To", $"`connect {ServerLocation}; password {_dataService.RSettings.General.CasualPassword}`"); await rconService.RconCommand(ServerLocation, $"exec {_dataService.RSettings.General.PostgameConfig}"); await TestingChannel.SendMessageAsync(embed : embed.Build()); }
public override async Task PlaytestCommandPre(bool replyInContext, SrcdsLogService srcdsLogService, RconService rconService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("TF2 class PlaytestCommandPre", false, color: LOG_COLOR); } //Generic setup await base.PlaytestCommandPre(replyInContext, srcdsLogService, rconService); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"exec {_dataService.RSettings.General.TF2Config}"); await Task.Delay(1000); await rconService.RconCommand(ServerLocation, $"changelevel workshop/{PlaytestCommandInfo.WorkshopId}"); PlaytestCommandRunning = false; }
public virtual async Task PlaytestCommandStart(bool replyInContext, RconService rconService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestCommandStart", false, color: LOG_COLOR); } PlaytestCommandRunning = true; await _log.LogMessage("Running Playtest Start Tasks!", color : LOG_COLOR); //No context to send these messages to - default them if (!replyInContext) { await TestingChannel.SendMessageAsync(embed : new EmbedBuilder() .WithAuthor($"Start playtest of {PlaytestCommandInfo.Title}") .WithColor(new Color(55, 55, 165)) .WithDescription($"\nOn **{PlaytestCommandInfo.ServerAddress}**" + $"\nWith config of **{PlaytestCommandInfo.Mode}**" + $"\nWorkshop ID **{PlaytestCommandInfo.WorkshopId}**" + $"\nDemo Name **{PlaytestCommandInfo.DemoName}**").Build()); } _ = Task.Run(async() => { await Task.Delay(25000); var patreonUsers = _dataService.PatreonsRole.Members.ToArray(); GeneralUtil.Shuffle(patreonUsers); var thanks = ""; foreach (var patreonsRoleMember in patreonUsers) { thanks += $"{patreonsRoleMember.Username}, "; } await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"say Thanks to these supporters: {thanks.TrimEnd(',', ' ')}"); await Task.Delay(2000); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, @"Say Become a supporter at www.patreon.com/tophattwaffle"); }); }
public override async Task PlaytestTwentyMinuteTask(RconService rconService, SrcdsLogService srcdsLogService) { await base.PlaytestTwentyMinuteTask(rconService, srcdsLogService); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("TF2 class PlaytestTwentyMinuteTask", false, color: LOG_COLOR); } var wsId = GeneralUtil.GetWorkshopIdFromFqdn(WorkshopLink.ToString()); await rconService.RconCommand(ServerLocation, $"changelevel workshop/{wsId}"); }
public override async Task PlaytestCommandPost(bool replyInContext, SrcdsLogService srcdsLogService, RconService rconService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("TF2 class PlaytestCommandPost", false, color: LOG_COLOR); } await base.PlaytestCommandPost(replyInContext, srcdsLogService, rconService); await rconService.RconCommand(ServerLocation, $"changelevel workshop/{PlaytestCommandInfo.WorkshopId}"); await Task.Delay(15000); //Wait for map to change await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"sv_cheats 1; exec {_dataService.RSettings.General.PostgameConfig};sv_voiceenable 0"); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "mp_tournament 1"); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "mp_tournament_restart"); await DownloadHandler.DownloadPlaytestDemo(PlaytestCommandInfo); //TF2 Embed var embed = new EmbedBuilder() .WithAuthor($"Download playtest demo for {CleanedTitle}", _dataService.Guild.IconUrl, demoUrl) .WithThumbnailUrl(PlaytestCommandInfo.ThumbNailImage) .WithColor(new Color(243, 128, 72)) .WithDescription( $"[Download Demo Here]({demoUrl}) | [Map Images]({PlaytestCommandInfo.ImageAlbum}) | [Playtesting Information](https://www.tophattwaffle.com/playtesting/)"); await AnnouncmentChannel.SendMessageAsync(PlaytestCommandInfo.CreatorMentions, embed : embed.Build()); PlaytestCommandRunning = false; }
public override async Task PlaytestCommandStart(bool replyInContext, RconService rconService) { await base.PlaytestCommandStart(replyInContext, rconService); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("CSGO class PlaytestCommandStart", false, color: LOG_COLOR); } var config = IsCasual ? _dataService.RSettings.General.CSGOCasualConfig : _dataService.RSettings.General.CSGOCompConfig; await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "mp_teamname_1 Chicken; mp_teamname_2 Ido"); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"exec {config}"); await Task.Delay(3000); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"tv_record {PlaytestCommandInfo.DemoName}; say Recording {PlaytestCommandInfo.DemoName}"); _ = Task.Run(async() => { for (var i = 0; i < 4; i++) { _ = rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"script ScriptPrintMessageCenterAll(\"Playtest of {PlaytestCommandInfo.Title} is live! Be respectful and GLHF!\");", false); await Task.Delay(3000); } }); PlaytestCommandRunning = false; }
public virtual async Task PlaytestStartingTask(RconService rconService, SrcdsLogService srcdsLogService, AnnouncementMessage announcementMessage) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestStartingTask", false, color: LOG_COLOR); } _ = rconService.WakeRconServer(ServerLocation); var mentionRole = TesterRole; //Handle comp or casual if (IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {_dataService.RSettings.General.CasualPassword}"); } else { mentionRole = _dataService.CompetitiveTesterRole; } //Skip the alert. if (!_dataService.GetStartAlertStatus()) { _dataService.SetStartAlert(true); return; } var unsubInfo = Game.ToString(); if (!IsCasual) { unsubInfo = "comp"; } await TesterRole.ModifyAsync(x => { x.Mentionable = true; }); await TestingChannel.SendMessageAsync($"Heads up {mentionRole.Mention}! " + "There is a playtest starting __now__!" + $"\nType `>playtester {unsubInfo}` to stop getting {unsubInfo} playtest notifications.", embed : announcementMessage.CreatePlaytestEmbed(this, true, AnnouncementMessage.Id)); await TesterRole.ModifyAsync(x => { x.Mentionable = false; }); }
public async Task PlaytestCommandGenericAction(bool replyInContext, string command, RconService rconService, string message = null) { if (!replyInContext) { await _dataService.CSGOTestingChannel.SendMessageAsync(embed : new EmbedBuilder() .WithAuthor(message) .WithColor(new Color(55, 55, 165)) .Build()); } await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, command); //Reset the flag as we are done running PlaytestCommandRunning = false; }
public override async Task PlaytestStartingTask(RconService rconService, SrcdsLogService srcdsLogService, AnnouncementMessage announcementMessage) { await base.PlaytestStartingTask(rconService, srcdsLogService, announcementMessage); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("CSGO class PlaytestStartingTask", false, color: LOG_COLOR); } if (!IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {CompPassword}"); } }
public override async Task PlaytestStartingInTask(RconService rconService, SrcdsLogService srcdsLogService , AnnouncementMessage announcementMessage) { await base.PlaytestStartingInTask(rconService, srcdsLogService, announcementMessage); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("CSGO class PlaytestStartingInTask", false, color: LOG_COLOR); } var embed = new EmbedBuilder().WithAuthor(CleanedTitle) .AddField("Connect Information", $"`connect {ServerLocation}; password {CompPassword}`") .WithColor(new Color(55, 55, 165)); if (!IsCasual) { foreach (var creator in Creators) { try { var user = _dataService.GetSocketGuildUser(creator.Id); await user.AddRoleAsync(_dataService.ComptesterPlaytestCreator); } catch { } //Try to DM them connect information try { await creator.SendMessageAsync(embed : embed.Build()); } catch { } } await _dataService.CompetitiveTestingChannel.SendMessageAsync(embed : embed.Build()); await rconService.RconCommand(ServerLocation, $"sv_password {CompPassword}"); } }
public VoiceFeedbackSession(DataService dataService, DiscordSocketClient client, PlaytestEvent playtestEvent, RconService rconService) { _dataService = dataService; _client = client; _playtestEvent = playtestEvent; _rconService = rconService; _client.UserVoiceStateUpdated += UserVoiceStateUpdated; _duration = TimeSpan.FromMinutes(_dataService.RSettings.General.FeedbackDuration); //Mute everyone on start foreach (var user in _dataService.LevelTestVoiceChannel.Users) { _ = ProcessMute(true, user); } _ = _rconService.RconCommand(_playtestEvent.ServerLocation, "say Feedback Queue Started!;say Feedback Queue Started!;say Feedback Queue Started!"); _ = _client.SetStatusAsync(UserStatus.AFK); }
public virtual async Task PlaytestStartingInTask(RconService rconService, SrcdsLogService srcdsLogService, AnnouncementMessage announcementMessage) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestStartingInTask", false, color: LOG_COLOR); } //Ensure server is awake and RCON connection is established. Run other things while waking server _ = rconService.WakeRconServer(ServerLocation); //Start asking the server for player counts. _dataService.SetIncludePlayerCount(true); //Start asking for player counts JobManager.AddJob( async() => await rconService.GetPlayCountFromServer(ServerLocation), s => s.WithName("[QueryPlayerCount]").ToRunEvery(60).Seconds()); //Figure out how far away from start we are string countdownString = null; var countdown = StartDateTime.GetValueOrDefault().Subtract(DateTime.Now); if (StartDateTime.GetValueOrDefault().CompareTo(DateTime.Now) < 0) { countdownString = $"Started: {countdown:h\'H \'m\'M\'} ago!"; } else { countdownString = countdown.ToString("d'D 'h'H 'm'M'").TrimStart(' ', 'D', 'H', '0'); } await rconService.RconCommand(ServerLocation, "sv_cheats 0"); var mentionRole = TesterRole; //Handle comp or casual if (IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {_dataService.RSettings.General.CasualPassword}"); } else { mentionRole = _dataService.CompetitiveTesterRole; } //Skip the alert. if (!_dataService.GetStartAlertStatus()) { _dataService.SetStartAlert(true); return; } var unsubInfo = Game.ToString(); if (!IsCasual) { unsubInfo = "comp"; } await TesterRole.ModifyAsync(x => { x.Mentionable = true; }); await TestingChannel.SendMessageAsync($"Heads up {mentionRole.Mention}! " + $"There is a playtest starting in {countdownString}." + $"\nType `>playtester {unsubInfo}` to manage {unsubInfo} playtest notifications.", embed : announcementMessage.CreatePlaytestEmbed(this, true, AnnouncementMessage.Id)); await TesterRole.ModifyAsync(x => { x.Mentionable = false; }); //DM users about their test foreach (var creator in Creators) { try { await creator.SendMessageAsync( $"Don't forget that you have a playtest for __**{CleanedTitle}**__ in __**{countdownString}**__"); } catch { //Could not DM creator about their test. } } }
public virtual async Task PlaytestCommandPost(bool replyInContext, SrcdsLogService srcdsLogService, RconService rconService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestCommandPost", false, color: LOG_COLOR); } PlaytestCommandRunning = true; //Force the next alert to true _dataService.SetStartAlert(true); await _log.LogMessage("Running Playtest Post Tasks!", color : LOG_COLOR); //No context to send these messages to - default them if (!replyInContext) { await _dataService.CSGOTestingChannel.SendMessageAsync(embed : new EmbedBuilder() .WithAuthor($"Post playtest of {PlaytestCommandInfo.Title}") .WithColor(new Color(55, 55, 165)) .WithDescription($"\nOn **{PlaytestCommandInfo.ServerAddress}**" + $"\nWorkshop ID **{PlaytestCommandInfo.WorkshopId}**" + $"\nDemo Name **{PlaytestCommandInfo.DemoName}**").Build()); } var fbf = srcdsLogService.GetFeedbackFile(server); if (fbf != null && File.Exists(fbf.FileName)) { Directory.CreateDirectory( $"{_dataService.RSettings.ProgramSettings.PlaytestDemoPath}\\{PlaytestCommandInfo.StartDateTime:yyyy}" + $"\\{PlaytestCommandInfo.StartDateTime:MM} - {PlaytestCommandInfo.StartDateTime:MMMM}" + $"\\{PlaytestCommandInfo.DemoName}"); File.Copy(fbf.FileName, $"{_dataService.RSettings.ProgramSettings.PlaytestDemoPath}\\{PlaytestCommandInfo.StartDateTime:yyyy}" + $"\\{PlaytestCommandInfo.StartDateTime:MM} - {PlaytestCommandInfo.StartDateTime:MMMM}" + $"\\{PlaytestCommandInfo.DemoName}\\{PlaytestCommandInfo.DemoName}.txt" , true); await AnnouncmentChannel.SendFileAsync(fbf.FileName, ""); } _ = Task.Run(async() => { await Task.Delay(35000); var patreonUsers = _dataService.PatreonsRole.Members.ToArray(); GeneralUtil.Shuffle(patreonUsers); var thanks = ""; foreach (var patreonsRoleMember in patreonUsers) { thanks += $"{patreonsRoleMember.Username}, "; } await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"say Thanks to these supporters: {thanks.TrimEnd(',', ' ')}"); await Task.Delay(2000); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, @"Say Become a supporter at www.patreon.com/tophattwaffle"); }); //Stop getting more feedback srcdsLogService.RemoveFeedbackFile(server); }
public override async Task PlaytestCommandPost(bool replyInContext, SrcdsLogService srcdsLogService, RconService rconService) { await base.PlaytestCommandPost(replyInContext, srcdsLogService, rconService); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("CSGO class PlaytestCommandPost", false, color: LOG_COLOR); } //Fire and forget all of this. _ = Task.Run(async() => { await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"host_workshop_map {PlaytestCommandInfo.WorkshopId}"); await Task.Delay(15000); //Wait for map to change await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"sv_cheats 1; bot_stop 1;exec {_dataService.RSettings.General.PostgameConfig};sv_voiceenable 0"); if (!IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {CompPassword}"); } //Display ingame notification for in game voice and make it stick for a while. _ = Task.Run(async() => { for (var i = 0; i < 4; i++) { _ = rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "script ScriptPrintMessageCenterAll(\"Please join the level testing voice channel for feedback!\");", false); await Task.Delay(3000); } }); //Enable the no damage script, cause Thomas is a real one. _ = Task.Run(async() => { //Short delay to ensure that mp_restart game already happened. await Task.Delay(5000); _ = rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "say No damage activated!; script_execute nodamage"); }); var demoPath = await DownloadHandler.DownloadPlaytestDemo(PlaytestCommandInfo); FileInfo jasonFile = null; try { jasonFile = DemoParser.ParseDemo(Path.GetDirectoryName(demoPath)); } catch (Exception e) { Console.WriteLine("JIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\n" + e.Message); } _ = Task.Run(async() => { foreach (var creator in Creators) { try { var user = _dataService.GetSocketGuildUser(creator.Id); await user.RemoveRoleAsync(_dataService.ComptesterPlaytestCreator); } catch { } } }); var embed = new EmbedBuilder() .WithAuthor($"Download playtest demo for {CleanedTitle}", _dataService.Guild.IconUrl, demoUrl) .WithThumbnailUrl(PlaytestCommandInfo.ThumbNailImage) .WithColor(new Color(243, 128, 72)) .WithDescription( $"[Download Demo Here]({demoUrl}) | [Map Images]({PlaytestCommandInfo.ImageAlbum}) | [Playtesting Information](https://www.tophattwaffle.com/playtesting/)"); if (jasonFile != null) { embed.AddField("Analyzed Demo", $"[View Processed Demo Here!]({demoSiteUrlBase}{jasonFile.Name.Replace(jasonFile.Extension, "")})"); } await AnnouncmentChannel.SendMessageAsync(PlaytestCommandInfo.CreatorMentions, embed: embed.Build()); PlaytestCommandRunning = false; }); }
/// <summary> /// Processes the next user in the queue for feedback. /// </summary> /// <returns></returns> private async Task StartNextUserFeedback() { //No longer running, don't continue if (!_running) { return; } //If the list is empty, there are no users if (_userQueue.Count == 0) { PauseFeedback(); return; } var user = _dataService.GetSocketGuildUser(_userQueue[0]); //Make sure user is in voice channel if (_dataService.LevelTestVoiceChannel.Users.All(x => x.Id != user.Id)) { await RemoveUser(user.Id); return; } if (!await ProcessMute(false, user)) { //Failure to remove mute for some reason. Just remove from stack await RemoveUser(user.Id); return; } //Countdown before next user for (var i = 5; i > 0; i--) { _ = _rconService.RconCommand(_playtestEvent.ServerLocation, $"script ScriptPrintMessageCenterAll(\"{user.Username}'s turn starts in: {i}\\nStart with your in-game name.\");", false); await Task.Delay(1000); } //Alert users var msg = await _dataService.CSGOTestingChannel.SendMessageAsync( $"{user.Mention} may begin their voice feedback.\nType `>done` when you're finished."); _activeUser = user; _timeLeft = _duration; AddUserJobs(user); if (_userQueue.Count > 1) { _onDeckUser = _dataService.GetSocketGuildUser(_userQueue[1]); } if (!_timerRunning) { _abortTimer = false; _ = UpdateTimer(); } await Task.Delay(10000); await msg.DeleteAsync(); }