diff --git a/NadekoBot/Classes/Extensions.cs b/NadekoBot/Classes/Extensions.cs index c3062c5f..f82087bd 100644 --- a/NadekoBot/Classes/Extensions.cs +++ b/NadekoBot/Classes/Extensions.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; +using System.Net; using System.Security.Cryptography; using System.Threading.Tasks; @@ -166,7 +167,18 @@ namespace NadekoBot.Extensions /// /// /// - public static async Task ShortenUrl(this string str) => await SearchHelper.ShortenUrl(str).ConfigureAwait(false); + public static async Task ShortenUrl(this string str) + { + try + { + var result = await SearchHelper.ShortenUrl(str).ConfigureAwait(false); + return result; + } + catch (WebException) + { + throw new InvalidOperationException("You must enable URL shortner in google developers console."); + } + } /// /// Gets the program runtime