botlister

    2.0.5 • Public • Published

    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

    • id String The ID of the user

    Returns Promise<User>

    banUser

    Ban a user. Requires a userToken. Requires admin.

    Parameters

    • id String The ID of the user

    Returns Promise

    unbanUser

    Unban a user. Requires a userToken. Requires admin.

    Parameters

    • id String The ID of the user

    Returns Promise

    refreshUser

    Refresh a user. Requires a userToken. Requires admin.

    Parameters

    • id String The ID of the user

    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

    • id String The ID of the user

    Returns Promise

    refreshBot

    Refresh a bot. Requires a userToken. Requires admin.

    Parameters

    • id String The ID of the user

    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

    Install

    npm i botlister

    DownloadsWeekly Downloads

    8

    Version

    2.0.5

    License

    MIT

    Unpacked Size

    44.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • wr1ght