Google disabled old image API ; . ;

I disabled image searches until I find a proper replacement. (probably
imgur)
This commit is contained in:
Kwoth 2015-12-11 17:19:34 +01:00
parent e62849f999
commit 1847ddbbe2
2 changed files with 21 additions and 10 deletions

View File

@ -263,6 +263,8 @@ namespace NadekoBot.Modules
.Parameter("all", ParameterType.Unparsed)
.Do(async e =>
{
await e.Send("This feature is being reconstructed.");
/*
var httpClient = new System.Net.Http.HttpClient();
string str = e.Args[0];
@ -276,6 +278,7 @@ namespace NadekoBot.Modules
}
string s = Searches.ShortenUrl(obj.responseData.results[0].url.ToString());
await e.Send(s);
*/
});
cgb.CreateCommand("ir")
@ -284,19 +287,28 @@ namespace NadekoBot.Modules
.Parameter("all", ParameterType.Unparsed)
.Do(async e =>
{
await e.Send("This feature is being reconstructed.");
/*
var httpClient = new System.Net.Http.HttpClient();
string str = e.Args[0];
var r = httpClient.GetAsync("http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=" + Uri.EscapeDataString(str) + "&start=" + rng.Next(0, 30)).Result;
dynamic obj = JObject.Parse(r.Content.ReadAsStringAsync().Result);
if (obj.responseData.results.Count == 0)
JObject obj = JObject.Parse(r.Content.ReadAsStringAsync().Result);
try
{
Console.WriteLine(obj.ToString());
if (obj["responseData"]["results"].Count() == 0)
{
await e.Send("No results found for that keyword :\\");
return;
}
int rnd = rng.Next(0, obj.responseData.results.Count);
string s = Searches.ShortenUrl(obj.responseData.results[rnd].url.ToString());
int rnd = rng.Next(0, obj["responseData"]["results"].Count());
string s = Searches.ShortenUrl(obj["responseData"]["results"][rnd]["url"].ToString());
await e.Send(s);
}
catch (Exception ex) {
Console.WriteLine(ex.ToString());
}
*/
});
@ -362,7 +374,7 @@ namespace NadekoBot.Modules
string str = "Bye";
foreach (var u in e.Message.MentionedUsers)
{
str += " " + Mention.User(u);
str += " " + u.Mention;
}
await e.Send(str);
});

View File

@ -6,7 +6,6 @@ using Parse;
using Discord.Commands;
using NadekoBot.Modules;
using Discord.Modules;
using Newtonsoft.Json.Linq;
namespace NadekoBot
{