Skip to content

Commit

Permalink
feat: add town hall level property (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
csuvajit committed Nov 27, 2023
1 parent 46123c0 commit f3e2746
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 9 additions & 1 deletion src/struct/ClanMember.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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<APILeague, 'iconUrls'> | null;

/** The member's trophy count. */
public trophies: number;

Expand Down Expand Up @@ -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. */
Expand Down
2 changes: 2 additions & 0 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ export interface APIClanMember {
tag: string;
role: 'member' | 'admin' | 'coLeader' | 'leader';
expLevel: number;
townHallLevel: number;
league: APILeague;
builderBaseLeague?: Omit<APILeague, 'iconUrls'>;
trophies: number;
builderBaseTrophies?: number;
/** @deprecated */
Expand Down

1 comment on commit f3e2746

@csuvajit
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for clashofclans-js ready!

✅ Preview
https://clashofclans-ork1st7ge-csuvajit.vercel.app

Built with commit f3e2746.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.