Client

Client

Main client class for interacting to botlist.space

Constructor

new Client(optionsopt)

Parameters:
Name Type Attributes Description
options ClientOptions <optional>
The options to configure.
Source:

Members

bots :Store.<string, Bot>

Every bot cached, mapped by their IDs.
Type:
  • Store.<string, Bot>
Source:

(readonly) endpoint :string

The endpoint to use for interaction with botlist.space. The version number is missing; Fulfilled only when fetching/posting.
Type:
  • string
Source:

options :ClientOptions

The ClientOpts.
Type:
Source:

stats :Array.<Stats>

An array of the latest fetched Statistics, from oldest to newest.
Type:
Source:

users :Store.<string, User>

Every user cached, mapped by their IDs.
Type:
  • Store.<string, User>
Source:

Methods

edit(optionsopt, presetopt) → {ClientOptions}

Edit the options of the Client.
Parameters:
Name Type Attributes Default Description
options ClientOptions <optional>
{} The options to change.
preset boolean <optional>
false If true, uses the default ClientOpts as a target copy. Otherwise, Client#options is used.
Source:
Returns:
Type
ClientOptions

(async) fetchBot(idopt, optionsopt) → {Promise.<Bot>}

Fetch a bot listed on botlist.space.
Parameters:
Name Type Attributes Default Description
id string | FetchOptions <optional>
this.options.botID The ID of the bot to fetch. Not required if this.options.botID is set. Can be FetchOptions, uses [options.botID](ClientOpts#bot) if so
options FetchOptions <optional>
{} Options to pass.
Source:
Returns:
A bot object.
Type
Promise.<Bot>

(async) fetchBots(optionsopt) → {Promise.<(Array.<Bot>|Store.<string, Bot>)>}

Fetch all bots listed on botlist.space.
Parameters:
Name Type Attributes Default Description
options MultiFetchOptions <optional>
{} Options to pass.
Source:
Returns:
Type
Promise.<(Array.<Bot>|Store.<string, Bot>)>

(async) fetchBotsOfUser(id, optionsopt) → {Promise.<Array.<Bot>>}

Fetches all bots that a user owns.
Parameters:
Name Type Attributes Default Description
id string A user ID to fetch bots from.
options MultiFetchOptions <optional>
{} Options to pass.
Source:
Returns:
Type
Promise.<Array.<Bot>>

(async) fetchStats(optionsopt) → {Promise.<Stats>}

Fetch botlist.space statistics.
Parameters:
Name Type Attributes Default Description
options FetchOptions <optional>
{} Options to pass. (Ignores cache)
Source:
Returns:
The statistics.
Type
Promise.<Stats>

(async) fetchUpvotes(idopt, optionsopt) → {Promise.<(Array.<Upvote>|Store.<string, Upvote>)>}

Fetch a bot's upvotes in the current month. Requires a bot token.
Parameters:
Name Type Attributes Default Description
id string | MultiFetchOptions <optional>
this.options.botID The bot ID to fetch upvotes from. Can be FetchOptions, uses [options.botID](ClientOpts#bot) if so
options MultiFetchOptions <optional>
{} Options to pass.
Source:
Returns:
An array of upvotes.s
Type
Promise.<(Array.<Upvote>|Store.<string, Upvote>)>

(async) fetchUser(id, optionsopt) → {Promise.<User>}

Fetch a user logged onto botlist.space.
Parameters:
Name Type Attributes Default Description
id string The user ID to fetch from the API.
options FetchOptions <optional>
{} Options to pass.
Source:
Returns:
A user object.
Type
Promise.<User>

(async) postCount(idopt, optionsopt) → {object}

Post your server count to botlist.space.
Parameters:
Name Type Attributes Default Description
id string | PostOptions | number | Array.<number> <optional>
this.options.botID The bot ID to post server count for. Not required if a bot ID was supplied. Can be PostOpts if using the bot ID supplied from ClientOpts. Can also be PostOpts#countOrShards if a number/array of numbers/null.
options PostOptions <optional>
{} Options to pass. Overriden by the `id` parameter if `id` is PostOpts/number/array of numbers/null.
Source:
Returns:
An object that satisfies your low self-esteem reminding you it was successive on post.
Type
object