diff --git a/packages/reddit/src/models/User.ts b/packages/reddit/src/models/User.ts index 63d3b0ee..3d702a44 100644 --- a/packages/reddit/src/models/User.ts +++ b/packages/reddit/src/models/User.ts @@ -220,6 +220,8 @@ export class User { #commentKarma: number; #nsfw: boolean; #isAdmin: boolean; + #isModerator: boolean; + #isGold: boolean; #modPermissionsBySubreddit: Map = new Map(); // R2 bug: user.url is a permalink path #url: string; @@ -242,8 +244,10 @@ export class User { // UserDataByAccountIds returns the ID without the t2_ prefix this.#id = T2(isT2(data.id) ? data.id : `t2_${data.id}`); this.#username = data.name; - this.#nsfw = data.over18 ?? false; + this.#nsfw = data.subreddit?.over18 ?? false; this.#isAdmin = data.isEmployee ?? false; + this.#isModerator = data.IsMod ?? false; + this.#isGold = data.isGold ?? false; const createdAt = new Date(0); createdAt.setUTCSeconds(data.createdUtc); @@ -315,6 +319,16 @@ export class User { return this.#isAdmin; } + /** Whether the user is a moderator of any subreddit. */ + get isModerator(): boolean { + return this.#isModerator; + } + + /** Whether the user has Reddit Premium. */ + get hasRedditPremium(): boolean { + return this.#isGold; + } + /** * The permissions the user has on the subreddit. */