From cf036c534f5c28777b8ec80153b52436cb7727a0 Mon Sep 17 00:00:00 2001 From: Chris Darnell Date: Sat, 1 May 2021 00:10:21 -0700 Subject: [PATCH] Reworked NotFacts.cs to match Snapple.cs. Small refactor on GameCommands.cs --- StarsiegeBot/GameCommands.cs | 82 ++++----------- StarsiegeBot/Raven/NotFacts.cs | 116 +++++++++++++++++++-- StarsiegeBot/Raven/SnappleFacts.cs | 13 +-- StarsiegeBot/Starsiege/QuickchatHandler.cs | 16 +-- 4 files changed, 143 insertions(+), 84 deletions(-) diff --git a/StarsiegeBot/GameCommands.cs b/StarsiegeBot/GameCommands.cs index dd53834..2424e8a 100644 --- a/StarsiegeBot/GameCommands.cs +++ b/StarsiegeBot/GameCommands.cs @@ -28,6 +28,7 @@ namespace StarsiegeBot Console.WriteLine("Basic Commands Loaded"); InsultCopy = InsultMaster.ToList(); } + [Command("8ball"), Aliases(new String[] { "ball", "8" })] [Description("The Magic 8-Ball is a fortune-telling or seeking advice")] public async Task Eightball(CommandContext ctx, [RemainingText, Description("Your question to the 8 ball")] String remainingText = "") @@ -36,12 +37,7 @@ namespace StarsiegeBot // Load all the traditional 8-Ball answers into an array. string[] results = new string[] { "It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.", "Reply hazy, try again", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.", "My reply is no.", "My sources say no", "Outlook not so good.", "Very doubtful." }; // give the end user the randomly choosen result. - DiscordEmbedBuilder embed = new DiscordEmbedBuilder - { - Description = results[Program.rnd.Next(0, results.Length)], - Color = Program.colours[Program.rnd.Next(0, Program.colours.Length)] - }; - await ctx.RespondAsync(embed); + await ctx.RespondAsync(StartEmbed(results[Program.rnd.Next(0, results.Length)])); } [Command("about")] [Description("Gives some basic info about the bot")] @@ -81,12 +77,7 @@ namespace StarsiegeBot // We're going to randomly select heads or tails and then give it to the user. await ctx.TriggerTypingAsync(); string[] choices = { "heads", "tails" }; - DiscordEmbedBuilder embed = new DiscordEmbedBuilder - { - Description = "The coin landed on... " + choices[Program.rnd.Next(0, choices.Length)], - Color = Program.colours[Program.rnd.Next(0, Program.colours.Length)] - }; - await ctx.RespondAsync(embed); + await ctx.RespondAsync(StartEmbed($"The coin landed on... {choices[Program.rnd.Next(0, choices.Length)]}")); } [Command("credits")] [Description("Shows all those that have helped with my bot(s) over the years!")] @@ -196,24 +187,14 @@ namespace StarsiegeBot int i = Math.Min(min, max); int a = Math.Max(min, max) + 1; // output the results - DiscordEmbedBuilder embed = new DiscordEmbedBuilder - { - Description = $"🎲 Your random number is: {Program.rnd.Next(i, a)}", - Color = Program.colours[Program.rnd.Next(0, Program.colours.Length)] - }; - await ctx.RespondAsync(embed); + await ctx.RespondAsync(StartEmbed($"🎲 Your random number is: {Program.rnd.Next(i, a)}")); } [Command("random")] public async Task Random(CommandContext ctx) { await ctx.TriggerTypingAsync(); // some one didn't read the HELP file on Random. Explain it to them. - DiscordEmbedBuilder embed = new DiscordEmbedBuilder - { - Description = $"Gives you a random number between