infinity-bots v1.4.0
This is our Official NPM Module used for Posting and Getting Stats.
WARNING: If you are using a version older than 1.4.0, API changes may lead to the following issues:
- Webhooks may fail to work correctly
- Ratelimits may not be handled in a sane way
- Ratelimit errors may not take into account
Retry-After
headers correctly in error messages
Upgrade your library if you are affected by this issue.
Installation
npm i infinity-bots@latest
Links
- Support: Join our Discord
- Documentation: View the Docs
postBotStats()
const poster = new InfinityBots('AUTH_TOKEN', client.user.id);
await poster.postBotStats({
servers: client.guilds.cache.size,
shards: '0'
}).catch((err) => {
return console.log(`Error occured while posting stats: ${err.stack}`);
});
console.log('Posted stats to Infinity Bot List!');
Events
This library now supports events as of v1.4.0:
error
- A error occured while posting requestsratelimit
- You were ratelimited and the library either failed to handle it or you enableddisableRatelimitHandler
or if the ratelimit is globalratelimitWait
- You were ratelimited and the library is handling it
Events can be registered using the on
method on EventEmitter
Error Classes
The infinity-bots
library has the following error classes:
InfinityError
=> Raised when theres a general (non 429) error in the requestInfinityRatelimit
=> Raised when the API responds with a 429 (ratelimit) that was unable to be handled (or ifdisableRatelimitHandler
was enabled or if the ratelimit is global). This has a additionalretry
async function to retry the request.
Disable Request Errors
If you wish to use purely event emitters, enable the onlyEmit
option and the library will not throw errors on request failure but will instead only emit them via event emitters.
Change Options
From 1.4.0 onwards, the setOptions
method can be used to change the options you passed to the client dynamically in case you ever need to for whatever reason.
(Experimental) Rigorous Bot Resolution
From 1.4.0 onwards, get bot info supports API v5 experimental rigorous bot resolution that allows you to resolve bot objects based on their id, name or vanity. On API v6, rigorous bot resolution will be always enabled due to increased stability in the overall code
If you wish to enable experimental rigorous bot resolution on API v5, set resolve
to true
in getBotInfo
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago