1.0.4 • Published 6 years ago

dblstats.js v1.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Select Array

The promise always returns the raw already parsed JSON. To get the results you want to do something like .then(bots => bots.results). To get the time this info was updated do .then(bots => bots.updated) The array at the end of these functions will determine what info is returned. (Bot ID is always returned).

Select TypeTypeDescription
defAvatarstringthe Default avatar for this bot.
invitestringThe bots invite url.
githubsringThe Github page for this bot.
websitestringThe website associated with this bot.
longdescstringThe text or HTML used in the long description.
shortdescstringThe text in the short Description.
prefixstringThe prefix set on DBL.
libstringThe library used to make this bot.
clientidstringThe application ID for this bot.
avatarstringThe bots current avatar.
discriminatornumberThe discriminator for the bot.
usernamestringThe bots username.
dateISO 8601Date the bot was added to DBL.
serverCountnumberThe amount of servers the bot is in. (-1 if not posted)
shardCountnumberThe amount of shards started with this Bot. (-1 if none)
shardsarrayAn array containing the amount of servers per shard. (empty if no Shards)
pointsnumberThe amount of upvotes on DBL.
certifiedbooleanWhenever this bot is certified or not.
ownersarrayAn array of all owner IDs.

The array looks like ["avatar", "username", "discriminator", "shards", "serverCount"], which would return the Avatar, Username, Discrim, Servers/shard and total Server count in the results array.

Get a bot via ID

const dbl = require("dblstats.js")
dbl.getBot("323128638444929025", ["avatar", "username", "serverCount"]).then(bots => {
    let res = bots.results.map(bot => 
    `The bot ${bot.username} has the avatarHash ${bot.avatar} and ${bot.serverCount} servers`
    )
    let lastupdated = new Date(bots.updated)
    console.log(res.join("\n")+"\nLast Updated:" + lastupdated)
});

Get bots matching criterias

const dbl = require("dblstats.js")

dbl.getBots({username: "Shuvi", discrim: "3521"}, ["avatar", "username", "serverCount"]).then(bots => {
    let res = bots.results.map(bot => 
    `The bot ${bot.username} has the avatarHash ${bot.avatar} and ${bot.serverCount} servers`
    )
    console.log(res.join("\n"))
});

dbl.getBots({prefix: "!", offset: 20, limit:20}, ["avatar", "username", "serverCount"]).then(bots => {
    let res = bots.results.map(bot => 
    `The bot ${bot.username} has the avatarHash ${bot.avatar} and ${bot.serverCount} servers`
    )
    console.log(res.join("\n"))
});

The object can contain anything you can see listed in the Select Array table above.

Filtering values

Prefix, Short/Long Description includes

const dbl = require("dblstats.js")

dbl.filterBots({type: "shortdesc", filter: "includes", toFilter: "unique", limit: 5}, ["username", "serverCount"])
.then(bots => {
    let res = bots.results.map(bot => 
    `The bot ${bot.username} has ${bot.serverCount} servers`
    )
    console.log(res.join("\n"))
});

dbl.filterBots({type: "prefix", filter: "includes", toFilter: "s!", limit: 2}, ["username", "serverCount"])
.then(bots => {
    let res = bots.results.map(bot => 
    `The bot ${bot.username} has ${bot.serverCount} servers`
    )
    console.log(res.join("\n"))
});

serverCount, shardCount or points are above/below X

const dbl = require("dblstats.js")

dbl.filterBots({type: "serverCount", filter: ">=", toFilter: 700, limit: 3}, ["username", "serverCount"])
.then(bots => {
    let res = bots.results.map(bot => `The bot ${bot.username} has ${bot.serverCount} servers`)
    console.log(res.join("\n"))
});

dbl.filterBots({type: "shardCount", filter: "<=", toFilter: 20}, ["username", "serverCount", "shardCount"])
.then(bots => {
    let res = bots.results.map(bot =>
     `The bot ${bot.username} has ${bot.serverCount} servers with ${bot.shardCount} shards`
     )
    console.log(res.join("\n"))
});

//points are upvotes
dbl.filterBots({type: "points", filter: ">", toFilter: 100, offset: 5}, ["username", "serverCount", "points"])
.then(bots => {
    let res = bots.results.map(bot => 
    `The bot ${bot.username} has ${bot.serverCount} servers with ${bot.points} upvotes`
    )
    console.log(res.join("\n"))
});
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago