Skip to content

Releases: wzhouwzhou/discordblacklist

Discordblacklist 2.0.1

17 Dec 18:08
Compare
Choose a tag to compare

Discordblacklist 2.0.1

Changes since 2.0.0

This release adds examples for different frameworks and libraries, notably /Klasa/events/DBANS-detection


NPM version NPM downloads Build Status Dependencies Paypal

Discordblacklist

The Featured Nodejs package that facilitates getting banned Discord users from DiscordBans.

Installing via NPM.

$ npm install --save discordblacklist

or to use JSON only for stringifying/serializing (more info below)

$ npm install --save discordblacklist --no-optional

Note: Version 2.x API has changed from version 1.x to support DiscordBans v3 api. Version 2.x is not backwards compatible with version 1.x code. Package dependencies have also been updated so make sure you npm install properly.

The following contains documentation for discordblacklist 2.0.0, read the 1.0.7 (the latest 1.x) documentation here

Quickstart:

// Create the object (which autorefreshes the banlist every 120 minutes)
const { Blacklist } = require('discordblacklist');
const token = 'My-token';
const blacklist = new Blacklist({ token, update: true });

// Update the blacklist.
await blacklist.update();

// Someone's id to test
const someID = '1234567890';

// Check if they are on the banlist - Returns either null or the BannedUser.
let user = blacklist.lookup(someID);

// Get the full list in string JSON form. Must be used after update() has completed
const jsonified = blacklist.banstore.stringify(-1, true);
console.log(jsonified);

// If you installed optional dependencies (erlpack) use this.
const bufferstring = blacklist.banstore.stringify(-1, false);
console.log(bufferstring);

// If you want an Array of BannedUser objects
const array = blacklist.banstore.array();

// The first user on the banlist
const banneduser = array[0];
const sameBanneduser = blacklist.banstore.get('1');
console.log(banneduser);

Setup and functions.

Exports:

require('discordblacklist') will return an Object with several keys: Blacklist, Errors, BanStore, and Constants.

The Blacklist class can be set with

const { Blacklist } = require('discordblacklist');

There are several ways to create an object from it, here's the simplest:

const apiToken = '12345'; // Replace with actual token
const blacklist = new Blacklist(apiToken);

Get a token here.

To update the list Manually

const newlist = await blacklist.update();

To get the list quickly without updating unless the internal cache was deleted blacklist.fetchBanlist();

const list = await blacklist.fetchBanlist();

list and newList will contain a object which is a collection of BannedUser objects mapped by their banID. BannedUser objects have an id (userid), tag (discord tag), banID, bannedFor (reason), prooflink.

Used normally (i.e. caching enabled), BanStores will always be stored inside blacklist.banstore

To strip any class data and just get them in pure object form just run .serialize() or .serialize(), and to stringify them or .stringify().

It is recommended you update your ban list every two hours

You can have the blacklist autoupdate at the recommended time like so:

const banlist = new Blacklist({ token: 'something', update: true });

to customise the timer length (180 minutes in this example):

const banlist = new Blacklist({ token: 'something', update: 180 });

to be completely explicit:

const banlist = new Blacklist({
  token: 'something',
  update: {
    autoupdate: true,
    minutes: 180,
  }
});

Looking up users.

Convenience shortcut (only works after if banlist has been fetched and cached):

blacklist.lookup('id');

'id' is the userid of the user you want to check. This returns either a BannedUser or null depending on if the user is on the ban list.

Clearing and resetting your auto-updater

To clear the autoupdater simply call banlist.stopUpdateTimer();. To then set a new one do banlist.setUpdateTimer(minutes) where minutes is an number.

Changing token

If for whatever reason you would like to switch tokens, you can do that easily by calling.
banlist.changeToken('newtoken');

Official examples for various frameworks and libraries are stored in the examples folder, visit the link to read more about them.

This work is ©Copyright under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3. See LICENSE for more details.

Further Documentation:

https://discordblacklist.willyz.cf/

Enjoy this package? Consider starring on github and checking out some of my other work:

Youtube Search API

Chips Discord Bot

Discordblacklist 2.0.0

30 Nov 01:54
771bd0c
Compare
Choose a tag to compare

NPM version NPM downloads Build Status Dependencies Paypal

Discordblacklist

The Featured Nodejs package that facilitates getting banned Discord users from DiscordBans.

Installing via NPM.

$ npm install --save discordblacklist

or to use JSON only for stringifying/serializing (more info below)

$ npm install --save discordblacklist --no-optional

Note: Version 2.x API has changed from version 1.x to support DiscordBans v3 api. Version 2.x is not backwards compatible with version 1.x code. Package dependencies have also been updated so make sure you npm install properly.

The following contains documentation for discordblacklist 2.0.0, read the 1.0.7 (the latest 1.x) documentation here

Quickstart:

// Create the object (which autorefreshes the banlist every 120 minutes)
const { Blacklist } = require('discordblacklist');
const token = 'My-token';
const blacklist = new Blacklist({ token, update: true });

// Update the blacklist.
await blacklist.update();

// Someone's id to test
const someID = '1234567890';

// Check if they are on the banlist - Returns either null or the BannedUser.
let user = blacklist.lookup(someID);

// Get the full list in string JSON form. Must be used after update() has completed
const jsonified = blacklist.banstore.stringify(-1, true);
console.log(jsonified);

// If you installed optional dependencies (erlpack) use this.
const bufferstring = blacklist.banstore.stringify(-1, false);
console.log(bufferstring);

// If you want an Array of BannedUser objects
const array = blacklist.banstore.array();

// The first user on the banlist
const banneduser = array[0];
const sameBanneduser = blacklist.banstore.get('1');
console.log(banneduser);

Setup and functions.

Exports:

require('discordblacklist') will return an Object with several keys: Blacklist, Errors, BanStore, and Constants.

The Blacklist class can be set with

const { Blacklist } = require('discordblacklist');

There are several ways to create an object from it, here's the simplest:

const apiToken = '12345'; // Replace with actual token
const blacklist = new Blacklist(apiToken);

Get a token here.

To update the list Manually

const newlist = await blacklist.update();

To get the list quickly without updating unless the internal cache was deleted blacklist.fetchBanlist();

const list = await blacklist.fetchBanlist();

list and newList will contain a object which is a collection of BannedUser objects mapped by their banID. BannedUser objects have an id (userid), tag (discord tag), banID, bannedFor (reason), prooflink.

Used normally (i.e. caching enabled), BanStores will always be stored inside blacklist.banstore

To strip any class data and just get them in pure object form just run .serialize() or .serialize(), and to stringify them or .stringify().

It is recommended you update your ban list every two hours

You can have the blacklist autoupdate at the recommended time like so:

const banlist = new Blacklist({ token: 'something', update: true });

to customise the timer length (180 minutes in this example):

const banlist = new Blacklist({ token: 'something', update: 180 });

to be completely explicit:

const banlist = new Blacklist({
  token: 'something',
  update: {
    autoupdate: true,
    minutes: 180,
  }
});

Looking up users.

Convenience shortcut (only works after if banlist has been fetched and cached):

blacklist.lookup('id');

'id' is the userid of the user you want to check. This returns either a BannedUser or null depending on if the user is on the ban list.

Clearing and resetting your auto-updater

To clear the autoupdater simply call banlist.stopUpdateTimer();. To then set a new one do banlist.setUpdateTimer(minutes) where minutes is an number.

Changing token

If for whatever reason you would like to switch tokens, you can do that easily by calling.
banlist.changeToken('newtoken');

This work is ©Copyright under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3. See LICENSE for more details.

Further Documentation:

https://wzhouwzhou.github.io/discordblacklist/

Enjoy this package? Consider starring on github and checking out some of my other work:

Youtube Search API

Chips Discord Bot

Discordblacklist 2.0.0-rc

29 Nov 04:18
Compare
Choose a tag to compare
Pre-release

Discordblacklist 2.0.0

The Featured Nodejs package that facilitates getting banned Discord users from DiscordBans.

Installing via NPM.

$ npm install --save discordblacklist@2.0.0-rc

or to use JSON only for stringifying/serializing (more info below)

$ npm install --save discordblacklist@2.0.0-rc --no-optional

Note: Version 2.x API has changed from version 1.x to support DiscordBans v3 api. Version 2.x is not backwards compatible with version 1.x code. Package dependencies have also been updated so make sure you npm install properly.

The following contains documentation for discordblacklist 2.0.0, read the 1.0.7 (the latest 1.x) documentation here

Quickstart:

// Create the object (which autorefreshes the banlist every 120 minutes)
const { Blacklist } = require('discordblacklist');
const token = 'My-token';
const blacklist = new Blacklist({ token, update: true });

// Update the blacklist.
await blacklist.update();

// Someone's id to test
const someID = '1234567890';

// Check if they are on the banlist - Returns a true/false , or throws an error if an error occurred.
let isOnTheBanList = blacklist.lookup(someID);

// Get the full list in string JSON form. Must be used after update() has completed
const jsonified = blacklist.banstore.stringify(true);
console.log(jsonified);

// If you installed optional dependencies (erlpack) use this.
const bufferstring = blacklist.banstore.stringify(false);
console.log(bufferstring);

// If you want an Array of BannedUser objects
const array = blacklist.banstore.array();

Setup and functions.

Exports:

require('discordblacklist') will return an Object with several keys: Blacklist, Errors, BanStore, and Constants.

The Blacklist class can be set with

const { Blacklist } = require('discordblacklist');

There are several ways to create an object from it, here's the simplest:

const apiToken = '12345'; // Replace with actual token
const blacklist = new Blacklist(apiToken);

Get a token here.

To update the list Manually

const newlist = await blacklist.update();

To get the list quickly without updating unless the internal cache was deleted blacklist.fetchBanlist();

const list = await blacklist.fetchBanlist();

list and newList will contain a object which is a collection of BannedUser objects mapped by their banID. BannedUser objects have an id (userid), tag (discord tag), banID, bannedFor (reason), prooflink.
To strip any class data and just get them in pure object form just run .serialize() or .serialize(), and to stringify them or .stringify().




It is recommended you update your ban list every two hours

You can have the blacklist autoupdate at the recommended time like so:

const banlist = new Blacklist({ token: 'something', update: true });

to customise the timer length (180 minutes in this example):

const banlist = new Blacklist({ token: 'something', update: 180 });

to be completely explicit:

const banlist = new Blacklist({
  token: 'something',
  update: {
    autoupdate: true,
    minutes: 180,
  }
});

Clearing and resetting your auto-updater

To clear the autoupdater simply call banlist.stopUpdateTimer();. To then set a new one do banlist.setUpdateTimer(minutes) where minutes is an number.

Looking up users.

Convenience shortcut (only works if banlist has been fetched and cached):
blacklist.lookup('id') where id is the userid of the user you want to check. This returns a boolean depending on if the user is on the ban list.

Changing token

If for whatever reason you would like to switch tokens, you can do that easily by calling.
banlist.changeToken('newtoken');

This work is ©Copyright under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3. See LICENSE for more details.

Further Documentation:

https://wzhouwzhou.github.io/discordblacklist/

Enjoy this package? Consider checking out some of my other work:

ytsearcher

Chips Discord Bot

1.0.7

08 Aug 20:58
Compare
Choose a tag to compare

discordblacklist

A nodejs package that facilitates getting banned Discord users from DiscordBans

Changes in this release

Bug Fixes

  • Bug fix regarding errors with array()

Full Documentation:

Installing via NPM.

$ npm install discordblacklist

Setup and functions.

Creating the object:

const Blacklist = require('discordblacklist'),
banlist = new Blacklist('token');

Get a token here.



The object will try to update its banlist on creation, however you can update the list manually at any time.




To update the ban list manually:
banlist.update();

This returns a promise, and you can get the ban list from it with either the thenable or banlist.list or the thenable of banlist.array().



It is recommended you update your ban list every two hours



You can have the blacklist autoupdate the list like so:



const banlist = new Blacklist('token', true, 2*60);



To specify your own auto-update interval, create your object like so:



new Blacklist('token', true, minutes);

Clearing and resetting your auto-updater



To clear the autoupdater simply call banlist.stopUpdateTimer();. To then set a new one do banlist.setUpdateTimer(minutes).

Looking up users.



banlist.lookup("id") where id is the userid of the user you want to check. This returns a boolean depending on if the user is on the ban list.

Changing token



If for whatever reason you would like to switch tokens mid-execution, you can do that easily by calling
banlist.changeToken('newtoken');


Summary example:

//Create the object (which autorefreshes the banlist every 120 minutes)
const Blacklist = require('discordblacklist');
let banlist = new Blacklist('token', true, 120);

//Someone's id to test
const someID = '1234567890';

//Check if they are on the banlist - Returns a true/false , or throws an error if an error occurred.
let isOnTheBanList = banlist.lookup(someID);

//Get the full list in string form. Must be used after update() has completed
console.log(banlist.list);

//Promise resolves the full list as an array. Can be called before update() is completed. Await will throw an error if an error occurred.
console.log(await banlist.array());

1.0.5

06 Jul 20:59
Compare
Choose a tag to compare

discordblacklist

A nodejs package that facilitates getting banned Discord users from DiscordBans

Changes in this release

Bug Fixes

  • Bug fix regarding improper formatting with banlist.list
  • Bug fix regarding inabilities to set a new timer after clearing an old one.

New Additions

await banlist.array() which returns a converts the banlist into an array of string ids of banned users.

Full Documentation:

Installing via NPM.

$ npm install discordblacklist

Setup and functions.

Creating the object:

const Blacklist = require('discordblacklist'),
banlist = new Blacklist('token');

Get a token here.



The object will try to update its banlist on creation, however you can update the list manually at any time.




To update the ban list manually:
banlist.update();

This returns a promise, and you can get the ban list from it with either the thenable or banlist.list or the thenable of banlist.array().



It is recommended you update your ban list every two hours



You can have the blacklist autoupdate the list like so:



const banlist = new Blacklist('token', true, 2*60);



To specify your own auto-update interval, create your object like so:



new Blacklist('token', true, minutes);

Clearing and resetting your auto-updater



To clear the autoupdater simply call banlist.stopUpdateTimer();. To then set a new one do banlist.setUpdateTimer(minutes).

Looking up users.



banlist.lookup("id") where id is the userid of the user you want to check. This returns a boolean depending on if the user is on the ban list.

Changing token



If for whatever reason you would like to switch tokens mid-execution, you can do that easily by calling
banlist.changeToken('newtoken');


Summary example:

//Create the object (which autorefreshes the banlist every 120 minutes)
const Blacklist = require('discordblacklist');
let banlist = new Blacklist('token', true, 120);

//Someone's id to test
const someID = '1234567890';

//Check if they are on the banlist - Returns a true/false , or throws an error if an error occurred.
let isOnTheBanList = banlist.lookup(someID);

//Get the full list in string form. Must be used after update() has completed
console.log(banlist.list);

//Promise resolves the full list as an array. Can be called before update() is completed. Await will throw an error if an error occurred.
console.log(await banlist.array());

1.0.4

17 Jun 03:43
Compare
Choose a tag to compare

Image

--Text Version--

discordblacklist

A nodejs package that facilitates getting banned Discord users from DiscordBans

Installing via NPM.

$ npm install discordblacklist

Setup and functions.

Creating the object:

const Blacklist = require('discordblacklist'),
banlist = new Blacklist('token');

Get a token here.



The object will try to update its banlist on creation, however you can update the list manually at any time.




To update the ban list manually:
banlist.update();

This returns promise, and you can get the ban list from it with either the thenable or banlist.list.



It is recommended you update your ban list every two hours



You can have the blacklist autoupdate the list like so:



const banlist = new Blacklist('token', true, 2*60);



To specify your own auto-update interval, create your object like so:



new Blacklist('token', true, minutes);

Clearing and resetting your auto-updater



To clear the autoupdater simply call banlist.stopUpdateTimer();. To then set a new one do banlist.setUpdateTimer(minutes).

Looking up users.



banlist.lookup("id") where id is the userid of the user you want to check. This returns a boolean depending on if the user is on the ban list.

Changing token



If for whatever reason you would like to switch tokens mid-execution, you can do that easily by calling
banlist.changeToken('newtoken');


Summary example:

//Create the object (which autorefreshes the banlist every 120 minutes)
const Blacklist = require('discordblacklist');
let banlist = new Blacklist('token', true, 120);

//Someone's id to test
const someID = '1234567890';

//Check if they are on the banlist
let isOnTheBanList = banlist.lookup(someID);

//Get the full list
console.log(banlist.list);

Initial Release

17 Jun 02:25
Compare
Choose a tag to compare

Npm: Click

discordblacklist

A nodejs package that facilitates getting banned Discord users from DiscordBans

Installing via NPM.

$ npm install discordblacklist

Setup and functions.

Creating the object:

const Blacklist = require('discordblacklist'),
banlist = new Blacklist('token');

Get a token here



To update the ban list:
banlist.update();

This returns promise, and you can get the ban list from it with either the thenable or banlist.list.



It is recommended you update your ban list every two hours



You can have the blacklist autoupdate the list like so:



const banlist = new Blacklist('token', true, 2*60);



To specify your own auto-update interval, create your object like so:



new Blacklist('token', true, minutes);

Clearing and resetting your auto-updater



To clear the autoupdater simply call banlist.stopUpdateTimer();. To then set a new one do banlist.setUpdateTimer(minutes).

Looking up users.



banlist.lookup("id") where id is the userid of the user you want to check. This returns a boolean depending on if the user is on the ban list.

Changing token



If for whatever reason you would like to switch tokens mid-execution, you can do that easily by calling
banlist.changeToken('newtoken');