brawl-api-wrapper
v1.4.2
Published
An API wrapper for the well know supercell game called Brawl Stars
Downloads
157
Maintainers
Readme
BRAWL API WRAPPER
npm i brawl-api-wrapper
First of all you have to get a brawl stars API key
const { Client } = require('brawl-api-wrapper')
const client = new Client('YOUR API KEY GOES HERE')
Or if you're using ES6 import:
import { Client } from 'brawl-api-wrapper'
const client = new Client('YOUR API KEY GOES HERE')
This method return a player object, we only have to provide the player's tag
const player = await client.getPlayer('PLAYER TAG GOES HERE', true) //the second param is to select if you want the battlelog to show or not. The default is false
console.log(player.name) // return the player username
//NOTE: Requesting the battlelog might get a 500 error by the Brawl Stars Api.
This method returns a player battlelog, we have to provide the player's tag
const battlelog = await client.getBattleLog('PLAYER TAG GOES HERE')
Or you can access to a Player property called battlelog
const player = await client.getPlayer('PLAYER TAG GOES HERE')
console.log(player.battlelog) // return the player battlelog
This method return a club, we have only to provide the club's tag
const club = await client.getClub('CLUB TAG GOES HERE')
console.log(club.memberCount) // return the number of members of the club
To get a brawler you have to pass the brawlerId that this module provides to you in form of an enum
const { Brawlers } = require('brawl-api-wrapper')
const brawler = await client.getBrawler(Brawlers.Amber)
console.log(brawler.gadgets) // return the gadgets in form of an array
This method return all the brawlers in form of an array
const brawlers = await client.getBrawlers()
console.log(brawlers) // return an array of all the brawlers
This method returns the 200 players with more trophies of a country.
const topPlayers = await client.getRankingOfPlayers('es') // return the top 200 players with more trophies of Spain, by default return the global top.
console.log(topPlayers)
This method return the 200 clubs with more trophies of a country
const topClubs = await client.getRankingOfClubs('es') // return the top 200 clubs with more trophies of Spain, by default return the global top.
console.log(topClubs)
This method return the 200 players with more trophies of a country.You have to pass the brawlerId in the method so we import the Brawlers enum
const { Brawlers } = require('brawl-api-wrapper')
const topBrawlers = await client.getRankingOfBrawlers(Brawlers.Amber, 'es') // return the top 200 players with more trophies with Amber of Spain, by default is the global top
This method return the event rotation of the game
const events = await client.getEvents()
console.log(event) // return an array of events
If you find a bug create an issue in the official repository