botlister v2.0.5
Botlister - NodeJS library for discordbotlist.com
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 coolnessTable of contents
Examples
Need an example? Check out the example folder
Getting an API token
Go to your bots page and select one of your bots, then click generate token
Documentation
- Core
- Parameters
- fetchPopularBots
- fetchAllBots
- searchBots
- fetchMyBots
- fetchBot
- fetchUpvoters
- generateBotToken
- updateBotStatistics
- resetBotStatistics
- deleteBot
- upvoteBot
- updateBotInformation
- addBot
- fetchUser
- banUser
- unbanUser
- refreshUser
- fetchUninvitedBots
- verifyBot
- unverifyBot
- refreshBot
- fetchConfiguration
- lockDatabase
- unlockDatabase
- Bot
- User
Core
Represents main library
Parameters
optionsObject? Botlister options (all options are optional)
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
skipNumber Amount of bots to skip (optional, default0)
Returns Promise<Array<Bot>> Resolves with an array of Bot objects
searchBots
Search through all bots with a search term.
Parameters
searchTermString? 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
skipNumber Amount of bots to skip (optional, default0)
Returns Promise<Array<Bot>> Resolves with an array of Bot objects
fetchBot
Fetch a bot
Parameters
idString? The ID of the bot to fetch, defaults to the defaultBotId (if one is set) (optional, defaultthis.defaultBotId)
Returns Promise<Bot> Resolves with a Bot object
fetchUpvoters
Fetch an array of users who upvoted the bot
Parameters
idString? The ID of the bot to fetch upvoters for, defaults to the defaultBotId (if one is set) (optional, defaultthis.defaultBotId)
Returns Promise<Array<User>> Resolves with an array of User objects
generateBotToken
Re-generates the bot API token. Requires a userToken.
Parameters
idString? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, defaultthis.defaultBotId)
Returns Promise<String> Resolves with a new apiToken
updateBotStatistics
Updates bot statistics. Requires an apiToken.
Parameters
idString? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, defaultthis.defaultBotId)statisticsObject Statistics to send
Returns Promise
resetBotStatistics
Resets bot statistics. Requires an apiToken.
Parameters
idString? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, defaultthis.defaultBotId)
Returns Promise
deleteBot
Deletes the bot. Requires a userToken.
Parameters
idString? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, defaultthis.defaultBotId)
Returns Promise
upvoteBot
Upvotes the bot with the user's account. Requires a userToken.
Parameters
idString? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, defaultthis.defaultBotId)
Returns Promise
updateBotInformation
Updates/edits the bot information on the website. Requires a userToken.
Parameters
idString? The ID of the bot, defaults to the defaultBotId (if one is set) (optional, defaultthis.defaultBotId)infoObject Updated bot information
Returns Promise
addBot
Submits a new bot to the website. Requires a userToken.
Parameters
infoObject Bot informationinfo.idString The ID of the bot, defaults to the defaultBotId (if one is set)info.shortDescriptionString Short descriptioninfo.longDescriptionString? Long descriptioninfo.prefixString Bot prefixinfo.websiteString? Bot websiteinfo.botInviteString Bot inviteinfo.serverInviteString? Server invite
Returns Promise
fetchUser
Fetch a user
Parameters
idString The ID of the user
banUser
Ban a user. Requires a userToken. Requires admin.
Parameters
idString The ID of the user
Returns Promise
unbanUser
Unban a user. Requires a userToken. Requires admin.
Parameters
idString The ID of the user
Returns Promise
refreshUser
Refresh a user. Requires a userToken. Requires admin.
Parameters
idString 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
idString The ID of the bot
Returns Promise
unverifyBot
Unverify a bot. Requires a userToken. Requires admin.
Parameters
idString The ID of the user
Returns Promise
refreshBot
Refresh a bot. Requires a userToken. Requires admin.
Parameters
idString 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
datacore
Properties
idString The ID of the botcreatedAtTimestamp Timestamp of when the bot was added to DBLlastUpdatedAtTimestamp Timestamp of when the bot was last updatedavatarString? The hash of the bot's avatar, or null if no avatardefaultAvatarURLString The URL of the bot's default avataravatarURLString The URL of the bot's avatarusernameString The username of the botdiscriminatorString The discriminator of the botshortDescriptionString The short description of the botlongDescriptionString The long description of the botprefixString The bot prefixwebsiteString The bot websitebotInviteString The invite to the botserverInviteString Server inviteverifiedBoolean Whether the bot is verified or notupvotesNumber Number of upvotes the bot hasupvotedBoolean Whether the bot has been upvoted or notownerUser The user object of the bot ownerstatisticsObject? 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
statisticsObject Statistics to sendidString? 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
infoObject Updated bot informationidString? 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
datacore
Properties
idString The ID of the usercreatedAtTimestamp Timestamp of when the user was added to DBLavatarString? The hash of the user's avatar, or null if no avatardefaultAvatarURLString The URL of the user's default avataravatarURLString The URL of the user's avatarusernameString The username of the userdiscriminatorString The discriminator of the useradminBoolean Whether the user is an administrator or notbannedBoolean Whether the user is banned or notbotsArray<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
Repository information
Maintained by Wright
Contact me on Discord wright#0666
