ksoft.js
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -214,3 +214,3 @@ /** | ||
*/ | ||
async bulkCheck(ids, { bannedOnly, moreInfo }) { | ||
async bulkCheck(ids, { bannedOnly, moreInfo, advancedBannedOnly }) { | ||
if (!ids) throw new Error("[Ksoft API] Please specify an array of id's"); | ||
@@ -220,8 +220,19 @@ const options = { users: ids.join(',') }; | ||
if (moreInfo) options.more_info = moreInfo; | ||
try { | ||
const { data } = await this.http.get(`/bans/bulkcheck?${require('querystring').stringify(options)}`); | ||
return data; | ||
} catch (err) { | ||
console.error(err); | ||
let finalResult; | ||
async function getAdvancedBans() { | ||
return await this.http.get(`/bans/bulkcheck?users=${ids.join(',')}&more_info=true`); | ||
} | ||
if (advancedBannedOnly) { | ||
const { data } = await getAdvancedBans.call(this); | ||
const finalResult = data.filter(b => b.is_ban_active); | ||
if (finalResult.length <= 1) throw new Error('there are no bans in the current array'); | ||
return finalResult; | ||
} else { | ||
try { | ||
const { data } = await this.http.get(`/bans/bulkcheck?${require('querystring').stringify(options)}`); | ||
return data; | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
} | ||
@@ -228,0 +239,0 @@ |
{ | ||
"name": "ksoft.js", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Official API Wrapper for KSoft.Si API, written in Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -94,2 +94,3 @@ # ksoft.js | ||
bannedOnly: Boolean, | ||
advancedBannedOnly: Boolean, | ||
}); | ||
@@ -96,0 +97,0 @@ ``` |
82568
990
195