diff --git a/NadekoBot/Modules/Searches/Commands/WowJokes.cs b/NadekoBot/Modules/Searches/Commands/WowJokes.cs index 3fb8cb59..da2f99ae 100644 --- a/NadekoBot/Modules/Searches/Commands/WowJokes.cs +++ b/NadekoBot/Modules/Searches/Commands/WowJokes.cs @@ -1,31 +1,35 @@ -using NadekoBot.Classes; +using Discord.Commands; +using NadekoBot.Classes; +using NadekoBot.Classes.JSONModels; +using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.IO; using System.Linq; -using Discord.Commands; -using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Commands { - class WowJokes : DiscordCommand + class WowJokeCommand : DiscordCommand { - public WowJokes(DiscordModule module) : base(module) + + List jokes = new List(); + + public WowJokeCommand(DiscordModule module) : base(module) { } internal override void Init(CommandGroupBuilder cgb) { - List Jokes = new List(); cgb.CreateCommand(Module.Prefix + "wowjoke") .Description("Get one of Kwoth's penultimate WoW jokes.") .Do(async e => { - if (!Jokes.Any()) - { - Jokes = JsonConvert.DeserializeObject>("data/wowjokes.json"); + if (!jokes.Any()) + { + jokes = JsonConvert.DeserializeObject>(File.ReadAllText("data/wowjokes.json")); } - await e.Channel.SendMessage(Jokes[new Random().Next(0, Jokes.Count)].ToString()); + await e.Channel.SendMessage(jokes[new Random().Next(0, jokes.Count)].ToString()); }); } } diff --git a/NadekoBot/Modules/Searches/SearchesModule.cs b/NadekoBot/Modules/Searches/SearchesModule.cs index 8b3ebacc..22c22955 100644 --- a/NadekoBot/Modules/Searches/SearchesModule.cs +++ b/NadekoBot/Modules/Searches/SearchesModule.cs @@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Searches commands.Add(new StreamNotifications(this)); commands.Add(new ConverterCommand(this)); commands.Add(new RedditCommand(this)); - commands.Add(new WowJokes(this)); + commands.Add(new WowJokeCommand(this)); rng = new Random(); } diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index e88ea618..f054a8c1 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -212,7 +212,7 @@ namespace NadekoBot return; } - await Task.Delay(2000).ConfigureAwait(false); + await Task.Delay(1000).ConfigureAwait(false); Console.WriteLine("-----------------"); Console.WriteLine(await NadekoStats.Instance.GetStats().ConfigureAwait(false)); Console.WriteLine("-----------------"); diff --git a/NadekoBot/_Models/JSONModels/_JSONModels.cs b/NadekoBot/_Models/JSONModels/_JSONModels.cs index eb6aa307..7b6c3dfa 100644 --- a/NadekoBot/_Models/JSONModels/_JSONModels.cs +++ b/NadekoBot/_Models/JSONModels/_JSONModels.cs @@ -99,15 +99,12 @@ namespace NadekoBot.Classes.JSONModels public bool Missing { get; set; } = false; public string FullUrl { get; set; } } - - public class WoWJoke + + public class WoWJoke { public string Question { get; set; } public string Answer { get; set; } - public override string ToString() - { - return $"**{Question}**\n\n{Answer}!"; - } + public override string ToString() => $"`{Question}`\n\n**{Answer}**"; } }