diff --git a/NadekoBot/Modules/Searches/Commands/WowJokes.cs b/NadekoBot/Modules/Searches/Commands/WowJokes.cs new file mode 100644 index 00000000..3fb8cb59 --- /dev/null +++ b/NadekoBot/Modules/Searches/Commands/WowJokes.cs @@ -0,0 +1,32 @@ +using NadekoBot.Classes; +using System; +using System.Collections.Generic; +using System.Linq; +using Discord.Commands; +using Newtonsoft.Json; + +namespace NadekoBot.Modules.Searches.Commands +{ + class WowJokes : DiscordCommand + { + public WowJokes(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"); + } + await e.Channel.SendMessage(Jokes[new Random().Next(0, Jokes.Count)].ToString()); + }); + } + } +}