1. Home
  2. Docs
  3. Disc0rd.exe
  4. API
  5. Leaderboard

Leaderboard

The leaderboard API is divided into two sections: “get” and “img“.


get” is used to get the current information of a guild. Simply send a request to the following api:

curl -XGET -H "Content-type: application/json" 'https://disc0rd.me/api/v1/leaderboard/get/<guild-id>'

If everything was done correctly you will receive a JSON object as return that looks like this:

{
  "status": "ok",
  "leaderboard": [
    {
      "name": "scolastico",
      "tag": "0420",
      "picture": "https://cdn.discordapp.com/avatars/441419741316251670/a_e566b123f09a44cc48a81937d7bf5106.gif",
      "id": "441419741316251670",
      "xp": 328431,
      "level": 9,
      "nextLevelXP": 381325,
      "lastLevelXP": 152530,
      "place": 1
    }
  ]
}

img” is used if you want to receive the ranking picture from a user. The return will then be xml code which contains an SVG image. A request looks like this:

curl -XGET 'https://disc0rd.me/api/v1/leaderboard/img/<guild-id>/<user-id>'

And the return should look like this if everything was successful:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="467px" height="141px">
    <rect y="18" x="12" rx="3" ry="3" width="443" height="105" style="fill:#23272A;"></rect>
    <circle r="42" cx="61" cy="71" style="fill: #2C2F33;"></circle>
    <clipPath id="clipCircle">
        <circle r="40" cx="61" cy="71"></circle>
    </clipPath>
    <image x="21" y="31" width="80" height="80" clip-path="url(#clipCircle)" xlink:href="data:image/png;base64, base 64 image code would be here but its very long so i cut it out"></image>
    <text x="441" y="50" font-family="Arial, Helvetica, sans-serif" font-size="12" text-anchor="end">
        <tspan fill="#ee4d2e">
            LEVEL
            <tspan font-size="30">9</tspan>
        </tspan>
    </text>
    <text x="137" y="83" font-family="Arial, Helvetica, sans-serif" font-size="17" fill="white">
        scolastico
        <tspan style="fill: #7F8384" font-size="12">#0420</tspan>
    </text>
    <text x="441" y="83" font-family="Arial, Helvetica, sans-serif" font-size="12" fill="white" text-anchor="end">
        175901
        <tspan style="fill: #7F8384"> / 228795 XP</tspan>
    </text>
    <rect x="128" y="91" rx="12" ry="12" width="318" height="20" style="fill:black;"></rect>
    <rect x="129" y="92" rx="9" ry="9" width="316" height="18" style="fill:#484B4E;"></rect>
    <rect x="129" y="92" rx="9" ry="9" width="242.17668655346486" height="18" style="fill:#ee4d2e;"></rect>
</svg>

Here is a list of errors and their description that can occur with these inquiries:

ERROR CODEDESCRIPTION
guild not foundThe guild was not found. Please check the ID and whether the bot is active on this guild.
guild and/or user not foundAs above, only in addition, it could be that the user was not found. Please check whether the bot is active in this guild and whether the user is also in the guild.
internal errorInternal server error. This mistake is not yours. It’s the bot’s mistake. All errors are reported automatically. However, if the error occurs frequently, please contact us.
Was this article helpful to you? Yes 1 No

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *