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 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); }
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); }