Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(parser): add LiveChatModeChangeMessage node #811

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/parser/classes/livechat/items/LiveChatModeChangeMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { YTNode } from '../../../helpers.js';
import type { RawNode } from '../../../index.js';
import Text from '../../misc/Text.js';

export default class LiveChatModeChangeMessage extends YTNode {
static type = 'LiveChatModeChangeMessage';

id: string;
icon_type: string;
text: Text;
subtext: Text;
timestamp: number;
timestamp_usec: string;
timestamp_text: Text;

constructor(data: RawNode) {
super();
this.id = data.id;
this.icon_type = data.icon.iconType;
this.text = new Text(data.text);
this.subtext = new Text(data.subtext);
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);
this.timestamp_usec = data.timestampUsec;
this.timestamp_text = new Text(data.timestampText);
}
}
1 change: 1 addition & 0 deletions src/parser/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export { default as LiveChatBannerHeader } from './classes/livechat/items/LiveCh
export { default as LiveChatBannerPoll } from './classes/livechat/items/LiveChatBannerPoll.js';
export { default as LiveChatBannerRedirect } from './classes/livechat/items/LiveChatBannerRedirect.js';
export { default as LiveChatMembershipItem } from './classes/livechat/items/LiveChatMembershipItem.js';
export { default as LiveChatModeChangeMessage } from './classes/livechat/items/LiveChatModeChangeMessage.js';
export { default as LiveChatPaidMessage } from './classes/livechat/items/LiveChatPaidMessage.js';
export { default as LiveChatPaidSticker } from './classes/livechat/items/LiveChatPaidSticker.js';
export { default as LiveChatPlaceholderItem } from './classes/livechat/items/LiveChatPlaceholderItem.js';
Expand Down