diff --git a/src/trophy.ts b/src/trophy.ts index cac80cb..ff602e9 100644 --- a/src/trophy.ts +++ b/src/trophy.ts @@ -199,6 +199,23 @@ export class MultipleOrganizationsTrophy extends Trophy{ } } +export class OGAccountTrophy extends Trophy{ + constructor(score: number){ + const rankConditions = [ + new RankCondition( + RANK.SECRET, + "OG User", + 1, + ), + ]; + super(score, rankConditions); + this.title = "OGUser"; + this.filterTitles = ["OGUser"]; + this.bottomMessage = "Joined 2008" + this.hidden = true; + } +} + export class TotalStarTrophy extends Trophy { constructor(score: number) { const rankConditions = [ diff --git a/src/trophy_list.ts b/src/trophy_list.ts index b9eaa35..6d99519 100644 --- a/src/trophy_list.ts +++ b/src/trophy_list.ts @@ -9,6 +9,7 @@ import { MultipleLangTrophy, LongTimeAccountTrophy, AncientAccountTrophy, + OGAccountTrophy, Joined2020Trophy, AllSuperRankTrophy, MultipleOrganizationsTrophy, @@ -34,6 +35,7 @@ export class TrophyList { new MultipleLangTrophy(userInfo.languageCount), new LongTimeAccountTrophy(userInfo.durationYear), new AncientAccountTrophy(userInfo.ancientAccount), + new OGAccountTrophy(userInfo.ogAccount), new Joined2020Trophy(userInfo.joined2020), new MultipleOrganizationsTrophy(userInfo.totalOrganizations), ); diff --git a/src/user_info.ts b/src/user_info.ts index c1b2572..e65f7eb 100644 --- a/src/user_info.ts +++ b/src/user_info.ts @@ -51,6 +51,7 @@ export class UserInfo { public readonly durationYear: number; public readonly ancientAccount: number; public readonly joined2020: number; + public readonly ogAccount: number; constructor( userActivity: GitHubUserActivity, userIssue: GitHubUserIssue, @@ -85,6 +86,9 @@ export class UserInfo { const joined2020 = new Date(userActivity.createdAt).getFullYear() == 2020 ? 1 : 0; + const ogAccount = + new Date(userActivity.createdAt).getFullYear() <= 2008 ? 1 : 0; + this.totalCommits = totalCommits; this.totalFollowers = userActivity.followers.totalCount; this.totalIssues = userIssue.openIssues.totalCount + userIssue.closedIssues.totalCount; @@ -96,5 +100,6 @@ export class UserInfo { this.durationYear = durationYear; this.ancientAccount = ancientAccount; this.joined2020 = joined2020; + this.ogAccount = ogAccount; } }