wbl-api
v1.0.2
Published
Wumpus Bot List API wrapper written in JavaScript.
Downloads
9
Maintainers
Readme
Installing
npm install wbl-api
Usage
a) Properly instantiating a new client.
const WblApi = require("wbl-api");
const BotID = "MY_BOTS_USER_ID";
const Token = "MY_WBL_API_TOKEN_FOR_MY_BOT";
const WblClient = new WblApi.Client({
"id": BotID,
"token": Token
});
b) Posting your server and shard count to the API.
setInterval(() => {
const myServerCount = client.guilds.cache.size; // ! Discord.js Code
WblClient.postCount(myServerCount).then(result => {
if (result.error) console.error("Failed to post the amount of guilds.");
else console.log("Posted amount of guilds to WBL API.")
});
}, 600000); // Every 20 minutes.
c) Retriving a list of users that upvoted your bot in last 12 to 24 hours.
WblClient.getVotes().then(response => {
console.log(`${response.data.length} Users have upvotes the bot in last 12 to 24 hours.`);
});
Documentation
Client(options)
.postCount(guildCount[, shardCount])
Posts the server count and shard count to our API.
Returns Promise<Object>
.getVotes()
Returns an array of user ids that upvoted your bot in last 12 to 24 hours.
Returns Promise<Array<String>>