Welcome
Installation
npm i clashofclans.js
- Node.js v16 or newer is required.
Links
Examples
const { Client } = require('clashofclans.js');
Login with Email Password
const client = new Client();
(async function () {
// This method should be called once when application starts.
await client.login({ email: 'developer@email.com', password: '***' });
const clan = await client.getClan('#2PP');
console.log(`${clan.name} (${clan.tag})`);
})();
Login with API Keys
const client = new Client({ keys: ['api_key_goes_here'] });
(async function () {
const clan = await client.getClan('#2PP');
console.log(`${clan.name} (${clan.tag})`);
})();
Events
The API lacks socket-based real-time events. It is recommended to implement your own custom polling system. Pull data at specified intervals, compare with previous values, and emit events on change. Consider using Node.js clusters and threads for efficient parallel processing.
Disclaimer
This content is not affiliated with, endorsed, sponsored, or specifically approved by Supercell and Supercell is not responsible for it. For more information see Supercell's Fan Content Policy.