API Wrapper for Brawlstars.js in Javascript
Download
npm install brawlstars.js
Setup
const Brawlstars = require("brawlstars.js")
const token = "your token"
const client = new Brawlstars.Client(token)
;(async () => {
const player = await client.getPlayer("#PLAYERTAG")
console.log(player.tag)
)}()
Usefuls Links
Creators
Documentation
Client
Methods
getPlayer
Description |
Get player by tag |
Async |
true |
Parameters |
tag |
Type |
Promise |
getClub
Description |
Get club by tag |
Async |
true |
Parameters |
tag |
Type |
Promise |
getRanking
Description |
Get rankings of clubs or players in a specific country |
Async |
true |
Parameters |
Country (default "global"), type ("clubs" or "players") |
Type |
Promise |
getBrawlers
Description |
Get all brawlers |
Async |
true |
Parameters |
ANY |
Type |
Promise |
Player
Properties
name | Type | Value(s) [optional] |
---|
tag |
String |
nameColor |
Hexadecimal |
trophies |
Number |
highestTrophies |
Number |
expLevel |
Number |
expPoints |
Number |
powerPlayPoints |
Number |
highestPowerPlayPoints |
Number |
trioVictories |
Number |
duoVictories |
Number |
soloVictories |
Number |
totalVictories |
Number |
bestRobotRumbleTime |
timestamp (seconds) |
bestTimeAsBigBrawler |
timestamp (seconds) |
isQualifiedFromChampionshipChallenge |
Boolean |
brawlers |
Object |
brawlerCount |
Number |
club |
Object |
club.tag, club.name |
Methods
getWins (DEPRECATED)
Description |
Get wins |
Async |
false |
Parameters |
type ("trio", "duo", "solo") |
Type |
Number |
getWin
Description |
Get wins |
Async |
false |
Parameters |
type (1(soloVictories), 2(duoVictories), 3(trioVictories) and 4 (totalVictories)) |
Type |
Number |
getColor
Description |
Convert player.nameColor into a readble hexadecimal |
Async |
false |
Parameters |
ANY |
|
Type |
hexadecimal |
getBrawlerByName
Description |
Get player's brawler by name |
Async |
false |
Parameters |
name (brawler name) |
Type |
Object |
getBrawlerById
Description |
Get brawler by ID |
Async |
false |
Parameters |
id (brawler ID) |
Type |
Object |
getStarPowersNames
Description |
Get names of player's starpowers |
Async |
false |
Parameters |
ANY |
Type |
Object |
bestTimeToTxt (DEPRECATED)
Description |
Convert robotRumble or bigBrawler timestamp to text |
Async |
false |
Parameters |
type ("robotRumble" or "bigBrawler") |
Type |
String (e.g: "5m21s") |
bestTime
Description |
Convert robotRumble or bigBrawler timestamp to text |
Async |
false |
Parameters |
type (1 (bestRobotRumbleTime) or 2 (bestTimeAsbigBrawler) |
Type |
String (e.g: "5m21s") |
sortBrawlersByTrophies
Description |
Sort player's brawlers by trophies |
Async |
false |
Parameters |
ANY |
Type |
Object |
sortBrawlersByHighestTrophies
Description |
Sort player's brawlers by highest trophies |
Async |
false |
Parameters |
ANY |
Type |
Object |
sortBrawlersByPower
Description |
Sort player's brawlers by power |
Async |
false |
Parameters |
ANY |
Type |
Object |
sortBrawlersByRank
Description |
Sort player's brawlers by rank |
Async |
false |
Parameters |
ANY |
Type |
Object |
Club
Properties
Name | Type | Value(s) [optional] |
---|
tag |
String |
name |
String |
type |
String |
Open, close |
trophies |
Number |
requiredTrophies |
Number |
members |
Object |
memberCount |
Number |
isFull |
Boolean |
Methods
getMemberRank
Description |
Get club rank of a player by tag |
Async |
false |
Parameters |
tag |
Type |
Number |
getMemberRole
Description |
Get club role of a player by tag |
Async |
false |
Parameters |
tag |
Type |
String |
playerCanJoin
Description |
return true if the player can join the club, false if not |
Async |
false |
Parameters |
tag |
Type |
boolean |
sortMembersByTrophies
Description |
Sort club member by trophies |
Async |
false |
Parameters |
ANY |
Type |
Object |
Ranking
Properties
Name | Type | Value(s) [optional] |
---|
country |
String |
type |
String |
"clubs", "players" |
ranks |
Object |
rankCount |
Number |
Methods
getTop
Description |
Gives the first {max} rankings |
Async |
false |
Parameters |
max (number) |
Type |
Object |
isRanked
Description |
check if a player is ranked |
Async |
false |
Parameters |
tag |
Type |
boolean |
Brawler
Properties
Name | Type |
---|
count |
Number |
data |
Object |
Methods
getBrawlerByName
Description |
Get a brawler by name |
Async |
false |
Parameters |
name (brawler name) |
Type |
Object |
getBrawlerById
Description |
Get a brawler by ID |
Async |
false |
Parameters |
id (brawler ID) |
Type |
Object |
getBrawlersNames
Description |
Get all names of brawlers |
Async |
false |
Parameters |
ANY |
Type |
Array |
getBrawlerStarPowersByName
Description |
Get brawler's starpowers by name |
Async |
false |
Parameters |
name (brawler name) |
Type |
Object |
getBrawlersStarPowers
Description |
Get all starpowers of brawlers |
Async |
false |
Parameters |
ANY |
Type |
Array |
Exemples
Player
const Brawlstars = require("brawlstars.js")
const token = "your token"
const client = new Brawlstars.client(token)
;(async () => {
const player = await client.getPlayer("#TAG")
console.log(player.getWin(1))
console.log(player.club.tag)
const frank = player.getBrawlerByName("FRANK")
console.log(frank.power)
console.log(frank.trophies)
console.log(player.bestTime(2)
})()
Club
TODO
Ranking
TODO
Brawlers
TODO