botlister
v2.0.5
Published
NodeJS library for discordbotlist.com
Downloads
31
Maintainers
Readme
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 coolness
Table 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
options
Object? 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
skip
Number 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
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, default0
)
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, defaultthis.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, defaultthis.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, defaultthis.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, defaultthis.defaultBotId
)statistics
Object Statistics to send
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, defaultthis.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, defaultthis.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, defaultthis.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, defaultthis.defaultBotId
)info
Object Updated bot information
Returns Promise
addBot
Submits a new bot to the website. Requires a userToken.
Parameters
info
Object Bot informationinfo.id
String The ID of the bot, defaults to the defaultBotId (if one is set)info.shortDescription
String Short descriptioninfo.longDescription
String? Long descriptioninfo.prefix
String Bot prefixinfo.website
String? Bot websiteinfo.botInvite
String Bot inviteinfo.serverInvite
String? Server invite
Returns Promise
fetchUser
Fetch a user
Parameters
id
String The ID of the 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
id
String The ID of the bot
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 botcreatedAt
Timestamp Timestamp of when the bot was added to DBLlastUpdatedAt
Timestamp Timestamp of when the bot was last updatedavatar
String? The hash of the bot's avatar, or null if no avatardefaultAvatarURL
String The URL of the bot's default avataravatarURL
String The URL of the bot's avatarusername
String The username of the botdiscriminator
String The discriminator of the botshortDescription
String The short description of the botlongDescription
String The long description of the botprefix
String The bot prefixwebsite
String The bot websitebotInvite
String The invite to the botserverInvite
String Server inviteverified
Boolean Whether the bot is verified or notupvotes
Number Number of upvotes the bot hasupvoted
Boolean Whether the bot has been upvoted or notowner
User The user object of the bot ownerstatistics
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 sendid
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 informationid
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 usercreatedAt
Timestamp Timestamp of when the user was added to DBLavatar
String? The hash of the user's avatar, or null if no avatardefaultAvatarURL
String The URL of the user's default avataravatarURL
String The URL of the user's avatarusername
String The username of the userdiscriminator
String The discriminator of the useradmin
Boolean Whether the user is an administrator or notbanned
Boolean Whether the user is banned or notbots
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
Repository information
Maintained by Wright
Contact me on Discord wright#0666