From 4659f793f55b689ad5df83987007a7827eccd9e5 Mon Sep 17 00:00:00 2001 From: runebaas Date: Wed, 22 Jul 2020 14:32:47 +0200 Subject: [PATCH] Add !lmgtfy --- Geekbot.net/Commands/Utils/Lmgtfy.cs | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Geekbot.net/Commands/Utils/Lmgtfy.cs diff --git a/Geekbot.net/Commands/Utils/Lmgtfy.cs b/Geekbot.net/Commands/Utils/Lmgtfy.cs new file mode 100644 index 0000000..9976dad --- /dev/null +++ b/Geekbot.net/Commands/Utils/Lmgtfy.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading.Tasks; +using System.Web; +using Discord.Commands; +using Geekbot.net.Lib.ErrorHandling; + +namespace Geekbot.net.Commands.Utils +{ + public class Lmgtfy : ModuleBase + { + private readonly IErrorHandler _errorHandler; + + public Lmgtfy(IErrorHandler errorHandler) + { + _errorHandler = errorHandler; + } + + [Command("lmgtfy", RunMode = RunMode.Async)] + [Summary("Get a 'Let me google that for you' link")] + public async Task GetUrl([Remainder] [Summary("question")] string question) + { + try + { + var encoded = HttpUtility.UrlEncode(question).Replace("%20", "+"); + await Context.Channel.SendMessageAsync($""); + } + catch (Exception e) + { + await _errorHandler.HandleCommandException(e, Context); + } + } + } +} \ No newline at end of file