예제 #1
0
        public async Task HAsync(string find = null, [Remainder] int count = 3)
        {
            if ((base.Context.Channel as ITextChannel).IsNsfw)
            {
                Uri Url;
                if (find != null)
                {
                    Url = new Uri("https://rt.pornhub.com/video/search?search=" + find);
                }
                else
                {
                    Url = new Uri("https://rt.pornhub.com");
                }
                string content = await SiteWorker.HTTPDownload(Url);

                HtmlDocument htmlDocument = new HtmlDocument();
                htmlDocument.LoadHtml(content);
                List <string> links = new List <string>();
                foreach (HtmlNode a in htmlDocument.DocumentNode.SelectNodes("//a"))
                {
                    if (a.HasClass("linkVideoThumb"))
                    {
                        links.Add("http://rt.pornhub.com" + a.GetAttributeValue("href", ""));
                    }
                }
                string outlinks = "";
                for (int i = 0; i < ((count > links.Count <string>()) ? links.Count <string>() : count); i++)
                {
                    outlinks += (links[Program.Rand.Next(0, links.Count <string>() - 1)]) + "\n\n";
                }
                await Context.Channel.SendMessageAsync(outlinks, false, null, null);

                links = null;
            }
        }
예제 #2
0
        public async Task DolAsync([Remainder] string num = "1")
        {
            try
            {
                HtmlNode tbody = await SiteWorker.ParseSite();

                double init = double.Parse(num.Replace('.', ','));
                await Context.Channel.SendMessageAsync(DolAsync(tbody, init, "UAH")
                                                       + '\n' + DolAsync(tbody, init, "RUB")
                                                       + '\n' + DolAsync(tbody, init, "BYN")
                                                       + '\n' + DolAsync(tbody, init, "CNY")
                                                       + '\n' + DolAsync(tbody, init, "EUR"),
                                                       false, null, null);

                return;
            }
            catch (Exception ex)
            {
                await Program.LogAsync(new LogMessage(LogSeverity.Error, nameof(DolAsync), ex.Message, ex));
            }
        }