wblapi.js

1.0.4 • Public • Published

Installing

npm install wblapi.js

Usage

a) Properly instantiating a new client.

const WblApi = require("wblapi.js");
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)

Name Optional Type Description Default
options.id No String The id of your discord bot. None
options.token No String The WBL API authorization token that belongs to your bot. None

.postCount(guildCount[, shardCount])

Posts the server count and shard count to our API.

Name Optional Type Description Default
guildCount No String(Number) The amount of servers your bot is in. None
shardCount Yes String(Number) The amount of shards your bot has. 1

Returns Promise<Object>

.getVotes()

Returns an array of user ids that upvoted your bot in last 12 to 24 hours.

Returns Promise<Array<String>>

Package Sidebar

Install

npm i wblapi.js

Weekly Downloads

2

Version

1.0.4

License

BSD-3-Clause

Unpacked Size

10.9 kB

Total Files

9

Last publish

Collaborators

  • kyleburnip