<html prefix="og: http://ogp.me/ns#">

<head>
    <% include ./partials/header.ejs %>
    <% include ./partials/nav.ejs %>

    <title>Discord Bot Reviews</title>
    <link rel="icon" type="image/jpg" href="https://media.discordapp.net/attachments/506425178822279168/507496898823847936/dbr.png">
</head>

<body>
    <noscript>
            <div class="alert alert-danger" role="alert">
                This website requires Javascript to work. Please enable Javascript or use a browser that supports Javascript.
            </div>
  </noscript>
  <div class="container">
        <h1 align="center" style="color:#97cafd;">Which bot would you like to apply for certification?</h1>
    <center>

<br><br> 
      <%if(bots.size <1) {%>
      <h5>
        You have no bots that can be applied for certification.
      </h5>
      <%}%>
      <% var count = 0; bots = bots.map(r=> r); while(bots[count]) { %>
        <div class="card" style="width: 18rem;display:inline-block;margin-right:2rem;margin-bottom:2rem;height:550px;<% if (bot.certified.get(bots[count].submitter) && bot.certified.get(bots[count].submitter, "bots").includes(bots[count].cli_id)) { var veryunique = true; %> background-color: #e5e4e2 <% } else { var veryunique = false; %> background-color: #1f1f1f; <% } %>">
          <img class="card-img-top img-fluid avatarImg" style="margin-top:1rem;max-width:100%;height:auto;min-width:13rem;min-height:13rem">
          <div class="card-body" style="color:white">
            <h5 class="card-title" style="color:<%if(veryunique){%>black<%}else{%>white<%}%>;display:inline-block"></h5> <span id="<%=bot.users.get(bots[count].cli_id).presence.status.toLowerCase()%>" style="color:black;display:inline-block;"></span> <% const asscrack = bot.guilds.get("500658335217876997").members.get(bots[count].cli_id);  if(asscrack) {if(asscrack.roles.has("507628704751419393")) {%> <img src="https://cdn.discordapp.com/emojis/507958292790902795.png" width="25px" height="25px"> <% } else if (asscrack.roles.has("511069587840827402")) {%> <img class="rounded" src="https://cdn.discordapp.com/emojis/508965618855444491.png" width="25px" height="25px"> <% }} %>
            <br>            <span style="color:chartreuse"><% if (bot.reactions.get(bots[count].cli_id) && bot.reactions.get(bots[count].cli_id, "likes")) { %> <i class="fa fa-thumbs-up"></i> <%= bot.reactions.get(bots[count].cli_id) && bot.reactions.get(bots[count].cli_id, "likes").length %> <% } else { %> <i class="fa fa-thumbs-up"></i> 0 <% } %></span>&nbsp;&nbsp;<span style="color:red"><% if (bot.reactions.get(bots[count].cli_id) && bot.reactions.get(bots[count].cli_id, "dislikes")) { %> <i class="fa fa-thumbs-down"></i> <%= bot.reactions.get(bots[count].cli_id) && bot.reactions.get(bots[count].cli_id, "dislikes").length %> <% } else { %> <i class="fa fa-thumbs-down"></i> 0 <% } %></span><br><br>

            <p class="card-text"><%= bots[count].short_description %></p>
            <a href="/bot/<%= bots[count].cli_id %>/applycert" class="btn btn-primary">Apply for certification</a>
          </div>
        </div>
        <script>
            var avatarImg = document.getElementsByClassName("avatarImg")[<%= count %>]
            var userinfo = JSON.parse(httpGet("/api/uservalidate?id=<%= bots[count].cli_id %>"))
            avatarImg.setAttribute("src", userinfo.avatar_url)
            var title = document.getElementsByClassName("card-title")[<%= count %>]
            title.innerHTML = userinfo.tag
          </script>
      <%  count++; } %><br><br>
      </div>
    </center>
    <!--
    <button id="searchnow" class="btn btn-primary btn-md my-2 my-sm-0 ml-3" style="display:inline-block" onclick="javascript:alert('Test passed')" type="submit">All Bots</button>
        <button id="searchnow" class="btn btn-primary btn-md my-2 my-sm-0 ml-3" style="display:inline-block" onclick="javascript:alert('Test passed')" type="submit">Unique Bots</button>
        <button id="searchnow" class="btn btn-primary btn-md my-2 my-sm-0 ml-3" style="display:inline-block" onclick="javascript:alert('Test passed')" type="submit">New Bots</button> -->
  </div>
  </body>
