public async Task Shorten(CommandContext ctx, [RemainingText] string query) { if (!Uri.IsWellFormedUriString(query, UriKind.RelativeOrAbsolute)) // && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)) { await BotServices.SendErrorEmbedAsync(ctx, ":warning: A valid URL link is required!"); } else { await ctx.TriggerTypingAsync(); var shortenService = new ShortenService(); await ctx.RespondAsync(shortenService.shortenUrl(query)); } }
/// <summary> /// Controller related to shorten management. /// </summary> /// <param name="shortenService">Service for shorten management.</param> public ShortenController( ShortenService shortenService) { _shortenService = shortenService; }