diff --git a/StarsiegeBot/BotSettings.cs b/StarsiegeBot/BotSettings.cs index 607cd4f..92e36eb 100644 --- a/StarsiegeBot/BotSettings.cs +++ b/StarsiegeBot/BotSettings.cs @@ -18,8 +18,6 @@ namespace StarsiegeBot class BotSettings : BaseCommandModule { public static Dictionary GuildSettings; - - public BotSettings() { Console.WriteLine("Bot Setting Commands Loaded"); diff --git a/StarsiegeBot/Commands.cs b/StarsiegeBot/Commands.cs index 40de816..264585c 100644 --- a/StarsiegeBot/Commands.cs +++ b/StarsiegeBot/Commands.cs @@ -12,9 +12,6 @@ namespace StarsiegeBot { class Commands : BaseCommandModule { - // this class depends a lot on the random stuff. so make it class level. - private readonly Random rnd = new Random(); - // Master insult list. private readonly string[] InsultMaster = { "{0} slaps {1} around a bit with a large trout.", @@ -41,8 +38,8 @@ namespace StarsiegeBot // give the end user the randomly choosen result. DiscordEmbedBuilder embed = new DiscordEmbedBuilder { - Description = results[rnd.Next(0, results.Length)], - Color = Program.colours[rnd.Next(0, Program.colours.Length)] + Description = results[Program.rnd.Next(0, results.Length)], + Color = Program.colours[Program.rnd.Next(0, Program.colours.Length)] }; await ctx.RespondAsync(embed); } @@ -65,7 +62,7 @@ namespace StarsiegeBot embed.AddField("Ping", ctx.Client.Ping.ToString(), true); embed.AddField("Shard Count", ctx.Client.ShardCount.ToString(), true); embed.AddField("Shard", ctx.Client.ShardId.ToString(), true); - embed.Color = Program.colours[rnd.Next(0, Program.colours.Length)]; + embed.Color = Program.colours[Program.rnd.Next(0, Program.colours.Length)]; // list all the owners of the bot. string owners = ""; foreach (DiscordUser owner in ctx.Client.CurrentApplication.Owners) @@ -86,8 +83,8 @@ namespace StarsiegeBot string[] choices = { "heads", "tails" }; DiscordEmbedBuilder embed = new DiscordEmbedBuilder { - Description = "The coin landed on... " + choices[rnd.Next(0, choices.Length)], - Color = Program.colours[rnd.Next(0, Program.colours.Length)] + 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); } @@ -153,7 +150,7 @@ namespace StarsiegeBot // this is the result. // This line looks weird, I know, so here is what is going on. If the number of sides is negative, we adjust for that. // since the rnd.Next is inclusive, exclusive, we have to adjust for that. - int roll = rnd.Next(Math.Min(1, sides), Math.Max(sides + 1, 0)); + int roll = Program.rnd.Next(Math.Min(1, sides), Math.Max(sides + 1, 0)); // do we have our first result? No, make it! Store the results in a string to show the end user. if (dieResults.Equals(String.Empty)) dieResults = roll.ToString(); @@ -177,6 +174,18 @@ namespace StarsiegeBot else await ctx.RespondAsync(overallResults); } + [Command("guilds"),Hidden,RequireOwner] + public async Task GimmeServerNames (CommandContext ctx) + { + string output = ""; + foreach (KeyValuePair item in ctx.Client.Guilds) + { + output += item.Value.Name + "\r\n"; + } + await ctx.RespondAsync(output); + } + + [Command("random")] [Description("Random number generator.")] public async Task Random(CommandContext ctx, [Description("Lowest number choice. (Inclusive)")] int min, [Description("Highest Number Choice. (Inclusive)")] int max) @@ -189,8 +198,8 @@ namespace StarsiegeBot // output the results DiscordEmbedBuilder embed = new DiscordEmbedBuilder { - Description = $"🎲 Your random number is: {rnd.Next(i, a)}", - Color = Program.colours[rnd.Next(0, Program.colours.Length)] + Description = $"🎲 Your random number is: {Program.rnd.Next(i, a)}", + Color = Program.colours[Program.rnd.Next(0, Program.colours.Length)] }; await ctx.RespondAsync(embed); } @@ -202,7 +211,7 @@ namespace StarsiegeBot DiscordEmbedBuilder embed = new DiscordEmbedBuilder { Description = $"Gives you a random number between