Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Controller related to shorten management.
 /// </summary>
 /// <param name="shortenService">Service for shorten management.</param>
 public ShortenController(
     ShortenService shortenService)
 {
     _shortenService = shortenService;
 }