ksoft.js
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -52,2 +52,21 @@ /** | ||
* @prop {Number} current_timestamp Current timestamp of update | ||
* | ||
* @typedef {Object} bulkCheckResponse The response of bans.bulkCheck | ||
* @prop {Number} id The id of the user the response is for | ||
* @prop {String} name The name of the user the response is for | ||
* @prop {String} discriminator The discriminator the response if for | ||
* @prop {Number} moderator_id The moderator id | ||
* @prop {String} reason The reason for the ban | ||
* @prop {String} proof The proof for the ban | ||
* @prop {Boolean} is_ban_active Whether or not the ban is active | ||
* @prop {Boolean} can_be_appealed Whether or not the ban can be appealed | ||
* @prop {String} timestamp The timestamp for the ban | ||
* @prop {String|null} appeal_reason The appeal reason if there is one | ||
* @prop {String|null} appeal_date The appeal date | ||
* @prop {Boolean} exists Whether or not the ban exists | ||
* | ||
* @typedef {Object} simpleBanInfo the simple response of bans.bulkCheck | ||
* @prop {Number} id The id the response is for | ||
* @prop {Boolean} is_ban_active Whether or not the ban is active | ||
* @prop {Boolean} exists Wether or not the ban is active | ||
*/ | ||
@@ -189,2 +208,21 @@ | ||
} | ||
/** | ||
* | ||
* @param {Array<String>} ids Array of id's to check | ||
* @prop {Boolean} bannedOnly Whether or to return an array of the id's of the people that are banned in that array of id's | ||
* @prop {Boolean} moreInfo Whether to return the full ban object if the person is banned | ||
* @returns {Promise<Array<bulkCheckResponse|simpleBanInfo>>} BulkCheck response | ||
*/ | ||
async bulkCheck(ids, { bannedOnly, moreInfo }) { | ||
if (!ids) throw new Error("[Ksoft API] Please specify an array of id's"); | ||
const options = { users: ids.join(',') }; | ||
if (bannedOnly) options.banned_only = bannedOnly; | ||
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); | ||
} | ||
} | ||
}; | ||
@@ -191,0 +229,0 @@ |
{ | ||
"name": "ksoft.js", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Official API Wrapper for KSoft.Si API, written in Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -90,2 +90,9 @@ # ksoft.js | ||
```javascript | ||
ksoft.bans.bulkCheck(ids, { | ||
moreInfo: Boolean, | ||
bannedOnly: Boolean, | ||
}); | ||
``` | ||
### Kumo Api | ||
@@ -92,0 +99,0 @@ |
81144
960
187