From 342fdd1db30bc61de5f19fc4ed35db8931706903 Mon Sep 17 00:00:00 2001 From: jonz94 Date: Sun, 15 Dec 2024 12:09:18 +0800 Subject: [PATCH] feat(parser): Add `ReplaceLiveChatAction` (#847) --- .../classes/livechat/ReplaceLiveChatAction.ts | 15 +++++++++++++++ src/parser/nodes.ts | 1 + 2 files changed, 16 insertions(+) create mode 100644 src/parser/classes/livechat/ReplaceLiveChatAction.ts diff --git a/src/parser/classes/livechat/ReplaceLiveChatAction.ts b/src/parser/classes/livechat/ReplaceLiveChatAction.ts new file mode 100644 index 00000000..3ac999f0 --- /dev/null +++ b/src/parser/classes/livechat/ReplaceLiveChatAction.ts @@ -0,0 +1,15 @@ +import { YTNode } from '../../helpers.js'; +import { Parser, type RawNode } from '../../index.js'; + +export default class ReplaceLiveChatAction extends YTNode { + static type = 'ReplaceLiveChatAction'; + + to_replace: string; + replacement: YTNode | null; + + constructor(data: RawNode) { + super(); + this.to_replace = data.toReplace; + this.replacement = Parser.parseItem(data.replacement); + } +} diff --git a/src/parser/nodes.ts b/src/parser/nodes.ts index a827067b..1912d2a7 100644 --- a/src/parser/nodes.ts +++ b/src/parser/nodes.ts @@ -251,6 +251,7 @@ export { default as RemoveBannerForLiveChatCommand } from './classes/livechat/Re export { default as RemoveChatItemAction } from './classes/livechat/RemoveChatItemAction.js'; export { default as RemoveChatItemByAuthorAction } from './classes/livechat/RemoveChatItemByAuthorAction.js'; export { default as ReplaceChatItemAction } from './classes/livechat/ReplaceChatItemAction.js'; +export { default as ReplaceLiveChatAction } from './classes/livechat/ReplaceLiveChatAction.js'; export { default as ReplayChatItemAction } from './classes/livechat/ReplayChatItemAction.js'; export { default as ShowLiveChatActionPanelAction } from './classes/livechat/ShowLiveChatActionPanelAction.js'; export { default as ShowLiveChatDialogAction } from './classes/livechat/ShowLiveChatDialogAction.js';