Skip to content

Commit

Permalink
feat(parser): Update LiveChatMembershipItem (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonz94 authored Dec 12, 2024
1 parent 69d42b2 commit 0c319aa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/parser/classes/livechat/items/LiveChatMembershipItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,37 @@ export default class LiveChatMembershipItem extends YTNode {

id: string;
timestamp: number;
timestamp_usec: string;
timestamp_text?: Text;
header_primary_text?: Text;
header_subtext: Text;
message?: Text;
author: Author;
menu_endpoint: NavigationEndpoint;
context_menu_accessibility_label: string;

constructor(data: RawNode) {
super();
this.id = data.id;
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);
this.timestamp_usec = data.timestampUsec;

if (Reflect.has(data, 'timestampText')) {
this.timestamp_text = new Text(data.timestampText);
}

if (Reflect.has(data, 'headerPrimaryText')) {
this.header_primary_text = new Text(data.headerPrimaryText);
}

this.header_subtext = new Text(data.headerSubtext);

if (Reflect.has(data, 'message')) {
this.message = new Text(data.message);
}

this.author = new Author(data.authorName, data.authorBadges, data.authorPhoto, data.authorExternalChannelId);
this.menu_endpoint = new NavigationEndpoint(data.contextMenuEndpoint);
this.context_menu_accessibility_label = data.contextMenuAccessibility.accessibilityData.label;
}
}

0 comments on commit 0c319aa

Please sign in to comment.