예제 #1
0
        public async Task WikiAsync([Remainder][Summary("Article name")] string article)
        {
            Wikipedia wikipedia = new Wikipedia
            {
                Limit = 5
            };

            await RankaReplyAsync($"Searching Wikipedia for {article}....").ConfigureAwait(false);

            QueryResult results = wikipedia.Search($"{article}");
            await _chrome.NewBrowserAsync(2000).ConfigureAwait(false);

            BasicScreenshot chrome = new BasicScreenshot(results.Search.ElementAt(0).Url.AbsoluteUri);

            await RankaReplyAsync("Taking screenshot...").ConfigureAwait(false);

            var file = await chrome.GetScreenshot(_chrome.GetChromiumPage()).ConfigureAwait(false);

            await RankaReplyAsync($"Done, here's your screenshot!").ConfigureAwait(false);
            await RankaFileUploadAsync(file).ConfigureAwait(false);

            await chrome.Cleanup(_chrome.GetChromiumPage()).ConfigureAwait(false);

            await _chrome.Destroy().ConfigureAwait(false);
        }
예제 #2
0
        public async Task ScreenshotAsync([Summary("Screenshot height")] int height, [Summary("URL (link to page)")] string url)
        {
            url = StringUtils.DiscordStringFormat(url);
            await _chrome.NewBrowserAsync(height).ConfigureAwait(false);

            BasicScreenshot chrome = new BasicScreenshot(url);

            await RankaReplyAsync("Taking screenshot...").ConfigureAwait(false);

            var file = await chrome.GetScreenshot(_chrome.GetChromiumPage()).ConfigureAwait(false);

            await RankaReplyAsync($"Done, here's your screenshot!").ConfigureAwait(false);
            await RankaFileUploadAsync(file).ConfigureAwait(false);

            await chrome.Cleanup(_chrome.GetChromiumPage()).ConfigureAwait(false);

            await _chrome.Destroy().ConfigureAwait(false);
        }