sprcl
v1.0.2
Published
Simple API client for Clash of Clans, Clash Royale, and Brawl Stars
Downloads
15
Maintainers
Readme
sprcl
A simple Node.js library to fetch player and clan data from Clash of Clans, Clash Royale, and Brawl Stars.
Installation
npm install sprclQuick Start
const { Client } = require('sprcl');
const client = new Client('YOUR_API_KEY', 'clashofclans');
(async () => {
const player = await client.getPlayer('#PLAYER_TAG');
console.log(player);
const clan = await client.getClan('#CLAN_TAG');
console.log(clan);
})();Supported Games
clashofclansclashroyalebrawlstars
Where to Get API Keys
- Clash of Clans: https://developer.clashofclans.com
- Clash Royale: https://developer.clashroyale.com
- Brawl Stars: https://developer.brawlstars.com
You must sign in with your Supercell ID and create a key for each game. Ensure you whitelist your server's IP address.
API
new Client(apiKey, game)
Creates a new client instance for the selected game.
client.getPlayer(tag)
Fetches player data by tag.
client.getClan(tag)
Fetches clan data by tag.
Environment Variables (recomended)
You can use environment variables with the dotenv package:
require('dotenv').config();
const client = new Client(process.env.COC_API_KEY, 'clashofclans');Notes
- Each game uses a different API key.
- Player and clan objects will be formatted according to the selected game.
License
MIT
