chore: clean up build steps

This commit is contained in:
LuanRT
2022-07-20 16:28:51 -03:00
parent fb68e6bcfe
commit 6a5ebeb8ee
287 changed files with 40 additions and 40 deletions

View File

@@ -0,0 +1,12 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class AddBannerToLiveChatCommand extends YTNode {
static type = 'AddBannerToLiveChatCommand';
constructor(data) {
super();
return Parser.parse(data.bannerRenderer);
}
}
export default AddBannerToLiveChatCommand;

View File

@@ -0,0 +1,13 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class AddChatItemAction extends YTNode {
static type = 'AddChatItemAction';
constructor(data) {
super();
this.item = Parser.parseItem(data.item);
this.client_id = data.clientId || null;
}
}
export default AddChatItemAction;

View File

@@ -0,0 +1,13 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class AddLiveChatTickerItemAction extends YTNode {
static type = 'AddLiveChatTickerItemAction';
constructor(data) {
super();
this.item = Parser.parseItem(data.item);
this.duration_sec = data.durationSec;
}
}
export default AddLiveChatTickerItemAction;

View File

@@ -0,0 +1,14 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class LiveChatActionPanel extends YTNode {
static type = 'LiveChatActionPanel';
constructor(data) {
super();
this.id = data.id;
this.contents = Parser.parse(data.contents);
this.target_id = data.targetId;
}
}
export default LiveChatActionPanel;

View File

@@ -0,0 +1,13 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
class MarkChatItemAsDeletedAction extends YTNode {
static type = 'MarkChatItemAsDeletedAction';
constructor(data) {
super();
this.deleted_state_message = new Text(data.deletedStateMessage);
this.target_item_id = data.targetItemId;
}
}
export default MarkChatItemAsDeletedAction;

View File

@@ -0,0 +1,13 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
class MarkChatItemsByAuthorAsDeletedAction extends YTNode {
static type = 'MarkChatItemsByAuthorAsDeletedAction';
constructor(data) {
super();
this.deleted_state_message = new Text(data.deletedStateMessage);
this.channel_id = data.externalChannelId;
}
}
export default MarkChatItemsByAuthorAsDeletedAction;

View File

@@ -0,0 +1,11 @@
import { YTNode } from '../../helpers';
class RemoveBannerForLiveChatCommand extends YTNode {
static type = 'RemoveBannerForLiveChatCommand';
constructor(data) {
super();
this.target_action_id = data.targetActionId;
}
}
export default RemoveBannerForLiveChatCommand;

View File

@@ -0,0 +1,13 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class ReplaceChatItemAction extends YTNode {
static type = 'ReplaceChatItemAction';
constructor(data) {
super();
this.target_item_id = data.targetItemId;
this.replacement_item = Parser.parse(data.replacementItem);
}
}
export default ReplaceChatItemAction;

View File

@@ -0,0 +1,16 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class ReplayChatItemAction extends YTNode {
static type = 'ReplayChatItemAction';
constructor(data) {
super();
this.actions = Parser.parse(data.actions?.map((action) => {
delete action.clickTrackingParams;
return action;
})) || [];
this.video_offset_time_msec = data.videoOffsetTimeMsec;
}
}
export default ReplayChatItemAction;

View File

@@ -0,0 +1,12 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class ShowLiveChatActionPanelAction extends YTNode {
static type = 'ShowLiveChatActionPanelAction';
constructor(data) {
super();
this.panel_to_show = Parser.parse(data.panelToShow);
}
}
export default ShowLiveChatActionPanelAction;

View File

@@ -0,0 +1,12 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class ShowLiveChatTooltipCommand extends YTNode {
static type = 'ShowLiveChatTooltipCommand';
constructor(data) {
super();
this.tooltip = Parser.parse(data.tooltip);
}
}
export default ShowLiveChatTooltipCommand;

View File

@@ -0,0 +1,12 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
class UpdateDateTextAction extends YTNode {
static type = 'UpdateDateTextAction';
constructor(data) {
super();
this.date_text = new Text(data.dateText).toString();
}
}
export default UpdateDateTextAction;

View File

@@ -0,0 +1,12 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
class UpdateDescriptionAction extends YTNode {
static type = 'UpdateDescriptionAction';
constructor(data) {
super();
this.description = new Text(data.description);
}
}
export default UpdateDescriptionAction;

View File

@@ -0,0 +1,12 @@
import Parser from '../../index';
import { YTNode } from '../../helpers';
class UpdateLiveChatPollAction extends YTNode {
static type = 'UpdateLiveChatPollAction';
constructor(data) {
super();
this.poll_to_update = Parser.parse(data.pollToUpdate);
}
}
export default UpdateLiveChatPollAction;

View File

@@ -0,0 +1,12 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
class UpdateTitleAction extends YTNode {
static type = 'UpdateTitleAction';
constructor(data) {
super();
this.title = new Text(data.title);
}
}
export default UpdateTitleAction;

View File

@@ -0,0 +1,14 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
class UpdateToggleButtonTextAction extends YTNode {
static type = 'UpdateToggleButtonTextAction';
constructor(data) {
super();
this.default_text = new Text(data.defaultText).toString();
this.toggled_text = new Text(data.toggledText).toString();
this.button_id = data.buttonId;
}
}
export default UpdateToggleButtonTextAction;

View File

@@ -0,0 +1,15 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
class UpdateViewershipAction extends YTNode {
static type = 'UpdateViewershipAction';
constructor(data) {
super();
const view_count_renderer = data.viewCount.videoViewCountRenderer;
this.view_count = new Text(view_count_renderer.viewCount);
this.extra_short_view_count = new Text(view_count_renderer.extraShortViewCount);
this.is_live = view_count_renderer.isLive;
}
}
export default UpdateViewershipAction;

View File

@@ -0,0 +1,17 @@
import Parser from '../../../index';
import { YTNode } from '../../../helpers';
class LiveChatBanner extends YTNode {
static type = 'LiveChatBanner';
constructor(data) {
super();
this.header = Parser.parse(data.header, 'livechat/items');
this.contents = Parser.parse(data.contents, 'livechat/items');
this.action_id = data.actionId;
this.viewer_is_creator = data.viewerIsCreator;
this.target_id = data.targetId;
this.is_stackable = data.isStackable;
this.background_type = data.backgroundType;
}
}
export default LiveChatBanner;

View File

@@ -0,0 +1,14 @@
import Parser from '../../../index';
import Text from '../../misc/Text';
import { YTNode } from '../../../helpers';
class LiveChatBannerHeader extends YTNode {
static type = 'LiveChatBannerHeader';
constructor(data) {
super();
this.text = new Text(data.text).toString();
this.icon_type = data.icon.iconType;
this.context_menu_button = Parser.parse(data.contextMenuButton);
}
}
export default LiveChatBannerHeader;

View File

@@ -0,0 +1,21 @@
import Parser from '../../../index';
import Text from '../../misc/Text';
import Thumbnail from '../../misc/Thumbnail';
import { YTNode } from '../../../helpers';
class LiveChatBannerPoll extends YTNode {
static type = 'LiveChatBannerPoll';
constructor(data) {
super();
this.poll_question = new Text(data.pollQuestion);
this.author_photo = Thumbnail.fromResponse(data.authorPhoto);
this.choices = data.pollChoices.map((choice) => ({
option_id: choice.pollOptionId,
text: new Text(choice.text).toString()
}));
this.collapsed_state_entity_key = data.collapsedStateEntityKey;
this.live_chat_poll_state_entity_key = data.liveChatPollStateEntityKey;
this.context_menu_button = Parser.parse(data.contextMenuButton);
}
}
export default LiveChatBannerPoll;

View File

@@ -0,0 +1,23 @@
import Parser from '../../../index';
import Text from '../../misc/Text';
import Thumbnail from '../../misc/Thumbnail';
import NavigationEndpoint from '../../NavigationEndpoint';
import { YTNode } from '../../../helpers';
class LiveChatMembershipItem extends YTNode {
static type = 'LiveChatMembershipItem';
constructor(data) {
super();
this.id = data.id;
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);
this.header_subtext = new Text(data.headerSubtext);
this.author = {
id: data.authorExternalChannelId,
name: new Text(data?.authorName),
thumbnails: Thumbnail.fromResponse(data.authorPhoto),
badges: Parser.parse(data.authorBadges)
};
this.menu_endpoint = new NavigationEndpoint(data.contextMenuEndpoint);
}
}
export default LiveChatMembershipItem;

View File

@@ -0,0 +1,30 @@
import Text from '../../misc/Text';
import Thumbnail from '../../misc/Thumbnail';
import NavigationEndpoint from '../../NavigationEndpoint';
import Parser from '../../../index';
import { YTNode } from '../../../helpers';
class LiveChatPaidMessage extends YTNode {
static type = 'LiveChatPaidMessage';
constructor(data) {
super();
this.message = new Text(data.message);
this.author = {
id: data.authorExternalChannelId,
name: new Text(data.authorName),
thumbnails: Thumbnail.fromResponse(data.authorPhoto),
badges: Parser.parse(data.authorBadges)
};
const badges = Parser.parse(data.authorBadges);
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.purchase_amount = new Text(data.purchaseAmountText).toString();
this.menu_endpoint = new NavigationEndpoint(data.contextMenuEndpoint);
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);
this.timestamp_text = new Text(data.timestampText).toString();
this.id = data.id;
}
}
export default LiveChatPaidMessage;

View File

@@ -0,0 +1,24 @@
import Parser from '../../../index';
import NavigationEndpoint from '../../NavigationEndpoint';
import Thumbnail from '../../misc/Thumbnail';
import Text from '../../misc/Text';
import { YTNode } from '../../../helpers';
class LiveChatPaidSticker extends YTNode {
static type = 'LiveChatPaidSticker';
constructor(data) {
super();
this.id = data.id;
this.author = {
id: data.authorExternalChannelId,
name: new Text(data.authorName),
thumbnails: Thumbnail.fromResponse(data.authorPhoto),
badges: Parser.parse(data.authorBadges)
};
this.sticker = Thumbnail.fromResponse(data.sticker);
this.purchase_amount = new Text(data.purchaseAmountText).toString();
this.context_menu = new NavigationEndpoint(data.contextMenuEndpoint);
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);
}
}
export default LiveChatPaidSticker;

View File

@@ -0,0 +1,11 @@
import { YTNode } from '../../../helpers';
class LiveChatPlaceholderItem extends YTNode {
static type = 'LiveChatPlaceholderItem';
constructor(data) {
super();
this.id = data.id;
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);
}
}
export default LiveChatPlaceholderItem;

View File

@@ -0,0 +1,27 @@
import Text from '../../misc/Text';
import Thumbnail from '../../misc/Thumbnail';
import NavigationEndpoint from '../../NavigationEndpoint';
import Parser from '../../../index';
import { YTNode } from '../../../helpers';
class LiveChatTextMessage extends YTNode {
static type = 'LiveChatTextMessage';
constructor(data) {
super();
this.message = new Text(data.message);
this.author = {
id: data.authorExternalChannelId,
name: new Text(data.authorName),
thumbnails: Thumbnail.fromResponse(data.authorPhoto)
};
const badges = Parser.parse(data.authorBadges);
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.menu_endpoint = new NavigationEndpoint(data.contextMenuEndpoint);
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);
this.id = data.id;
}
}
export default LiveChatTextMessage;

View File

@@ -0,0 +1,29 @@
import Text from '../../misc/Text';
import Thumbnail from '../../misc/Thumbnail';
import NavigationEndpoint from '../../NavigationEndpoint';
import Parser from '../../../index';
import { YTNode } from '../../../helpers';
class LiveChatTickerPaidMessageItem extends YTNode {
static type = 'LiveChatTickerPaidMessageItem';
constructor(data) {
super();
this.author = {
id: data.authorExternalChannelId,
thumbnails: Thumbnail.fromResponse(data.authorPhoto),
badges: Parser.parse(data.authorBadges)
};
const badges = Parser.parse(data.authorBadges);
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, 'livechat/items');
this.show_item_endpoint = new NavigationEndpoint(data.showItemEndpoint);
this.id = data.id;
}
}
export default LiveChatTickerPaidMessageItem;

View File

@@ -0,0 +1,21 @@
import Text from '../../misc/Text';
import Thumbnail from '../../misc/Thumbnail';
import { YTNode } from '../../../helpers';
class LiveChatTickerSponsorItem extends YTNode {
static type = 'LiveChatTickerSponsorItem';
constructor(data) {
super();
this.id = data.id;
this.detail_text = new Text(data.detailText).toString();
this.author = {
id: data.authorExternalChannelId,
name: new Text(data?.authorName),
thumbnails: Thumbnail.fromResponse(data.sponsorPhoto)
};
this.duration_sec = data.durationSec;
// TODO: finish this
// Console.log(data)
}
}
export default LiveChatTickerSponsorItem;

View File

@@ -0,0 +1,14 @@
import LiveChatTextMessage from './LiveChatTextMessage';
import Parser from '../../../index';
class LiveChatViewerEngagementMessage extends LiveChatTextMessage {
static type = 'LiveChatViewerEngagementMessage';
constructor(data) {
super(data);
delete this.author;
delete this.menu_endpoint;
this.icon_type = data.icon.iconType;
this.action_button = Parser.parse(data.actionButton);
}
}
export default LiveChatViewerEngagementMessage;

View File

@@ -0,0 +1,17 @@
import Text from '../../misc/Text';
import Thumbnail from '../../misc/Thumbnail';
import Parser from '../../../index';
import { YTNode } from '../../../helpers';
class PollHeader extends YTNode {
static type = 'PollHeader';
constructor(data) {
super();
this.poll_question = new Text(data.pollQuestion);
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
this.metadata = new Text(data.metadataText);
this.live_chat_poll_type = data.liveChatPollType;
this.context_menu_button = Parser.parse(data.contextMenuButton);
}
}
export default PollHeader;