コード例 #1
0
        public async Task YouTubeVideo(CommandContext ctx,
                                       [Description("First result video to find on YouTube")][RemainingText] string query)
        {
            if (!BotServices.CheckUserInput(query))
            {
                return;
            }
            var service = new YoutubeService();
            var results = await service.GetFirstVideoResultAsync(query).ConfigureAwait(false);

            await ctx.RespondAsync(results).ConfigureAwait(false);
        }
コード例 #2
0
        public async Task YouTube(CommandContext ctx, [RemainingText] string query)
        {
            if (string.IsNullOrWhiteSpace(query))
            {
                await ctx.RespondAsync("https://www.youtube.com/watch?v=rFA_auWj0rQ");
            }
            else
            {
                await ctx.TriggerTypingAsync();

                var youTubeService = new YoutubeService();
                var output         = await youTubeService.GetFirstVideoResultAsync(query);

                await ctx.RespondAsync(output);
            }
        }