From 44ce541abc5d05d9562cc22f0b88cab05184aa47 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 19 Jul 2016 13:37:20 +0200 Subject: [PATCH] added ~google to get google search link #402 --- NadekoBot/Modules/Searches/SearchesModule.cs | 13 +++++++++++++ NadekoBot/_Models/JSONModels/_JSONModels.cs | 2 +- NadekoBot/bin/Debug/credentials_example.json | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NadekoBot/Modules/Searches/SearchesModule.cs b/NadekoBot/Modules/Searches/SearchesModule.cs index 466ff12c..e9a30cc8 100644 --- a/NadekoBot/Modules/Searches/SearchesModule.cs +++ b/NadekoBot/Modules/Searches/SearchesModule.cs @@ -15,6 +15,7 @@ using System.Drawing; using System.IO; using System.Linq; using System.Net.Http; +using System.Web; namespace NadekoBot.Modules.Searches { @@ -219,6 +220,18 @@ $@"🌍 **Weather for** 【{obj["target"]}】 .ConfigureAwait(false); }); + cgb.CreateCommand(Prefix + "google") + .Description("Get a google search link for some terms.") + .Parameter("terms", ParameterType.Unparsed) + .Do(async e => + { + var terms = e.GetArg("terms")?.Trim().Replace(' ', '+'); + if (string.IsNullOrWhiteSpace(terms)) + return; + await e.Channel.SendMessage($"https://google.com/search?q={ HttpUtility.UrlEncode(terms) }") + .ConfigureAwait(false); + }); + cgb.CreateCommand(Prefix + "hs") .Description("Searches for a Hearthstone card and shows its image. Takes a while to complete. |~hs Ysera") .Parameter("name", ParameterType.Unparsed) diff --git a/NadekoBot/_Models/JSONModels/_JSONModels.cs b/NadekoBot/_Models/JSONModels/_JSONModels.cs index ae7241bd..c60d32d8 100644 --- a/NadekoBot/_Models/JSONModels/_JSONModels.cs +++ b/NadekoBot/_Models/JSONModels/_JSONModels.cs @@ -7,7 +7,7 @@ namespace NadekoBot.Classes.JSONModels public class Credentials { public string Token { get; set; } = ""; - public string ClientId { get; set; } = "116275390695079945"; + public string ClientId { get; set; } = "170254782546575360"; public ulong BotId { get; set; } = 1231231231231; public ulong[] OwnerIds { get; set; } = { 123123123123, 5675675679845 }; public string GoogleAPIKey { get; set; } = ""; diff --git a/NadekoBot/bin/Debug/credentials_example.json b/NadekoBot/bin/Debug/credentials_example.json index 245b1141..e5c9f2dd 100644 --- a/NadekoBot/bin/Debug/credentials_example.json +++ b/NadekoBot/bin/Debug/credentials_example.json @@ -1,6 +1,6 @@ { "Token": "", - "ClientId": "116275390695079945", + "ClientId": "170254782546575360", "BotId": 1231231231231, "OwnerIds": [ 123123123123,