mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-30 09:55:18 +00:00
feat(LiveChat): add SegmentedLikeDislikeButton and LiveChatDialog (#181)
* feat: add `LiveChatDialog` * feat: add `SegmentedLikeDislikeButton`
This commit is contained in:
19
src/parser/classes/LiveChatDialog.ts
Normal file
19
src/parser/classes/LiveChatDialog.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import Parser from '..';
|
||||
import Text from './misc/Text';
|
||||
import Button from './Button';
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class LiveChatDialog extends YTNode {
|
||||
static type = 'LiveChatDialog';
|
||||
|
||||
confirm_button: Button | null;
|
||||
dialog_messages: Text[];
|
||||
|
||||
constructor (data: any) {
|
||||
super();
|
||||
this.confirm_button = Parser.parseItem<Button>(data.confirmButton, Button);
|
||||
this.dialog_messages = data.dialogMessages.map((el: any) => new Text(el));
|
||||
}
|
||||
}
|
||||
|
||||
export default LiveChatDialog;
|
||||
18
src/parser/classes/SegmentedLikeDislikeButton.ts
Normal file
18
src/parser/classes/SegmentedLikeDislikeButton.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import Parser from '..';
|
||||
import ToggleButton from './ToggleButton';
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class SegmentedLikeDislikeButton extends YTNode {
|
||||
static type = 'SegmentedLikeDislikeButton';
|
||||
|
||||
like_button: ToggleButton | null;
|
||||
dislike_button: ToggleButton | null;
|
||||
|
||||
constructor (data: any) {
|
||||
super();
|
||||
this.like_button = Parser.parseItem<ToggleButton>(data.likeButton, ToggleButton);
|
||||
this.dislike_button = Parser.parseItem<ToggleButton>(data.dislikeButton, ToggleButton);
|
||||
}
|
||||
}
|
||||
|
||||
export default SegmentedLikeDislikeButton;
|
||||
@@ -118,6 +118,7 @@ import { default as UpdateTitleAction } from './classes/livechat/UpdateTitleActi
|
||||
import { default as UpdateToggleButtonTextAction } from './classes/livechat/UpdateToggleButtonTextAction';
|
||||
import { default as UpdateViewershipAction } from './classes/livechat/UpdateViewershipAction';
|
||||
import { default as LiveChatAuthorBadge } from './classes/LiveChatAuthorBadge';
|
||||
import { default as LiveChatDialog } from './classes/LiveChatDialog';
|
||||
import { default as LiveChatHeader } from './classes/LiveChatHeader';
|
||||
import { default as LiveChatItemList } from './classes/LiveChatItemList';
|
||||
import { default as LiveChatMessageInput } from './classes/LiveChatMessageInput';
|
||||
@@ -212,6 +213,7 @@ import { default as SearchSuggestion } from './classes/SearchSuggestion';
|
||||
import { default as SearchSuggestionsSection } from './classes/SearchSuggestionsSection';
|
||||
import { default as SecondarySearchContainer } from './classes/SecondarySearchContainer';
|
||||
import { default as SectionList } from './classes/SectionList';
|
||||
import { default as SegmentedLikeDislikeButton } from './classes/SegmentedLikeDislikeButton';
|
||||
import { default as SettingBoolean } from './classes/SettingBoolean';
|
||||
import { default as SettingsCheckbox } from './classes/SettingsCheckbox';
|
||||
import { default as SettingsOptions } from './classes/SettingsOptions';
|
||||
@@ -386,6 +388,7 @@ const map: Record<string, YTNodeConstructor> = {
|
||||
UpdateToggleButtonTextAction,
|
||||
UpdateViewershipAction,
|
||||
LiveChatAuthorBadge,
|
||||
LiveChatDialog,
|
||||
LiveChatHeader,
|
||||
LiveChatItemList,
|
||||
LiveChatMessageInput,
|
||||
@@ -480,6 +483,7 @@ const map: Record<string, YTNodeConstructor> = {
|
||||
SearchSuggestionsSection,
|
||||
SecondarySearchContainer,
|
||||
SectionList,
|
||||
SegmentedLikeDislikeButton,
|
||||
SettingBoolean,
|
||||
SettingsCheckbox,
|
||||
SettingsOptions,
|
||||
|
||||
Reference in New Issue
Block a user