fixed .rj

This commit is contained in:
Master Kwoth 2017-06-15 02:34:59 +02:00
parent 182ade0ad7
commit 9ff0c929c2

View File

@ -1,4 +1,5 @@
using Discord.Commands; using AngleSharp;
using Discord.Commands;
using NadekoBot.Attributes; using NadekoBot.Attributes;
using NadekoBot.Extensions; using NadekoBot.Extensions;
using NadekoBot.Services; using NadekoBot.Services;
@ -37,8 +38,17 @@ namespace NadekoBot.Modules.Searches
{ {
using (var http = new HttpClient()) using (var http = new HttpClient())
{ {
var response = await http.GetStringAsync("http://tambal.azurewebsites.net/joke/random").ConfigureAwait(false); http.AddFakeHeaders();
await Context.Channel.SendConfirmAsync(JObject.Parse(response)["joke"].ToString() + " 😆").ConfigureAwait(false);
var config = Configuration.Default.WithDefaultLoader();
var document = await BrowsingContext.New(config).OpenAsync("http://www.goodbadjokes.com/random");
var html = document.QuerySelector(".post > .joke-content");
var part1 = html.QuerySelector("dt").TextContent;
var part2 = html.QuerySelector("dd").TextContent;
await Context.Channel.SendConfirmAsync("", part1 + "\n\n" + part2, footer: document.BaseUri).ConfigureAwait(false);
} }
} }