From f3e2746f70d0ef6547b4e14a83c2431da46cac61 Mon Sep 17 00:00:00 2001 From: Suvajit Date: Mon, 27 Nov 2023 22:48:49 +0530 Subject: [PATCH] feat: add town hall level property (#161) --- package.json | 2 +- src/struct/ClanMember.ts | 10 +++++++++- src/types/api.ts | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4d709a8..a3662b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clashofclans.js", - "version": "3.1.5", + "version": "3.2.0", "description": "JavaScript library for interacting with the Clash of Clans API", "author": "https://clashofclans.js.org", "license": "MIT", diff --git a/src/struct/ClanMember.ts b/src/struct/ClanMember.ts index c7bea6b..4d4f8e8 100644 --- a/src/struct/ClanMember.ts +++ b/src/struct/ClanMember.ts @@ -1,5 +1,5 @@ import { Client } from '../client/Client'; -import { APIClanMember, APIPlayerHouse, OverrideOptions } from '../types'; +import { APIClanMember, APILeague, APIPlayerHouse, OverrideOptions } from '../types'; import { UnrankedLeagueData } from '../util/Constants'; import { League } from './League'; @@ -16,9 +16,15 @@ export class ClanMember { /** The member's experience level. */ public expLevel: number; + /** The member's Town Hall level. */ + public townHallLevel: number; + /** The member's current League. */ public league: League; + /** The member's current Builder Base League. */ + public builderBaseLeague: Omit | null; + /** The member's trophy count. */ public trophies: number; @@ -62,6 +68,8 @@ export class ClanMember { this.donations = data.donations; this.playerHouse = data.playerHouse ?? null; this.received = data.donationsReceived; + this.townHallLevel = data.townHallLevel; + this.builderBaseLeague = data.builderBaseLeague ?? null; } /** Whether this clan member is in the clan. */ diff --git a/src/types/api.ts b/src/types/api.ts index 2d79cb1..2b25918 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -83,7 +83,9 @@ export interface APIClanMember { tag: string; role: 'member' | 'admin' | 'coLeader' | 'leader'; expLevel: number; + townHallLevel: number; league: APILeague; + builderBaseLeague?: Omit; trophies: number; builderBaseTrophies?: number; /** @deprecated */