1.4.1 • Published 3 years ago

blwebhooks-beta v1.4.1

Weekly downloads
7
License
ISC
Repository
github
Last release
3 years ago

Known Vulnerabilities npm version dependencies Status install size npm.io

NPM

BLWebhooks, The Next Gen Vote Hooks!

Installation

Need Any Help Setting It Up? Join Our Support Server.

It's intended to be used with discord.js v12.

BLWebhooks fully supports external and discord.js internal sharding, make sure to enable the Upcoming Sharded Client Module.

NPM (recommended)

npm i blwebhooks --save

Yarn

yarn add blwebhooks

Supported Lists

top.gg InfinityBotList VoidBots DiscordLabs Botrix Blist - Support Next Update

Usage

Import the lib via ES6 or commonJS modules

// ES6
import * as blwebhooks from "blwebhooks";
// or commonJS
const blwebhooks = require("blwebhooks");

With discord.js

const discord = require("discord.js");
const client = discord.Client();

const blwebhooks = require("blwebhooks");

// Attatch The Client and Port to the module.
// The client is it attaching to the client, 80 is the port it will run on
const bl = new blwebhooks.Client(client, 80);

Turn On Sharding Support

// This will enable the extended logging, this is mainly for debugging purposes
bl.shardedClient(true);

Turn On Extended Security

// This will enable bruteforce protection for module, once enabled
// it will start the protection also using more CPU.
bl.extraProtection(true);

Turn On Proxy Trust

// Enable this option is you use this behind a proxy like
// Heroku services etc
bl.proxyTrust(true);

Emit Test Vote Events

// Emit a test event to test your Voted Event
bl.testVote(userID, botID);

Vote Hooks

TopGG Vote Hooks:

// This will listen to votes from top.gg, the url is the end not
// including the / and auth is the webhook auth. You can enable and
// disable using true or false at the end
const topgg = bl.topggVoteHook(url, auth, true);

// This code will run after a new vote was received from top.gg
BLWEvent.on('topgg-voted', async function (UserID, botID, type) {
  console.log(userID)
})

InfinityBotList Vote Hooks:

// This will listen to votes from InfinityBotList, the url is the end not
// including the / and auth is the webhook auth. You can enable and
// disable using true or false at the end
const InfinityBotList = bl.IBLVoteHook(url, auth, true);

// This code will run after a new vote was received from InfinityBotList
BLWEvent.on('IBL-voted', async function (userID, botID, type, timeStamp) {
  console.log(userID)
})

VoidBots Vote Hooks:

// This will listen to votes from VoidBots, the url is the end not
// including the / and auth is the webhook auth. You can enable and
// disable using true or false at the end
const VoidBots = bl.VoidBotsVoteHook(url, auth, true);

// This code will run after a new vote was received from VoidBots
BLWEvent.on('VB-voted', async function (userID, botID) {
  console.log(userID + " Voted For " + botID)
})

DiscordLabs Vote Hooks:

// This will listen to votes from DiscordLabs, the url is the end not
// including the / and auth is the webhook auth. You can enable and
// disable using true or false at the end
const DiscordLabs = bl.DiscordLabsVoteHook(url, auth, true);

// This code will run after a new vote was received from DiscordLabs
BLWEvent.on('DL-voted', async function (userID, botID, wasTest) {
  console.log(`${userID} Voted For ${botID}. Was Test: ${wasTest}`)
})

Botrix Vote Hooks:

// This will listen to votes from Botrix, the url is the end not
// including the / and auth is the webhook auth. You can enable and
// disable using true or false at the end
const Botrix = bl.BotrixVoteHook(url, auth, true);

// This code will run after a new vote was received from Botrix
BLWEvent.on('BTR-voted', async function (userID, botID) {
  console.log(`${userID} Voted For ${botID}.`)
})

Events

Global Voted Event

// This will run after any vote has been received, use this if you don't want seprate events for each list
BLWEvent.on('vote', async function (userID, botID, List) {
  console.log(`${userID} Voted For ${botID} on ${List}`)
})

Vote Expired Event

// This will run after the vote expires, this will be different for each list
BLWEvent.on('vote-expired', async function (userID, botID, List) {
  console.log(userID)
})

Error Event

// This code will run in the event of a error, normally it will just console.log the error but you can add custom error events here
BLWEvent.on('error', async function (error) {
  console.log(userID)
})