BLWebhooks, The Next Gen Vote Hooks!
Table of Contents
Installation
Need Any Help Setting It Up? Join Our Support Server.
It's intended to be used with discord.js v14.
BLWebhooks fully supports external and discord.js internal sharding, make sure to enable the Sharded Client Option.
BLWebhooks is maintained and supported by the JMServices Team.
NPM (recommended)
# Stable
npm i --save blwebhooks
# Nightly Builds
npm i --save blwebhooks@nightly
Yarn
# Stable
yarn add blwebhooks
# Nightly Builds
yarn add blwebhooks@nightly
Supported Libraries
Name | Features |
---|
discord.js | DATABASE , EXPRESS , HOOKS , SECURITY |
Eris | EXPRESS , HOOKS , SECURITY |
Supported Lists
Name | Features | UserID | BotID | userName | Event Name |
---|
top.gg | DATABASE , HOOKS | true | true | false | topgg-voted |
InfinityBotList | DATABASE , HOOKS | true | true | false | IBL-voted |
VoidBots | DATABASE , HOOKS | true | true | false | VB-voted |
DiscordLabs | DATABASE , HOOKS | true | true | false | DL-voted |
Blist | DATABASE , HOOKS | true | true | false | BLT-voted |
DiscordBots.co | DATABASE , HOOKS | true | true | false | DBC-voted |
ParadiseBotList | DATABASE , HOOKS | true | true | true | PBL-voted |
Future Lists
Name | Features | ETA |
---|
Botrix | DATABASE , HOOKS | N/A |
Usage
Import the lib via ES6 or commonJS modules
import * as blwebhooks from "blwebhooks";
const blwebhooks = require("blwebhooks");
With discord.js
const { Client } = require("discord.js");
const client = new Client({
intents: []
});
const { WebhooksManager } = require("blwebhooks");
const voteClient = new WebhooksManager(client, 80, {
database: "none",
protocol: "discordjs",
string: "mongodb://",
extra: {
extraLogging: false,
extraProtection: true,
proxyTrust: false,
},
});
client.voteManager = voteClient;
With Eris
const Eris = require("eris");
var bot = new Eris("BOT_TOKEN");
bot.on("ready", () => {
console.log("Ready!");
});
const { WebhooksManager } = require("blwebhooks");
const voteClient = new WebhooksManager(bot, 80, {
database: "none",
protocol: "eris",
string: "mongodb://",
extra: {
extraLogging: false,
extraProtection: true,
proxyTrust: false,
},
});
bot.voteManager = voteClient;
bot.connect();
Vote Storage
const voteClient = new WebhooksManager(client, 80, {
database: "mongoose",
string: "mongooseDB-URL",
extra: {
extraLogging: false,
extraProtection: true,
proxyTrust: false,
},
});
For usage on pulling data see the Database Vote Section.
Extended Security
const voteClient = new WebhooksManager(client, 80, {
database: "mongoose",
string: "mongooseDB-URL",
extra: {
extraLogging: false,
extraProtection: true,
proxyTrust: false,
},
});
Proxy Trust
const voteClient = new WebhooksManager(client, 80, {
database: "mongoose",
string: "mongooseDB-URL",
extra: {
extraLogging: false,
extraProtection: true,
proxyTrust: true,
},
});
Test Events
voteClient.testVote(userID, botID);
Vote Hooks
TopGG Vote Hooks:
client.voteManager.topggVoteHook(url, auth, true);
client.on("topgg-voted", async function (userID, botID, type) {
console.log(userID);
});
InfinityBotList Vote Hooks:
client.voteManager.IBLVoteHook(url, auth, true);
client.on("IBL-voted", async function (userID, botID, type) {
console.log(userID);
});
VoidBots Vote Hooks:
client.voteManager.VoidBotsVoteHook(url, auth, true);
client.on("VB-voted", async function (userID, botID) {
console.log(userID + " Voted For " + botID);
});
DiscordLabs Vote Hooks:
client.voteManager.DiscordLabsVoteHook(url, auth, true);
client.on("DL-voted", async function (userID, botID, wasTest) {
console.log(`${userID} Voted For ${botID}. Was Test: ${wasTest}`);
});
Botrix Vote Hooks:
client.voteManager.BotrixVoteHook(url, auth, true);
client.on("BTR-voted", async function (userID, botID) {
console.log(`${userID} Voted For ${botID}.`);
});
BList Vote Hooks:
client.voteManager.BListVoteHook(url, auth, true);
client.on("BLT-voted", async function (userID, botID) {
console.log(`${userID} Voted.`);
});
DiscordBots.co Vote Hooks:
client.voteManager.DBCVoteHook(url, auth, true);
client.on("DBC-voted", async function (userID, botID) {
console.log(`${userID} Voted.`);
});
ParadiseBotList Vote Hooks:
client.voteManager.PBLVoteHook(url, auth, true);
client.on("PBL-voted", async function (userID, botID, userName) {
console.log(`${userName} (${userID}) Voted For <#${botID}>`);
});
Events
Global Voted Event
client.on("vote", async function (userID, botID, List) {
console.log(`${userID} Voted For ${botID} on ${List}`);
});
Vote Expired Event
client.on("vote-expired", async function (userID, botID, List) {
console.log(userID);
});
Error Event
client.on("webhookError", async function (error) {
console.log(userID);
});
Vote Database
The vote Database feature will save the total votes a User had made for your bot / server, it will add all the vote in a database and the methods below show you how to set it up and pull data.
discord.js example
voteClient.setStroage(DB, String);
voteClient.setStroage("mongo", "mongodb://localhost/my_database");
voteClient.setStroage("sqlite");
Pulling User Votes
voteClient.getVotes(userID, option);
Options:
daily
- Get Daily Votes
weekly
- Get Weekly Votes
monthly
- Get Monthly Votes
Our Projects
- DPost (This Is A Work In Progress, Beta Out Now!)