From 31c9e4d67b86d76aa5392defdcad0ea5266c852a Mon Sep 17 00:00:00 2001 From: Amrit Panesar Date: Thu, 15 Apr 2021 05:13:04 -0700 Subject: [PATCH] Add additional functionality for slap --- Commands.cs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Commands.cs b/Commands.cs index 571364b..7fb7bc7 100644 --- a/Commands.cs +++ b/Commands.cs @@ -15,6 +15,23 @@ namespace StarsiegeBot { private readonly Random rnd = new Random(); + private string[] insult = { + "> {0} slaps {1} around a bit with a large trout.", + "> {0} puts a jellyfish on {1}'s head.", + "> {0} slaps {1} around a bit with the mustache of Caanon.", + "> {0} slaps {1} around a bit with a questionable rubber object.", + "> {0} slaps {1} around a bit with a rubber chicken." + }; + private uint insultIndex; + public string Insult { + get { + if (insultIndex >= insult.Length) { + insultIndex = 0; + } + return insult[insultIndex++ % insult.Length]; + } + } + public Commands() { Console.WriteLine("Basic Commands Loaded"); @@ -97,13 +114,6 @@ namespace StarsiegeBot [Command("slap")] public async Task Slap(CommandContext ctx, DiscordMember user = null) { - string[] insults = { - "{0} slaps {1} around a bit with a large trout.", - "{0} puts a jellyfish on {1}'s head.", - "{0} slaps {1} around a bit with the mustache of Caanon.", - "{0} slaps {1} around a bit with a questionable rubber object.", - "{0} slaps {1} around a bit with a rubber chicken." - }; string user1; string user2; @@ -118,7 +128,7 @@ namespace StarsiegeBot user2 = user.Mention; } - await ctx.RespondAsync(string.Format(insults[rnd.Next(insults.Length)], user1, user2)); + await ctx.RespondAsync(string.Format(Insult, user1, user2)); } [Command("rpsls")]