npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

botlister

v2.0.5

Published

NodeJS library for discordbotlist.com

Downloads

31

Readme

Botlister - NodeJS library for discordbotlist.com

npm package

Dependency Status Known Vulnerabilities Discord

Super simple to use

Botlister is an easy to use, zero-dependency NodeJS library for the discordbotlist.com

const botlister = new (require('botlister'))({ apiToken: 'abcdef', defaultBotId: '371840836423385101' })
botlister.updateBotStatistics({
    guilds: bot.guilds.size,
    users: bot.users.size,
}).catch(console.error);

// OR
const dblBot = await botlister.fetchBot('1111');
console.log(dblBot.statistics);
dblBot.updateStatistics({ guilds: 1 });

// read docs for more coolness

Table of contents


Examples

Need an example? Check out the example folder

back to top


Getting an API token

Go to your bots page and select one of your bots, then click generate token

back to top


Documentation

Core

Represents main library

Parameters

  • options Object? Botlister options (all options are optional)
    • options.apiToken String bot api token (optional, default null)
    • options.defaultBotId String Default bot ID to use when calling bot-related functions (optional, default null)
    • options.userToken String user account token (optional, default null)

fetchPopularBots

Fetch an array of "hot" or "popular" bots

Returns Promise<Array<Bot>> Resolves with an array of Bot objects

fetchAllBots

Fetch an array of all bots on the website. Use lightly.

Parameters

  • skip Number Amount of bots to skip (optional, default 0)

Returns Promise<Array<Bot>> Resolves with an array of Bot objects

searchBots

Search through all bots with a search term.

Parameters

  • searchTerm String? The search term to use (optional, default '')

Returns Promise<Array<Bot>> Resolves with an array of Bot objects

fetchMyBots

Fetch the current user's bots. Requires a userToken.

Parameters

  • skip Number Amount of bots to skip (optional, default 0)

Returns Promise<Array<Bot>> Resolves with an array of Bot objects

fetchBot

Fetch a bot

Parameters

  • id String? The ID of the bot to fetch, defaults to the defaultBotId (if one is set) (optional, default this.defaultBotId)

Returns Promise<Bot> Resolves with a Bot object

fetchUpvoters

Fetch an array of users who upvoted the bot

Parameters

  • id String? The ID of the bot to fetch upvoters for, defaults to the defaultBotId (if one is set) (optional, default this.defaultBotId)

Returns Promise<Array<User>> Resolves with an array of User objects

generateBotToken

Re-generates the bot API token. Requires a userToken.

Parameters

  • id String? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, default this.defaultBotId)

Returns Promise<String> Resolves with a new apiToken

updateBotStatistics

Updates bot statistics. Requires an apiToken.

Parameters

  • id String? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, default this.defaultBotId)
  • statistics Object Statistics to send
    • statistics.shardId Number? Shard ID to send data for
    • statistics.guilds Number? Amount of guilds
    • statistics.users Number? Amount of users
    • statistics.voiceConnections Number? Amount of voice connections

Returns Promise

resetBotStatistics

Resets bot statistics. Requires an apiToken.

Parameters

  • id String? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, default this.defaultBotId)

Returns Promise

deleteBot

Deletes the bot. Requires a userToken.

Parameters

  • id String? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, default this.defaultBotId)

Returns Promise

upvoteBot

Upvotes the bot with the user's account. Requires a userToken.

Parameters

  • id String? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, default this.defaultBotId)

Returns Promise

updateBotInformation

Updates/edits the bot information on the website. Requires a userToken.

Parameters

  • id String? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, default this.defaultBotId)
  • info Object Updated bot information
    • info.shortDescription String? Short description
    • info.longDescription String? Long description
    • info.prefix String? Bot prefix
    • info.website String? Bot website
    • info.botInvite String? Bot invite
    • info.serverInvite String? Server invite

Returns Promise

addBot

Submits a new bot to the website. Requires a userToken.

Parameters

  • info Object Bot information
    • info.id String The ID of the bot, defaults to the defaultBotId (if one is set)
    • info.shortDescription String Short description
    • info.longDescription String? Long description
    • info.prefix String Bot prefix
    • info.website String? Bot website
    • info.botInvite String Bot invite
    • info.serverInvite String? Server invite

Returns Promise

fetchUser

Fetch a user

Parameters

Returns Promise<User>

banUser

Ban a user. Requires a userToken. Requires admin.

Parameters

Returns Promise

unbanUser

Unban a user. Requires a userToken. Requires admin.

Parameters

Returns Promise

refreshUser

Refresh a user. Requires a userToken. Requires admin.

Parameters

Returns Promise

fetchUninvitedBots

Fetch an array of bots that are not in the DBL server. Requires a userToken. Requires admin.

Returns Promise<Array<Bot>> Resolves with an array of Bot objects

verifyBot

Verify a bot. Requires a userToken. Requires admin.

Parameters

Returns Promise

unverifyBot

Unverify a bot. Requires a userToken. Requires admin.

Parameters

Returns Promise

refreshBot

Refresh a bot. Requires a userToken. Requires admin.

Parameters

Returns Promise

fetchConfiguration

Fetch DBL configuration. Requires a userToken. Requires admin.

Returns Promise<Object> {"db_locked": true}

lockDatabase

Lock database. Requires a userToken. Requires admin.

Returns Promise

unlockDatabase

Unlock database. Requires a userToken. Requires admin.

Returns Promise

Bot

Represents a DBL bot

Parameters

  • data
  • core

Properties

  • id String The ID of the bot
  • createdAt Timestamp Timestamp of when the bot was added to DBL
  • lastUpdatedAt Timestamp Timestamp of when the bot was last updated
  • avatar String? The hash of the bot's avatar, or null if no avatar
  • defaultAvatarURL String The URL of the bot's default avatar
  • avatarURL String The URL of the bot's avatar
  • username String The username of the bot
  • discriminator String The discriminator of the bot
  • shortDescription String The short description of the bot
  • longDescription String The long description of the bot
  • prefix String The bot prefix
  • website String The bot website
  • botInvite String The invite to the bot
  • serverInvite String Server invite
  • verified Boolean Whether the bot is verified or not
  • upvotes Number Number of upvotes the bot has
  • upvoted Boolean Whether the bot has been upvoted or not
  • owner User The user object of the bot owner
  • statistics Object? The bot statistics

getUpvoters

Get an array of users who have upvoted the bot

Returns Promise<Array<User>> Resolves with an array of User objects

regenerateToken

Regenerate the bot token. Requires a userToken.

Returns Promise<String> Resolves with the new bot token

updateStatistics

Updates bot statistics. Requires an apiToken.

Parameters

  • statistics Object Statistics to send
    • statistics.shardId Number? Shard ID to send data for
    • statistics.guilds Number? Amount of guilds
    • statistics.users Number? Amount of users
    • statistics.voiceConnections Number? Amount of voice connections
  • id String? The ID of the bot, defaults to the defaultBotId (if one is set)

Returns Promise

resetStatistics

Resets bot statistics

Returns Promise

delete

Deletes bot. Requires a userToken.

Returns Promise

upvote

Upvotes bot. Requires a userToken.

Returns Promise

editInformation

Updates/edits the bot information on the website. Requires a userToken.

Parameters

  • info Object Updated bot information
    • info.shortDescription String? Short description
    • info.longDescription String? Long description
    • info.prefix String? Bot prefix
    • info.website String? Bot website
    • info.botInvite String? Bot invite
    • info.serverInvite String? Server invite
  • id String? The ID of the bot, defaults to the defaultBotId (if one is set)

Returns Promise

verify

Verifies bot. Requires a userToken.

Returns Promise

unverify

Unverifies bot. Requires a userToken.

Returns Promise

refresh

Refresh bot. Requires a userToken.

Returns Promise

User

Represents a DBL user

Parameters

  • data
  • core

Properties

  • id String The ID of the user
  • createdAt Timestamp Timestamp of when the user was added to DBL
  • avatar String? The hash of the user's avatar, or null if no avatar
  • defaultAvatarURL String The URL of the user's default avatar
  • avatarURL String The URL of the user's avatar
  • username String The username of the user
  • discriminator String The discriminator of the user
  • admin Boolean Whether the user is an administrator or not
  • banned Boolean Whether the user is banned or not
  • bots Array<Bot> Array of Bot objects that belong to the user

ban

Ban user. Requires userToken.

Returns Promise

unban

Unban user. Requires userToken.

Returns Promise

refresh

Refresh user. Requires userToken.

Returns Promise

back to top


Repository information

Maintained by Wright

Contact me on Discord wright#0666

back to top