New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discordblacklist

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discordblacklist - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

34

lib/blacklist.js
const needle = require('needle'),
version = '1.0.4',
repo = 'https://github.com/wzhouwzhou/discordblacklist/';
version = require('../package.json').version,
repo = require('../package.json').github,
apiUrl = 'https://bans.discordlist.net/api';

@@ -27,2 +28,3 @@ module.exports = class Blacklist {

if(isValidTimer(mins)){
this.minutes = mins;
let ms = mins * 60 * 1000;

@@ -38,2 +40,5 @@ this.autoupdate = true;

clearInterval(this.autoupdateTimer);
this.autoupdate = false;
this.autoupdateTimer = null;
this.minutes = -1;
return true;

@@ -56,8 +61,21 @@ }

if (!this.list) throw ('Call update() before looking up users.');
if(typeof id == 'string'){
if(~this.list.indexOf(id)) return (true);
return (false);
if (typeof id == 'string'){
if(~this.list.indexOf(id)) return true;
return false;
}
throw('Invalid user id given');
}
array () {
return new Promise( async (res, rej) => {
try{
if(!this.list) await update();
}catch(err) { rej(err); };
let arr = [];
for(e of this.list.replace(/^\[|\]$/g,'').split(','))
arr.push(JSON.parse(e)[0]);
res(arr);
});
}
};

@@ -67,3 +85,3 @@

if (!token || token=='') reject('Invalid Token: You must set a valid token!');
needle.post('https://bans.discordlist.net/api',
needle.post(apiUrl,
{ "token": token },

@@ -82,3 +100,3 @@ {

else
res (response.body.replace(' ', ''));
res (response.body.replace(/\s+/g, ''));
}

@@ -89,2 +107,2 @@ }

const isValidTimer = (minutes) => typeof minutes == 'number' && !isNaN(minutes) && minutes > 0;
const isValidTimer = (minutes) => (+minutes)===minutes&&minutes===(minutes|0)&&minutes>0;
{
"name": "discordblacklist",
"version": "1.0.4",
"version": "1.0.5",
"description": "A nodejs package that facilitates getting banned Discord users from DiscordBans",

@@ -24,2 +24,3 @@ "main": "index.js",

"homepage": "https://github.com/wzhouwzhou/discordblacklist#readme",
"github": "https://github.com/wzhouwzhou/discordblacklist",
"dependencies": {

@@ -26,0 +27,0 @@ "needle": "^1.6.0"

@@ -1,4 +0,2 @@

![Image](http://i.imgur.com/12c5HpD.png)
--Text Version--
# discordblacklist

@@ -23,3 +21,3 @@ ## A nodejs package that facilitates getting banned Discord users from DiscordBans

This returns promise, and you can get the ban list from it with either the thenable or `banlist.list`.
This returns promise, and you can get the ban list from it with either the thenable or `banlist.list` or `banlist.array()`.
<br></br>

@@ -62,3 +60,6 @@ **It is recommended you update your ban list every two hours**

//Get the full list
//Get the full list in string form
console.log(banlist.list);
//Get the full list as an array
console.log(banlist.array());
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc