-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser): add
LiveChatModeChangeMessage
node (#811)
* feat(parser): add `LiveChatModeChangeMessage` node * chore: npm run build:parser-map * refactor: keep `timestamp_text` as Text Co-authored-by: absidue <[email protected]> * refactor: keep `timestamp_text` as Text --------- Co-authored-by: absidue <[email protected]>
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/parser/classes/livechat/items/LiveChatModeChangeMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters