public static void Construct(SocketCommandContext context, KnockOutHandler knockoutData) { var userId = knockoutData.KnockoutCreatorUlong; Title = knockoutData.KnockoutTitle; AllLivingContenders = knockoutData.AllLivingContendersByScoreOrderList(); AllFallenContenders = knockoutData.AllFallenContendersByScoreOrderListWithEpitaph(); Username = context.Client.GetUser(userId).Username; UserAvatar = context.Client.GetUser(userId).GetAvatarUrl(); PlayersReadyString = ""; foreach (var playerId in knockoutData.AllPlayerIds) { // The AlwaysDownloadUsers setting should make this check redundant, but keeping it for safety if (context.Guild.GetUser(playerId) == null) { continue; } var username = context.Guild.GetUser(playerId).Username; if (knockoutData.PlayerWentLastTime(playerId) || knockoutData.TurnsLeftForPlayer(playerId) == 0) { PlayersReadyString += $"~~{username}~~, "; } else { PlayersReadyString += $"{context.Guild.GetUser(playerId).Username}, "; } } }
public async Task NewDayAsync() { if (!StateChecker.IsKnockoutChannel(Context) || StateChecker.IsPrivateMessage(Context)) { return; } if (!(StateChecker.IsChannelOp(Context))) { await Context.Channel.SendMessageAsync(":x: You are not a bot moderator!"); return; } if (Context.IsPrivate) { await Context.Channel.SendMessageAsync("Please use this command in the knockout channel!"); return; } var knockouts = new KnockOutHandler(Context.Channel.Id, Factory.GetDatabase()); knockouts.NewDay(); await Context.Channel.SendMessageAsync("It is a glorious new day. Everyone's turns are reset!"); return; }
public async Task AbortKnockoutAsync() { if (!StateChecker.IsPrivateMessage(Context)) { return; } var channelId = KnockOutHandler.ChannelForUser(Context.User.Id, Factory.GetDatabase()); if (channelId == 0) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } var knockouts = new KnockOutHandler(channelId, Factory.GetDatabase()); if (knockouts.KnockoutCreatorUlong != Context.User.Id) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; case 2: await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; case 3: await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; case 4: break; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } var chnl = Context.Client.GetChannel(knockouts.KnockoutChannelUlong) as Discord.IMessageChannel; knockouts.EmptyDatabase(); await Context.Channel.SendMessageAsync("Database cleared!"); await chnl.SendMessageAsync("Knockout Creation Aborted By Creator. You are free to create a new knockout."); }
public void TurnsLeftForPlayerTestWithNoPlayers() { TestDb = DataBaseMock(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); var turnsLeftForPlayer = knockoutTest.TurnsLeftForPlayer(999); Assert.AreEqual(3, turnsLeftForPlayer); }
public void PlayerWentLastTimeTestWithNoPlayers() { TestDb = DataBaseMock(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); var wentLastTime = knockoutTest.PlayerWentLastTime(999); Assert.AreEqual(false, wentLastTime); }
public async Task EpitaphAsync([Remainder] string input = "") { if (!StateChecker.IsKnockoutChannel(Context) || StateChecker.IsPrivateMessage(Context)) { return; } if (input == "") { await Context.Channel.SendMessageAsync(":x: Please enter a valid epitaph."); return; } if (input.Count() > 199) { await Context.Channel.SendMessageAsync(":x: Epitaph too long!"); } var knockouts = new KnockOutHandler(Context.Channel.Id, Factory.GetDatabase()); switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: No Knockout ongoing. Feel free to start a new one!"); return; case 2: break; case 3: await Context.Channel.SendMessageAsync(":x: This knockout is finished."); return; case 4: await Context.Channel.SendMessageAsync(":x: This knockout is still under construction! Patience!"); return; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } if (!knockouts.CanWriteAnEpitaph(Context.User.Id)) { await Context.Channel.SendMessageAsync(":x: You are not eligible to write an epitaph for a contender."); return; } knockouts.WriteEpitaphFromUser(Context.User.Id, input); await Context.Channel.SendMessageAsync(":skull: Engraved!"); }
public void EndKnockoutTest() { TestDb = DataBaseMock(); TestDb.Setup(m => m.SetKnockoutToEnded("1234")).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); knockoutTest.EndKnockout(); Assert.DoesNotThrow(() => TestDb.Verify()); }
public async Task HalveAsync() { if (!ChannelCheck.IsKnockoutChannel(Context)) { return; } if (Context.IsPrivate) { await Context.Channel.SendMessageAsync("Please use this command in the knockout channel!"); return; } var knockouts = new KnockOutHandler(Context.Channel.Id, Factory.GetDatabase()); if (Context.User.Id != knockouts.KnockoutCreatorUlong) { await Context.Channel.SendMessageAsync(":x: You are no the creator of this knockout!"); } switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: No Active Knockout In Progress"); return; case 2: break; case 3: await Context.Channel.SendMessageAsync(":x: No Active Knockout In Progress"); return; case 4: await Context.Channel.SendMessageAsync(":x: No Active Knockout In Progress"); return; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } await Context.Channel.SendMessageAsync("https://i.imgur.com/5NFHKiJ.gif"); await Context.Channel.SendMessageAsync("**When I'm done, half of the votes will still exist. Perfectly balanced, as all things should be.**"); knockouts.HalveScores(); await BotEmbeds.ShowKnockout(Context, knockouts); }
public void ChangeKnockoutTitleTest() { TestDb = DataBaseMock(); TestDb.Setup(m => m.AddKnockoutTitle("Test", "1234")).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); knockoutTest.ChangeKnockoutTitle("Test"); Assert.DoesNotThrow(() => TestDb.Verify()); }
public void EmptyDatabaseTest() { TestDb = DataBaseMock(); TestDb.Setup(m => m.ResetAllTables("1234")).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); knockoutTest.EmptyDatabase(); Assert.DoesNotThrow(() => TestDb.Verify()); }
public void CreateNewKnockoutTest() { TestDb = DataBaseMock(); TestDb.Setup(m => m.EmptyKnockoutDatabase("1234")).Verifiable(); TestDb.Setup(m => m.CreateNewKnockout("999", "1234")).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); knockoutTest.CreateNewKnockout(999); Assert.DoesNotThrow(() => TestDb.Verify()); }
public void ApplyScoreChangesForVotingRoundTest() { TestDb = DataBaseMock(); TestDb.Setup(m => m.ChangeScore("ToAdd", 1, "1234")).Verifiable(); TestDb.Setup(m => m.ChangeScore("ToSub", -1, "1234")).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); knockoutTest.ApplyScoreChangesForVotingRound("ToAdd", "ToSub"); Assert.DoesNotThrow(() => TestDb.Verify()); }
public async Task PreviewKnockoutAsync() { if (!StateChecker.IsPrivateMessage(Context)) { return; } var channelId = KnockOutHandler.ChannelForUser(Context.User.Id, Factory.GetDatabase()); if (channelId == 0) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } var knockouts = new KnockOutHandler(channelId, Factory.GetDatabase()); if (knockouts.KnockoutCreatorUlong != Context.User.Id) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: No Knockout is being created at the moment!"); return; case 2: await Context.Channel.SendMessageAsync(":x: This knockout has already started! Preview in main channel."); return; case 3: await Context.Channel.SendMessageAsync(":x: This knockout is finished, see the results in the main channel."); return; case 4: break; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } await BotEmbeds.ShowKnockout(Context, knockouts); }
private static async Task OnTimedEvent(object source, System.Timers.ElapsedEventArgs e, DiscordSocketClient _client) { Console.WriteLine("Starting!"); Console.WriteLine("In!"); var channelsToNotify = KnockOutHandler.NewDayForAll(Factory.GetDatabase()); foreach (var c in channelsToNotify) { var discordChannel = (ISocketMessageChannel)_client.GetChannel(c); await discordChannel.SendMessageAsync("It is a glorious new hour. Everyone's turns are reset!"); } await Task.Delay(-1); }
public async Task AddKnockoutAsync() { if (!StateChecker.IsKnockoutChannel(Context) || StateChecker.IsPrivateMessage(Context)) { return; } var knockouts = new KnockOutHandler(Context.Channel.Id, Factory.GetDatabase()); switch (knockouts.KnockoutStatus) { case 1: break; case 2: await Context.Channel.SendMessageAsync(":x: A knockout is already in progress!"); return; case 3: break; case 4: await Context.Channel.SendMessageAsync(":x: A knockout is already being built by someone, sorry!"); return; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); break; } await Discord.UserExtensions.SendMessageAsync(Context.User, "Commands to create your own Knockout (all commands in this window please):\n\n" + "**!name** _The Name Of Your Knockout_\n" + "**!add** _The Name of Your Knockout Contender to add (no slashes please! I'm afraid Face/Off is not allowed for now!)_\n" + "**!remove** _The Name of a Knockout Contender to delete (case sensitive)_\n" + "**!preview** _Preview your Knockout_\n" + "**!begin** _Start your Knockout, NO CHANGES CAN BE MADE BEYOND THIS POINT_\n" + "**!quit** _Abandon and Delete your Knockout_\n" ); knockouts.CreateNewKnockout(Context.User.Id); await BotEmbeds.DraftBeingCreated(Context, knockouts); return; }
public void PlayerHasJustKilledTestWithNoEpitaph() { var contenderList = new List <Contender> { new Contender { Epitaph = "", Killer = "", Name = "TestC1", Score = 0 } }; TestDb = DataBaseMock(contenderList); TestDb.Setup(m => m.SetEpitaphForContender("TestC1", "inscription pending", "1234")).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); var killTest = knockoutTest.PlayerHasJustKilled(); Assert.Throws <MockException>(() => TestDb.Verify()); Assert.AreEqual(0, killTest); }
public void PlayerWentLastTimeTestWithPlayerWhoHasNot() { var playerList = new List <KPlayer> { new KPlayer { LastPlayed = 1, PlayerId = "999", TurnsLeft = 2 }, new KPlayer { LastPlayed = 0, PlayerId = "998", TurnsLeft = 1 } }; TestDb = DataBaseMock(playerList: playerList); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); var wentLastTime = knockoutTest.PlayerWentLastTime(998); Assert.AreEqual(false, wentLastTime); }
public void TurnsLeftForPlayerTestWithMultiplePlayers() { var playerList = new List <KPlayer> { new KPlayer { LastPlayed = 0, PlayerId = "999", TurnsLeft = 2 }, new KPlayer { LastPlayed = 0, PlayerId = "998", TurnsLeft = 1 } }; TestDb = DataBaseMock(playerList: playerList); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); var turnsLeftForPlayer = knockoutTest.TurnsLeftForPlayer(999); Assert.AreEqual(2, turnsLeftForPlayer); }
public void CanWriteAnEpitaphTestWithKillerAndPendingEpitaph() { var contenderList = new List <Contender> { new Contender { Epitaph = "inscription pending", Killer = "999", Name = "TestC1", Score = 0 }, new Contender { Epitaph = "inscription done", Killer = "998", Name = "TestC2", Score = 0 } }; TestDb = DataBaseMock(contenderList); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); var canWriteAnEpitaph = knockoutTest.CanWriteAnEpitaph(999); Assert.IsTrue(canWriteAnEpitaph); }
public async Task EmbedKnockoutAsync() { if (!StateChecker.IsKnockoutChannel(Context) || StateChecker.IsPrivateMessage(Context)) { return; } var knockouts = new KnockOutHandler(Context.Channel.Id, Factory.GetDatabase()); switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: No Knockout has been created or is being created. Go for it! Type !createknockout to begin."); return; case 2: await BotEmbeds.ShowKnockout(Context, knockouts); return; case 3: await BotEmbeds.KnockoutIsOver(Context, knockouts); break; case 4: var userId = knockouts.KnockoutCreatorUlong; var username = Context.Client.GetUser(userId).Username; await Context.Channel.SendMessageAsync($"This Knockout is currently under construction by **{username}**! Feel free to advise!"); await BotEmbeds.ShowKnockout(Context, knockouts); return; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } }
public void DeleteContenderTestWithFind() { var contenderList = new List <Contender> { new Contender { Epitaph = "", Killer = "999", Name = "TestC1", Score = 0 }, new Contender { Epitaph = "", Killer = "998", Name = "TestC2", Score = 0 } }; TestDb = DataBaseMock(contenderList); TestDb.Setup(m => m.RemoveContender("TestC2", "1234")).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); var contenderDeleted = knockoutTest.DeleteContender("TestC2"); Assert.DoesNotThrow(() => TestDb.Verify()); Assert.IsTrue(contenderDeleted); }
public void DeleteContenderTestWithNoFind() { var contenderList = new List <Contender> { new Contender { Epitaph = "", Killer = "999", Name = "TestC1", Score = 0 }, new Contender { Epitaph = "", Killer = "998", Name = "TestC2", Score = 0 } }; TestDb = DataBaseMock(contenderList); TestDb.Setup(m => m.RemoveContender(It.IsAny <string>(), It.IsAny <string>())).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); var contenderDeleted = knockoutTest.DeleteContender("TestC3"); Assert.Throws <MockException>(() => TestDb.Verify()); Assert.IsFalse(contenderDeleted); }
public void WriteEpitaphFromUserTest() { var contenderList = new List <Contender> { new Contender { Epitaph = "inscription pending", Killer = "999", Name = "TestC1", Score = 0 }, new Contender { Epitaph = "inscription done", Killer = "998", Name = "TestC2", Score = 0 } }; TestDb = DataBaseMock(contenderList); TestDb.Setup(m => m.SetEpitaphForContender("TestC1", "TestEpitaph", "1234")).Verifiable(); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); knockoutTest.WriteEpitaphFromUser(999, "TestEpitaph"); Assert.DoesNotThrow(() => TestDb.Verify()); }
public async Task RebuildDatabasesAsync() { if (!StateChecker.IsKnockoutChannel(Context) || StateChecker.IsPrivateMessage(Context)) { return; } if (!StateChecker.IsChannelOp(Context)) { await Context.Channel.SendMessageAsync(":x: You are not a channel op!"); return; } await Context.Channel.SendMessageAsync("!!! All databases are being rebuilt and purged !!!"); var knockouts = new KnockOutHandler(Context.Channel.Id, Factory.GetDatabase()); knockouts.RebuildDataBase(); await Context.Channel.SendMessageAsync("!!! Done !!!"); }
public void ApplyPlayerTurnChangesForVotingRoundTestWithPlayer() { var playerList = new List <KPlayer> { new KPlayer { LastPlayed = 0, PlayerId = "999", TurnsLeft = 2 }, new KPlayer { LastPlayed = 0, PlayerId = "998", TurnsLeft = 1 } }; TestDb = DataBaseMock(playerList: playerList); var knockoutTest = new KnockOutHandler(1234, TestDb.Object); knockoutTest.ApplyPlayerTurnChangesForVotingRound("998"); TestDb.Verify(m => m.AddPlayerToKnockout(It.IsAny <string>(), It.IsAny <string>()), Times.Never()); TestDb.Verify(m => m.ResetAllPlayersLastPlayedStatus("1234")); TestDb.Verify(m => m.RegisterPlayersTurn("998", "1234")); }
public static async Task KnockoutIsOver(SocketCommandContext context, IMessageChannel channel, KnockOutHandler knockoutData) { DataKnockoutIsOver.Construct(context, knockoutData); var draftKnockoutIsOverEmbed = EmbedBuilder_KnockoutIsOver(); await channel.SendMessageAsync("", false, draftKnockoutIsOverEmbed); }
public async Task RemoveContenderAsync([Remainder] string input = "") { if (!StateChecker.IsPrivateMessage(Context)) { return; } if (input == "") { await Context.Channel.SendMessageAsync(":x: No Value Entered!"); return; } var channelId = KnockOutHandler.ChannelForUser(Context.User.Id, Factory.GetDatabase()); if (channelId == 0) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } var knockouts = new KnockOutHandler(channelId, Factory.GetDatabase()); if (knockouts.KnockoutCreatorUlong != Context.User.Id) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: No Knockout is being created at the moment!"); return; case 2: await Context.Channel.SendMessageAsync(":x: This knockout has already started! No more changes!"); return; case 3: await Context.Channel.SendMessageAsync(":x: This knockout is finished, please feel free to create a new one!"); return; case 4: break; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } if (!knockouts.DeleteContender(input)) { await Context.Channel.SendMessageAsync($":x: No Exact Match Found for **{input}**. Please Try Again"); return; } await Context.Channel.SendMessageAsync($"You have removed the contender **{input}**"); }
public async Task AddKnockoutAsync([Remainder] string input = "") { if (!StateChecker.IsPrivateMessage(Context)) { return; } if (input == "") { await Context.Channel.SendMessageAsync(":x: No Value Entered!"); return; } if (input.Contains("/")) { await Context.Channel.SendMessageAsync(":x: I told you that you couldn't choose Face/Off! (or whatever other film you've found with a / in it. V/H/S maybe...)"); return; } var channelId = KnockOutHandler.ChannelForUser(Context.User.Id, Factory.GetDatabase()); if (channelId == 0) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } var knockouts = new KnockOutHandler(channelId, Factory.GetDatabase()); if (knockouts.KnockoutCreatorUlong != Context.User.Id) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: No Knockout is being created at the moment!"); return; case 2: await Context.Channel.SendMessageAsync(":x: This knockout has already started! No more changes!"); return; case 3: await Context.Channel.SendMessageAsync(":x: This knockout is finished, please feel free to create a new one!"); return; case 4: break; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } knockouts.AddNewContender(input); await Context.Channel.SendMessageAsync($"You have added the contender **{input}**"); }
public async Task BeginKnockoutAsync() { if (!StateChecker.IsPrivateMessage(Context)) { return; } var channelId = KnockOutHandler.ChannelForUser(Context.User.Id, Factory.GetDatabase()); if (channelId == 0) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } var knockouts = new KnockOutHandler(channelId, Factory.GetDatabase()); if (knockouts.KnockoutCreatorUlong != Context.User.Id) { await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!"); return; } switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: No Knockout is being created at the moment!"); return; case 2: await Context.Channel.SendMessageAsync(":x: This knockout has already started! No more changes!"); return; case 3: await Context.Channel.SendMessageAsync(":x: This knockout is finished, please feel free to create a new one!"); return; case 4: break; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } if (knockouts.ContendersCount < 4) { await Context.Channel.SendMessageAsync(":x: Knockouts are over when it reaches the Top 3. Please add more Contenders."); return; } if (knockouts.KnockoutTitle == "" || knockouts.KnockoutTitle == "No Knockout In Progress" || knockouts.KnockoutTitle == "Knockout Under Construction") { await Context.Channel.SendMessageAsync(":x: Please Name your Knockout"); return; } knockouts.SetKnockoutToActive(); await Context.Channel.SendMessageAsync("You're done! Please check in main channel for the knockout!"); var chnl = Context.Client.GetChannel(knockouts.KnockoutChannelUlong) as Discord.IMessageChannel; await chnl.SendMessageAsync("A New Knockout Has Been Created!"); await BotEmbeds.ShowKnockout(Context, chnl, knockouts); }
public async Task PlayAsync([Remainder] string input = "") { if (!StateChecker.IsKnockoutChannel(Context) || StateChecker.IsPrivateMessage(Context)) { return; } if (input == "") { await Context.Channel.SendMessageAsync(":x: Please enter your options in this format: *!vote choice to add/choice to delete*"); return; } if (!input.Contains("/") || input.Count(c => c == '/') > 1) { await Context.Channel.SendMessageAsync(":x: Please enter your options in this format: *!vote choice to add/choice to delete*"); return; } var choices = input.Split('/'); var choiceToAdd = choices.First(); var choiceToSub = choices.Last(); var knockouts = new KnockOutHandler(Context.Channel.Id, Factory.GetDatabase()); switch (knockouts.KnockoutStatus) { case 1: await Context.Channel.SendMessageAsync(":x: No Knockout ongoing. Feel free to start a new one!"); return; case 2: break; case 3: await Context.Channel.SendMessageAsync(":x: This knockout is finished. Feel free to start a new one!"); return; case 4: await Context.Channel.SendMessageAsync(":x: This knockout is still under construction! Patience!"); return; default: await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint."); return; } if (knockouts.PlayerWentLastTime(Context.User.Id)) { await Context.Channel.SendMessageAsync(":x: You just went! Give a few other people a chance!"); return; } if (knockouts.TurnsLeftForPlayer(Context.User.Id) <= 0) { await Context.Channel.SendMessageAsync(":x: You are out of turns, please wait until the turns are reset"); return; } var original = choiceToAdd; choiceToAdd = knockouts.FindNearestMatch(choiceToAdd); if (choiceToAdd == "ERROR") { await Context.Channel.SendMessageAsync($":x: I'm sorry, I could not find a close match for **{original}**, please try again"); return; } original = choiceToSub; choiceToSub = knockouts.FindNearestMatch(choiceToSub); if (choiceToSub == "ERROR") { await Context.Channel.SendMessageAsync($":x: I'm sorry, I could not find a close match for **{original}**, please try again"); return; } if (choiceToAdd == choiceToSub) { await Context.Channel.SendMessageAsync(":x: Choices are the same, try again."); return; } knockouts.ApplyVoteChanges(choiceToAdd, choiceToSub, Context.User.Id); if (knockouts.LivingContendersCount <= 3) { knockouts.EndKnockout(); await BotEmbeds.KnockoutIsOver(Context, knockouts); } else { var userName = Context.User.Username; var avatarUrl = Context.User.GetAvatarUrl(); await Context.Channel.SendMessageAsync("", false, BotEmbeds.PlayerVotingReportEmbed(userName, avatarUrl, choiceToAdd, choiceToSub)); var recentKiller = knockouts.PlayerHasJustKilled(); if (recentKiller != 0) { var killer = Context.Client.GetUser(recentKiller); if (killer != null) { await killer.SendMessageAsync("You have killed a contender, type !epitaph _<message>_ in the main channel to leave a mark on their grave!"); await killer.SendMessageAsync("(please note, if you eliminate another contender, you will lose the opportunity to engrave an epitaph for this one)"); } knockouts.GetContendersFromDb(); } await BotEmbeds.ShowKnockout(Context, knockouts); } }