private static async Task <MessageSentResult> TestTime(TelegramBotAbstract sender, MessageEventArgs e) { var sentDate = await DateTimeClass.AskDateAsync(e.Message.From.Id, e.Message.Text, e.Message.From.LanguageCode, sender, e.Message.From.Username); if (sentDate.Item2 != null) { await NotifyUtil.NotifyOwners(new ExceptionNumbered(sentDate.Item2), sender, 0, sentDate.Item3); return(null); } var sentDate2 = sentDate.Item1.GetDate(); var dict = new Dictionary <string, string> { { "en", DateTimeClass.DateTimeToItalianFormat(sentDate2) } }; var text = new Language(dict); return(await SendMessage.SendMessageInPrivate(sender, e.Message.From.Id, e.Message.From.LanguageCode, e.Message.From.Username, text, ParseMode.Default, e.Message.MessageId)); }
private static async Task <List <HtmlNode> > GetDailySituationAsync(TelegramBotAbstract sender, MessageEventArgs e) { int day; int month; int year; var datetime = await DateTimeClass.AskDateAsync(e.Message.From.Id, "Scegli un giorno", "it", sender, e.Message.From.Username); if (datetime.Item2 != null) { throw datetime.Item2; return(null); } var d2 = datetime.Item1.GetDate(); if (d2 == null) { return(null); } day = d2.Value.Day; month = d2.Value.Month; year = d2.Value.Year; var sede = await AskUser.GetSedeAsync(sender, e); if (string.IsNullOrEmpty(sede)) { return(null); } var url = "https://www7.ceda.polimi.it/spazi/spazi/controller/OccupazioniGiornoEsatto.do?" + "csic=" + sede + "&categoria=tutte" + "&tipologia=tutte" + "&giorno_day=" + day + "&giorno_month=" + month + "&giorno_year=" + year + "&jaf_giorno_date_format=dd%2FMM%2Fyyyy&evn_visualizza="; var html = await Web.DownloadHtmlAsync(url, RequestCacheLevel.NoCacheNoStore); if (html.IsValid() == false) { return(null); } var doc = new HtmlDocument(); doc.LoadHtml(html.GetData()); ; var t1 = HtmlUtil.GetElementsByTagAndClassName(doc.DocumentNode, "", "BoxInfoCard", 1); ; var t3 = HtmlUtil.GetElementsByTagAndClassName(t1[0], "", "scrollContent"); return(t3); }