title: How to get asynchronous calls using HtmlAgilityPack *In a Discord Bot*
body: <pre class="lang-cs prettyprint-override"><code>using System.Threading.Tasks;
  using System.IO;
  using System.Net;
  using System.Linq;
  using System.Collections.Generic;
  using System;
  
  using HtmlAgilityPack;
  
  using Discord.Commands;
  
  using static HorsemenBot.Modules.LadderPosition;
  
  namespace HorsemenBot.Modules
  {
      public class Program
      {
          public static async Task Main(string[] args)
          {
              string TeamName = File.ReadAllText($@&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\TeamName.txt&quot;);
              var models = new List&lt;Model&gt;();
              var set = new Set();
              await set.LadderPosition(models);
              var teams = models.Where(x =&gt; x.TeamName.Equals($&quot;{TeamName}&quot;));
  
              foreach (var team in teams)
              {
                  Console.WriteLine($&quot;Team: { team.TeamName }\tPosition: {team.Position}\tTeamLink: {team.TeamLink}&quot;);
              }
          }
      }
  
      public class Model
      {
          public int Position { get; set; }
          public string TeamName { get; set; }
          public string TeamLink { get; set; }
          public string TeamLogo { get; set; }
          public string GroupLogo { get; set; }
          public string GroupTitle { get; set; }
          public int Wins { get; set; }
          public int Loses { get; set; }
          public int GamesPlayed { get; set; }
          public int MMR { get; set; }
          public int PointsScored { get; set; }
          public string Division { get; set; }
          public string ImageSource { get; set; }
          public int LadderPosition { get; set; }
      }
  
      [Name(&quot;Setting Team Name&quot;)]
      public class LadderPosition : ModuleBase&lt;SocketCommandContext&gt;
      {
          [Group(&quot;&quot;), Name(&quot;Ladder Position&quot;)]
          [RequireContext(ContextType.Guild)]
          public class Set : ModuleBase
          {
              [Command(&quot;ladder&quot;)]
              [Summary(&quot;Show your team's position on the ladder&quot;)]
  
              public async Task LadderPosition(List&lt;Model&gt; models)
              {
  
                  using WebClient client = new WebClient();
  
                  await Task.Delay(500);
  
                  //await ReplyAsync(&quot;Downloading VRML data, please stand by...&quot;);
  
                  string TeamName = File.ReadAllText($@&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\TeamName.txt&quot;);
                  /*
                  client.DownloadFile(&quot;https://vrmasterleague.com/EchoArena/Standings/&quot;, @&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\Ladder-1-100.txt&quot;);
                  client.DownloadFile(&quot;https://vrmasterleague.com/EchoArena/Standings/?rankMin=101&quot;, @&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\Ladder-101-200.txt&quot;);
                  client.DownloadFile(&quot;https://vrmasterleague.com/EchoArena/Standings/?rankMin=201&quot;, @&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\Ladder-201-300.txt&quot;);
                  client.DownloadFile(&quot;https://vrmasterleague.com/EchoArena/Standings/?rankMin=301&quot;, @&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\Ladder-301-400.txt&quot;);
                  client.DownloadFile(&quot;https://vrmasterleague.com/EchoArena/Standings/?rankMin=401&quot;, @&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\Ladder-401-500.txt&quot;);
                  client.DownloadFile(&quot;https://vrmasterleague.com/EchoArena/Standings/?rankMin=501&quot;, @&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\Ladder-501-600.txt&quot;);
                  client.DownloadFile(&quot;https://vrmasterleague.com/EchoArena/Standings/?rankMin=601&quot;, @&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\Ladder-601-700.txt&quot;);
                  */
  
                  await ReplyAsync($&quot;VRML data downloaded, fetching **{TeamName}'s** results...&quot;);
  
                  HtmlDocument document1 = new HtmlDocument();
  
                  document1.Load(@&quot;C:\Users\anafa\OneDrive\Desktop\Horsemen Bot\Ladder-1-100.txt&quot;);
  
                  var table = document1.DocumentNode.SelectNodes(&quot;//tr[contains(@class, 'vrml_table_row')]&quot;).ToList().SkipLast(1);
  
                  foreach (var t in table)
                  {
                      var model = new Model
                      {
                          Position = int.Parse(t.SelectSingleNode(&quot;td[contains(@class, 'pos_cell')]&quot;).InnerText),
                          ImageSource = t.SelectSingleNode(&quot;td[contains(@class, 'div_cell')]/img&quot;).Attributes[&quot;src&quot;].Value,
                          Division = t.SelectSingleNode(&quot;td[contains(@class, 'div_cell')]/img&quot;).Attributes[&quot;title&quot;].Value,
                          TeamLink = t.SelectSingleNode(&quot;td[contains(@class, 'team_cell')]/a&quot;).Attributes[&quot;href&quot;].Value,
                          TeamLogo = t.SelectSingleNode(&quot;td[contains(@class, 'team_cell')]/a/img&quot;).Attributes[&quot;src&quot;].Value,
                          TeamName = t.SelectSingleNode(&quot;td/a/span[contains(@class, 'team_name')]&quot;).InnerText,
                          GroupLogo = t.SelectSingleNode(&quot;td[contains(@class, 'group_cell')]/img&quot;).Attributes[&quot;src&quot;].Value,
                          GroupTitle = t.SelectSingleNode(&quot;td[contains(@class, 'group_cell')]/img&quot;).Attributes[&quot;title&quot;].Value
                      };
                      models.Add(model);
                  }
  
                  await ReplyAsync(models.ToString());
  
                  //await Task.Delay(500);
              }
          }
      }
  }
  </code></pre>
  <p>That's what I've got so far.</p>
  <p>Idea is that it reads this file,</p>
  <pre class="lang-html prettyprint-override"><code>&lt;tr class=&quot;vrml_table_row&quot;&gt;
      &lt;td class=&quot;pos_cell&quot;&gt;59&lt;/td&gt;
      &lt;td class=&quot;div_cell&quot;&gt;&lt;img src=&quot;/images/div_gold_40.png&quot; title=&quot;Gold&quot; /&gt;&lt;/td&gt;
      &lt;td class=&quot;team_cell&quot;&gt;&lt;a href=&quot;/EchoArena/Teams/RHNkUmJMV1p5UEU90&quot; class=&quot;team_link&quot;&gt;&lt;img src=&quot;/images/logos/teams/9b3b1917-a56b-40a3-80ee-52b1c9f31910.png&quot; class=&quot;team_logo&quot; /&gt;&lt;span class=&quot;team_name&quot;&gt;Echoholics&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
      &lt;td class=&quot;group_cell&quot;&gt;&lt;img src=&quot;/images/group_ame.png&quot; class=&quot;group_logo&quot; title=&quot;America East&quot; /&gt;&lt;/td&gt;
      &lt;td class=&quot;gp_cell&quot;&gt;14&lt;/td&gt;
      &lt;td class=&quot;win_cell&quot;&gt;10&lt;/td&gt;
      &lt;td class=&quot;loss_cell&quot;&gt;4&lt;/td&gt;
      &lt;td class=&quot;pts_cell&quot;&gt;340&lt;/td&gt;
      &lt;td class=&quot;mmr_cell&quot;&gt;&lt;span&gt;1200&lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr class=&quot;vrml_table_row&quot;&gt;
      &lt;td class=&quot;pos_cell&quot;&gt;60&lt;/td&gt;
      &lt;td class=&quot;div_cell&quot;&gt;&lt;img src=&quot;/images/div_diamond_40.png&quot; title=&quot;Diamond&quot; /&gt;&lt;/td&gt;
      &lt;td class=&quot;team_cell&quot;&gt;&lt;a href=&quot;/EchoArena/Teams/cUJmVGlKajFGRlE90&quot; class=&quot;team_link&quot;&gt;&lt;img src=&quot;/images/logos/teams/dff8310a-a429-4c60-af82-0333d530d22d.png&quot; class=&quot;team_logo&quot; /&gt;&lt;span class=&quot;team_name&quot;&gt;Horsemen&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
      &lt;td class=&quot;group_cell&quot;&gt;&lt;img src=&quot;/images/group_aa.png&quot; class=&quot;group_logo&quot; title=&quot;Oceania/Asia&quot; /&gt;&lt;/td&gt;
      &lt;td class=&quot;gp_cell&quot;&gt;10&lt;/td&gt;
      &lt;td class=&quot;win_cell&quot;&gt;6&lt;/td&gt;
      &lt;td class=&quot;loss_cell&quot;&gt;4&lt;/td&gt;
      &lt;td class=&quot;pts_cell&quot;&gt;235&lt;/td&gt;
      &lt;td class=&quot;mmr_cell&quot;&gt;&lt;span&gt;1200&lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr class=&quot;vrml_table_row&quot;&gt;
      &lt;td class=&quot;pos_cell&quot;&gt;61&lt;/td&gt;
      &lt;td class=&quot;div_cell&quot;&gt;&lt;img src=&quot;/images/div_gold_40.png&quot; title=&quot;Gold&quot; /&gt;&lt;/td&gt;
      &lt;td class=&quot;team_cell&quot;&gt;&lt;a href=&quot;/EchoArena/Teams/UDd1dTJQRzBiRzQ90&quot; class=&quot;team_link&quot;&gt;&lt;img src=&quot;/images/logos/teams/8eb6109e-f765-4d64-a766-cc5605a01ad0.png&quot; class=&quot;team_logo&quot; /&gt;&lt;span class=&quot;team_name&quot;&gt;Femboys&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
      &lt;td class=&quot;group_cell&quot;&gt;&lt;img src=&quot;/images/group_ame.png&quot; class=&quot;group_logo&quot; title=&quot;America East&quot; /&gt;&lt;/td&gt;
      &lt;td class=&quot;gp_cell&quot;&gt;12&lt;/td&gt;
      &lt;td class=&quot;win_cell&quot;&gt;8&lt;/td&gt;
      &lt;td class=&quot;loss_cell&quot;&gt;4&lt;/td&gt;
      &lt;td class=&quot;pts_cell&quot;&gt;348&lt;/td&gt;
      &lt;td class=&quot;mmr_cell&quot;&gt;&lt;span&gt;1200&lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  <p>and Pulls out just the Horsemen Stuff INSIDE a discord Bot Command.</p>
  <p>Error:
  Severity    Code    Description Project File    Line    Suppression State
  Error   CS0017  Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.    Horsemen Bot    C:\Users\anafa\source\repos\Horsemen Bot\src\Modules\LadderShowModule.cs    18  Active</p>
  <p>Still trying, nothing is working.</p>