1.0.4 • Published 4 years ago

wblapi.js v1.0.4

Weekly downloads
1
License
BSD-3-Clause
Repository
github
Last release
4 years ago

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)

.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>>