using System; using System.Threading.Tasks; using Discord.Commands; using Geekbot.net.Lib; using Geekbot.net.Lib.ErrorHandling; namespace Geekbot.net.Commands.Randomness.Dad { public class DadJokes : ModuleBase { private readonly IErrorHandler _errorHandler; public DadJokes(IErrorHandler errorHandler) { _errorHandler = errorHandler; } [Command("dad", RunMode = RunMode.Async)] [Summary("A random dad joke")] public async Task Say() { try { var response = await HttpAbstractions.Get(new Uri("https://icanhazdadjoke.com/")); await ReplyAsync(response.Joke); } catch (Exception e) { await _errorHandler.HandleCommandException(e, Context); } } } }