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

unb-api

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unb-api

API wrapper for UnbelievaBoat Discord Bot API

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125
decreased by-44.69%
Maintainers
0
Weekly downloads
 
Created
Source

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 rate-limited. Defaults to 3

Methods

Economy

getUserBalance(guildId: string, userId: string)
Returns: Promise<User>

setUserBalance(guildId: string, userId: string, balance: Balance, reason?: string)
Returns: Promise<User>

editUserBalance(guildId: string, userId: string, balance: Balance, reason?: string)
Returns: Promise<User>

getGuildLeaderboard(guildId: string, query?: ListOptions)
Returns: Promise<User[]> | Promise<{ users: User[], totalPages: number }>

[!NOTE]
If the query for getGuildLeaderboard includes a page parameter, the response will be an object containing both users and totalPages.
Otherwise, it will return a simple array of User[].

Generic

getGuild(guildId: string)
Returns: Promise<Guild>

getApplicationPermission(guildId: string)
Returns: Promise<Permission>

Items

getItems(guildId: string, options?: ListOptions)
Returns: Promise<{ page: number, totalPages: number, items: StoreItem[] }>

getItem(guildId: string, itemId: string)
Returns: Promise<StoreItem>

createItem(guildId: string)
Returns: Promise<StoreItem>

editItem(guildId: string, itemId: string, data: StoreItem | object, options?: { cascadeUpdate?: boolean })
Returns: Promise<StoreItem>

deleteItem(guildId: string, itemId: string)
Returns: Promise<any>

getInventoryItems(guildId: string, userId: string, options?: ListOptions)
Returns: Promise<{ page: number, totalPages: number, items: InventoryItem[] }>

getInventoryItem(guildId: string, userId: string, itemId: string)
Returns: Promise<InventoryItem>

addInventoryItem(guildId: string, userId: string, itemId: string, quantity?: string | number, options?: { inventoryUserId?: string })
Returns: Promise<InventoryItem>

removeInventoryItem(guildId: string, userId: string, itemId: string, quantity?: string | number)
Returns: Promise<any>

ListOptions Parameters
TypeProperty
String[]sort?
Numberlimit?
Numberoffset?
Numberpage?

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
StoreItem
TypePropertyDescription
StringidUnique ID of the item in the store.
StringnameName of the item.
Stringdescription?Description of the item.
NumberpricePrice of the item.
NumberstockRemainingAmount of stock remaining for the item.
BooleanunlimitedStockWhether the item has unlimited stock.
BooleanisInventoryIndicates if the item will be added to a user’s inventory when purchased.
DateexpiresAt?Expiration date of the item.
BooleanisUsableWhether the item can be used by the user.
BooleanisSellableWhether the item can be sold by the user.
ArrayrequirementsRequirements needed to purchase the item.
ArrayactionsActions performed when the item is used.
StringemojiUnicode?Unicode emoji associated with the item.
StringemojiId?Custom emoji ID associated with the item.
InventoryItem
TypePropertyDescription
StringitemIdUnique ID of the item in the inventory.
NumberquantityQuantity of the item in the user's inventory.
StringnameName of the item.
Stringdescription?Description of the item.
BooleanisUsableWhether the item can be used by the user.
BooleanisSellableWhether the item can be sold by the user.
StoreItemRequirement[]requirementsRequirements needed to use the item.
StoreItemAction[]actionsActions performed when the item is used.
StringemojiUnicode?Unicode emoji associated with the item.
StringemojiId?Custom emoji ID associated with the item.
StoreItemRequirement
TypePropertyDescription
StoreItemRequirementTypetypeType of requirement. Could be one of ROLE, TOTAL_BALANCE, or ITEM.
StoreItemRequirementMatchTypematchTypeSpecifies how the requirement must be met. Can be EVERY, AT_LEAST_ONE, or NONE.
String[]idsAn array of IDs that correspond to roles, items, or other required entities.
NumberbalanceMinimum balance required (applicable if type is TOTAL_BALANCE).
StoreItemAction
TypePropertyDescription
StoreItemActionTypetypeType of action. Could be one of RESPOND, ADD_ROLES, REMOVE_ROLES, ADD_BALANCE, REMOVE_BALANCE, ADD_ITEMS, or REMOVE_ITEMS.
String[]idsAn array of IDs corresponding to roles, items, or other entities involved in the action.
Objectmessage?Discord message object, only applicable if type is RESPOND.
Numberbalance?Balance amount to be added or removed (applicable if type is ADD_BALANCE or REMOVE_BALANCE).
Permission
TypePropertyDescription
NumberallowThe allowed bitwise permissions number.
StringjsonJSON representation of the allowed and denied permissions.

Support

Discord Server

Keywords

FAQs

Package last updated on 26 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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