diff --git a/NadekoBot/Classes/Extensions.cs b/NadekoBot/Classes/Extensions.cs index 6f1cc715..9791d60c 100644 --- a/NadekoBot/Classes/Extensions.cs +++ b/NadekoBot/Classes/Extensions.cs @@ -6,8 +6,9 @@ using System.Security.Cryptography; using Discord.Commands; using Discord; using Discord.Legacy; +using NadekoBot.Modules; -namespace NadekoBot +namespace NadekoBot.Extensions { public static class Extensions { @@ -113,6 +114,16 @@ namespace NadekoBot } } + /// + /// Shortens a string URL + /// + /// + /// + /// + public static string ShortenUrl(this string str) { + return Searches.ShortenUrl(str); + } + public static void ForEach(this IEnumerable source, Action action) { foreach (T element in source) { action(element); diff --git a/NadekoBot/Classes/Trivia.cs b/NadekoBot/Classes/Trivia.cs index 21bc9815..e8bfb1a1 100644 --- a/NadekoBot/Classes/Trivia.cs +++ b/NadekoBot/Classes/Trivia.cs @@ -8,7 +8,7 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using System.Timers; -using Discord.Legacy; +using NadekoBot.Extensions; namespace NadekoBot { diff --git a/NadekoBot/Commands/CopyCommand.cs b/NadekoBot/Commands/CopyCommand.cs index bf32b881..fa3ff706 100644 --- a/NadekoBot/Commands/CopyCommand.cs +++ b/NadekoBot/Commands/CopyCommand.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Discord.Commands; using Discord.Legacy; +using NadekoBot.Extensions; namespace NadekoBot { diff --git a/NadekoBot/Commands/DiceRollCommand.cs b/NadekoBot/Commands/DiceRollCommand.cs index ed0725c9..054a3c6d 100644 --- a/NadekoBot/Commands/DiceRollCommand.cs +++ b/NadekoBot/Commands/DiceRollCommand.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Discord.Commands; using System.Drawing; using System.Drawing.Imaging; -using Discord.Legacy; +using NadekoBot.Extensions; namespace NadekoBot { diff --git a/NadekoBot/Commands/DrawCommand.cs b/NadekoBot/Commands/DrawCommand.cs index 3cd89bdf..e57939c0 100644 --- a/NadekoBot/Commands/DrawCommand.cs +++ b/NadekoBot/Commands/DrawCommand.cs @@ -5,6 +5,7 @@ using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; using Discord.Legacy; +using NadekoBot.Extensions; namespace NadekoBot { diff --git a/NadekoBot/Commands/HelpCommand.cs b/NadekoBot/Commands/HelpCommand.cs index 1f97946a..87e5490f 100644 --- a/NadekoBot/Commands/HelpCommand.cs +++ b/NadekoBot/Commands/HelpCommand.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; using Discord.Commands; -using Discord.Legacy; +using NadekoBot.Extensions; using System.IO; namespace NadekoBot diff --git a/NadekoBot/Modules/Administration.cs b/NadekoBot/Modules/Administration.cs index e9dbb0cf..10d21d99 100644 --- a/NadekoBot/Modules/Administration.cs +++ b/NadekoBot/Modules/Administration.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.Linq; using System.Timers; using Discord.Commands.Permissions.Visibility; +using NadekoBot.Extensions; namespace NadekoBot.Modules { diff --git a/NadekoBot/Modules/Conversations.cs b/NadekoBot/Modules/Conversations.cs index 738be4cf..e8f5aaa2 100644 --- a/NadekoBot/Modules/Conversations.cs +++ b/NadekoBot/Modules/Conversations.cs @@ -11,7 +11,7 @@ using System.Drawing; using System.IO; using System.Text; using System.Drawing.Imaging; -using Discord.Legacy; +using NadekoBot.Extensions; namespace NadekoBot.Modules { diff --git a/NadekoBot/Modules/Games.cs b/NadekoBot/Modules/Games.cs index fd90834d..987eec3e 100644 --- a/NadekoBot/Modules/Games.cs +++ b/NadekoBot/Modules/Games.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Discord.Modules; -using Discord.Legacy; +using NadekoBot.Extensions; namespace NadekoBot.Modules { diff --git a/NadekoBot/Modules/Music.cs b/NadekoBot/Modules/Music.cs index 7d38926a..aec33ba6 100644 --- a/NadekoBot/Modules/Music.cs +++ b/NadekoBot/Modules/Music.cs @@ -3,18 +3,16 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using Discord.Modules; using Discord.Commands; using System.IO; using Discord; using Discord.Audio; -using System.Collections.Concurrent; using YoutubeExtractor; using System.Threading; using System.Diagnostics; -using Discord.Legacy; +using NadekoBot.Extensions; using System.Net; using System.Globalization; @@ -196,7 +194,7 @@ namespace NadekoBot.Modules { .OrderByDescending(v => v.AudioBitrate).FirstOrDefault(); if (video == null) - throw new Exception("Could not load any video elements"); // First one + throw new Exception("Could not load any video elements"); StreamUrl = video.DownloadUrl; Title = video.Title; diff --git a/NadekoBot/Modules/Searches.cs b/NadekoBot/Modules/Searches.cs index 765006d1..35d84a11 100644 --- a/NadekoBot/Modules/Searches.cs +++ b/NadekoBot/Modules/Searches.cs @@ -1,19 +1,13 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Discord.Modules; using System.Net; using System.IO; using Newtonsoft.Json.Linq; using System.Text.RegularExpressions; -using System.Reflection; -using System.Xml; using Newtonsoft.Json; -using System.Net.Http; -using Discord.Legacy; using Discord.Commands; +using NadekoBot.Extensions; namespace NadekoBot.Modules { @@ -109,6 +103,13 @@ namespace NadekoBot.Modules await e.Send("This feature is being reconstructed."); }); + cgb.CreateCommand("lmgtfy") + .Description("Google something for an idiot.") + .Parameter("ffs", ParameterType.Unparsed) + .Do(async e => { + if (e.GetArg("ffs") == null || e.GetArg("ffs").Length < 1) return; + await e.Send($"http://lmgtfy.com/?q={ Uri.EscapeUriString(e.GetArg("ffs").ToString()) }".ShortenUrl()); + }); }); } diff --git a/NadekoBot/Modules/Trello.cs b/NadekoBot/Modules/Trello.cs index 7093a15c..56bf9ae1 100644 --- a/NadekoBot/Modules/Trello.cs +++ b/NadekoBot/Modules/Trello.cs @@ -1,12 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Discord.Modules; using Manatee.Trello.ManateeJson; using Manatee.Trello; using System.Timers; +using NadekoBot.Extensions; namespace NadekoBot.Modules { class Trello : DiscordModule { diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index 89b3cfd7..e44db95e 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -7,7 +7,7 @@ using Discord.Commands; using NadekoBot.Modules; using Discord.Modules; using Discord.Audio; -using System.Threading.Tasks; +using NadekoBot.Extensions; using System.Timers; using System.Linq; diff --git a/NadekoBot/StatsCollector.cs b/NadekoBot/StatsCollector.cs index 34c52202..6722ce91 100644 --- a/NadekoBot/StatsCollector.cs +++ b/NadekoBot/StatsCollector.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Timers; -using Discord.Legacy; +using NadekoBot.Extensions; namespace NadekoBot {