mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 04:21:35 +00:00
feat: add RemoveChatItemAction and LiveChatTickerStickerItem (#214)
This commit is contained in:
14
src/parser/classes/livechat/RemoveChatItemAction.ts
Normal file
14
src/parser/classes/livechat/RemoveChatItemAction.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { YTNode } from '../../helpers';
|
||||
|
||||
class RemoveChatItemAction extends YTNode {
|
||||
static type = 'RemoveChatItemAction';
|
||||
|
||||
target_item_id: string;
|
||||
|
||||
constructor(data: any) {
|
||||
super();
|
||||
this.target_item_id = data.targetItemId;
|
||||
}
|
||||
}
|
||||
|
||||
export default RemoveChatItemAction;
|
||||
@@ -0,0 +1,56 @@
|
||||
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 { YTNode } from '../../../helpers';
|
||||
|
||||
class LiveChatTickerPaidStickerItem extends YTNode {
|
||||
static type = 'LiveChatTickerPaidStickerItem';
|
||||
|
||||
author: {
|
||||
id: string;
|
||||
thumbnails: Thumbnail[];
|
||||
badges: LiveChatAuthorBadge[] | MetadataBadge[];
|
||||
is_moderator: boolean | null;
|
||||
is_verified: boolean | null;
|
||||
is_verified_artist: boolean | null;
|
||||
};
|
||||
|
||||
amount: Text;
|
||||
duration_sec: string; // Or number?
|
||||
full_duration_sec: string;
|
||||
show_item;
|
||||
show_item_endpoint: NavigationEndpoint;
|
||||
id: string;
|
||||
|
||||
constructor(data: any) {
|
||||
super();
|
||||
|
||||
this.author = {
|
||||
id: data.authorExternalChannelId,
|
||||
thumbnails: Thumbnail.fromResponse(data.authorPhoto),
|
||||
badges: Parser.parseArray<LiveChatAuthorBadge | MetadataBadge>(data.authorBadges, [ MetadataBadge, LiveChatAuthorBadge ]),
|
||||
is_moderator: null,
|
||||
is_verified: null,
|
||||
is_verified_artist: null
|
||||
};
|
||||
|
||||
const badges = Parser.parseArray<LiveChatAuthorBadge | MetadataBadge>(data.authorBadges, [ MetadataBadge, LiveChatAuthorBadge ]);
|
||||
|
||||
this.author.badges = badges;
|
||||
this.author.is_moderator = badges?.some((badge) => badge.icon_type == 'MODERATOR') || null;
|
||||
this.author.is_verified = badges?.some((badge) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED') || null;
|
||||
this.author.is_verified_artist = badges?.some((badge) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED_ARTIST') || null;
|
||||
this.amount = new Text(data.amount);
|
||||
this.duration_sec = data.durationSec;
|
||||
this.full_duration_sec = data.fullDurationSec;
|
||||
this.show_item = Parser.parse(data.showItemEndpoint.showLiveChatItemEndpoint.renderer);
|
||||
this.show_item_endpoint = new NavigationEndpoint(data.showItemEndpoint);
|
||||
this.id = data.id;
|
||||
}
|
||||
}
|
||||
|
||||
export default LiveChatTickerPaidStickerItem;
|
||||
Reference in New Issue
Block a user