Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unb-api

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unb-api - npm Package Compare versions

Comparing version 1.0.2 to 1.0.4

2

package.json
{
"name": "unb-api",
"version": "1.0.2",
"version": "1.0.4",
"description": "API wrapper for UnbelievaBoat Discord Bot API",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -17,3 +17,3 @@ # UnbelievaBoat API

```javascript
const {Client} = require('unb-api');
const { Client } = require('unb-api');
const client = new Client('TOKEN'); // Get your API token from https://unb.pizza/api/docs

@@ -20,0 +20,0 @@

@@ -28,3 +28,4 @@ const request = require('request');

if (!user_id) throw new Error('user_id must be specified');
return this._request('GET', `guilds/${guild_id}/users/${user_id}`).then(data => new User(data));
return this._request('GET', `guilds/${guild_id}/users/${user_id}`)
.then(data => new User(data));
}

@@ -39,5 +40,6 @@

* @param {number|string} [bank] Value to set the bank balance to
* @param {string} [reason] Reason for the audit log
* @returns {Promise<User>}
*/
setUserBalance(guild_id, user_id, {cash, bank}) {
setUserBalance(guild_id, user_id, { cash, bank } = {}, reason) {
if (!guild_id) throw new Error('guild_id must be specified');

@@ -48,3 +50,4 @@ if (!user_id) throw new Error('user_id must be specified');

if (bank === Infinity) bank = 'Infinity';
return this._request('PUT', `guilds/${guild_id}/users/${user_id}`, {cash, bank}).then(data => new User(data));
return this._request('PUT', `guilds/${guild_id}/users/${user_id}`, { cash, bank, reason })
.then(data => new User(data));
}

@@ -59,5 +62,6 @@

* @param {number|string} [bank] Value to increase/decrease the bank balance by
* @param {string} [reason] Reason for the audit log
* @returns {Promise<User>}
*/
editUserBalance(guild_id, user_id, {cash, bank}) {
editUserBalance(guild_id, user_id, { cash, bank } = {}, reason) {
if (!guild_id) throw new Error('guild_id must be specified');

@@ -68,3 +72,4 @@ if (!user_id) throw new Error('user_id must be specified');

if (bank === Infinity) bank = 'Infinity';
return this._request('PATCH', `guilds/${guild_id}/users/${user_id}`, {cash, bank}).then(data => new User(data));
return this._request('PATCH', `guilds/${guild_id}/users/${user_id}`, { cash, bank, reason })
.then(data => new User(data));
}

@@ -80,3 +85,4 @@

if (!guild_id) throw new Error('guild_id must be specified');
return this._request('GET', `guilds/${guild_id}/users`).then(data => data.map(user => new User(user)));
return this._request('GET', `guilds/${guild_id}/users`)
.then(data => data.map(user => new User(user)));
}

@@ -96,8 +102,5 @@

const options = {
headers: {
Authorization: this.token,
'Content-Type': 'application/json'
},
headers: { Authorization: this.token, 'Content-Type': 'application/json' },
uri: `${this.baseURL}/${this.version ? `${this.version} /` : ''}${endpoint}`,
method,
method: method,
json: data

@@ -108,7 +111,6 @@ };

if (err) return reject(err);
if (res.statusCode === 200) {
resolve(body);
} else {
reject(body.error ? body.error : `${res.statusCode}: ${res.statusMessage}`);
reject(new Error(body && body.error ? body.error + ' - ' + body.message : `${res.statusCode}: ${res.statusMessage}`));
}

@@ -115,0 +117,0 @@ });

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