1.3.2 • Published 6 months ago

unb-api v1.3.2

Weekly downloads
131
License
MIT
Repository
github
Last release
6 months ago

UnbelievaBoat API

Discord npm npm downloads Open Source Love NPM

Installation

npm install unb-api

Documentation

Full API documentation is located at https://unbelievaboat.com/api/docs

Example

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

const guildID = '305129477627969547';
const userID = '261674810914897931';

client.getUserBalance(guildID, userID).then(user => console.log(user));
client.getGuildLeaderboard(guildID, { sort: 'cash' }).then(lb => console.log(lb));

Constructor

new Client(token, [options])

Options
TypePropertyDescription
StringbaseURL?API hostname. Defaults to https://unbelievaboat.com/api
Numberversion?API version. Defaults to the latest version
NumbermaxRetries?Maximum number of times to retry a request if it's ratelimited. Defaults to 3

Methods

getUserBalance(guild_id, user_id)

Returns: Promise<User>

setUserBalance(guild_id, user_id, { cash, bank }, reason)

Returns: Promise<User>

editUserBalance(guild_id, user_id, { cash, bank }, reason)

Returns: Promise<User>

getGuildLeaderboard(guild_id, [query])
JSON Query Parameters
TypePropertyDescription
Stringsort?Sort the leaderboard by cash, bank or total. Default is total.
Numberlimit?Limit the number of users returned. Default is no limit, unless a page is given then it's 1000.
Numberoffset?Specify the offset of the first user.
Numberpage?Specify the page. If a page is given, the response will be Promise<{ users: User[], totalPages: Number }>

Returns: Promise<User[]>

getGuild(guild_id)

Returns: Promise<Guild>

getApplicationPermission(guild_id)

Returns: Promise<Permission>

Structures

User

TypePropertyDescription
Numberrank?Leaderboard rank of the user. This is only present on getUserBalance() and getGuildLeaderboard()
Stringuser_idUser ID of the discord user.
NumbercashUser's cash balance.
NumberbankUser's bank balance.
NumbertotalUser's total balance.

Guild

TypePropertyDescription
StringidGuild ID.
StringnameGuild name.
NumbericonIcon hash.
NumbericonURLIcon url.
StringownerIDUser ID of the owner.
NumbermemberCountTotal number of members.
StringcurrencySymbolCurrency symbol

Permission

TypePropertyDescription
NumberallowThe allowed bitwise permissions number.
StringjsonJSON representation of the allowed and denied permissions.

Support

Discord Server

1.3.2

6 months ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago