1.4.0 • Published 2 years ago

infinity-bots v1.4.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

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


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 requests
  • ratelimit - You were ratelimited and the library either failed to handle it or you enabled disableRatelimitHandler or if the ratelimit is global
  • ratelimitWait - 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 request
  • InfinityRatelimit => Raised when the API responds with a 429 (ratelimit) that was unable to be handled (or if disableRatelimitHandler was enabled or if the ratelimit is global). This has a additional retry 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

1.4.0

2 years ago

1.4.0-dev

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.9

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago