Coder Social home page Coder Social logo

thewilloftheshadow / unb-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from unbelievaboat/unb-api

0.0 0.0 0.0 170 KB

API wrapper for UnbelievaBoat Discord Bot API

Home Page: https://unbelievaboat.com/api/docs

License: MIT License

JavaScript 100.00%

unb-api's Introduction

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
Type Property Description
String baseURL? API hostname. Defaults to https://unbelievaboat.com/api
Number version? API version. Defaults to the latest version
Number maxRetries? 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
Type Property Description
String sort? Sort the leaderboard by cash, bank or total. Default is total.
Number limit? Limit the number of users returned. Default is no limit, unless a page is given then it's 1000.
Number offset? Specify the offset of the first user.
Number page? 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

Type Property Description
Number rank? Leaderboard rank of the user. This is only present on getUserBalance() and getGuildLeaderboard()
String user_id User ID of the discord user.
Number cash User's cash balance.
Number bank User's bank balance.
Number total User's total balance.

Guild

Type Property Description
String id Guild ID.
String name Guild name.
Number icon Icon hash.
Number iconURL Icon url.
String ownerID User ID of the owner.
Number memberCount Total number of members.
String currencySymbol Currency symbol

Permission

Type Property Description
Number allow The allowed bitwise permissions number.
String json JSON representation of the allowed and denied permissions.

Support

Discord Server

unb-api's People

Contributors

unbelievable0 avatar dependabot[bot] avatar bannerbomb avatar xaliks avatar zoeleu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.