refactor: improve livechat parser & add remaining action nodes (#285)

* refactor: improve live chat parsers & add missing nodes

* chore: update example and docs

* docs: rephrasing/formatting

* chore: remove unneeded test (unrelated)
This commit is contained in:
LuanRT
2023-01-10 01:44:51 -03:00
committed by GitHub
parent 5a362a0bd5
commit 8e37efa575
35 changed files with 413 additions and 182 deletions

View File

@@ -1,12 +1,11 @@
import { observe, ObservedArray, YTNode } from '../../../helpers';
import Parser from '../../../index';
import Button from '../../Button';
import LiveChatAuthorBadge from '../../LiveChatAuthorBadge';
import MetadataBadge from '../../MetadataBadge';
import Text from '../../misc/Text';
import Thumbnail from '../../misc/Thumbnail';
import NavigationEndpoint from '../../NavigationEndpoint';
import MetadataBadge from '../../MetadataBadge';
import LiveChatAuthorBadge from '../../LiveChatAuthorBadge';
import Parser from '../../../index';
import { ObservedArray, YTNode } from '../../../helpers';
import Button from '../../Button';
class LiveChatTextMessage extends YTNode {
static type = 'LiveChatTextMessage';
@@ -16,7 +15,7 @@ class LiveChatTextMessage extends YTNode {
id: string;
name: Text;
thumbnails: Thumbnail[];
badges: LiveChatAuthorBadge[] | MetadataBadge[];
badges: ObservedArray<LiveChatAuthorBadge | MetadataBadge>;
is_moderator: boolean | null;
is_verified: boolean | null;
is_verified_artist: boolean | null;
@@ -35,7 +34,7 @@ class LiveChatTextMessage extends YTNode {
id: data.authorExternalChannelId,
name: new Text(data.authorName),
thumbnails: Thumbnail.fromResponse(data.authorPhoto),
badges: [] as LiveChatAuthorBadge[] | [] as MetadataBadge[],
badges: observe([]).as(LiveChatAuthorBadge, MetadataBadge),
is_moderator: null,
is_verified: null,
is_verified_artist: null