MesterMan03 / Bedlessbot

This is an epic bot (by an epic person) that handles role applications and level system for Bedless Nation.
https://discord.gg/bedless-nation-691898152277508146
Apache License 2.0
2 stars 2 forks source link

User search for leaderboard #12

Open MesterMan03 opened 3 months ago

MesterMan03 commented 3 months ago

The new API supports a user id in the page query parameter of /api/lbpage, which can be used to find a user's entry, even if it's on the 500th page or something. To use it, just prepend the id with the letter i and pass it as the page parameter (example: http://localhost:8146/api/lbpage?page=i123456789098766).

This can be used to create a "user finder" for the leaderboard, which comes with following challenges:

jonahlikescookies commented 2 months ago

Since users are fetched before running, it should be fine to use client.users.cache.find((user) => user.username === username))?.id to convert usernames to user ids. Here is a screenshot of the API converting a username properly: image