From 9b98c6de95407a01f10a2d04251ff6546830b189 Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Tue, 18 Jul 2023 00:41:10 +0200 Subject: [PATCH] - show subscribers on youtube channel - display channel on playlists - add labels to stat pills --- commands/message/search/youtube.js | 32 ++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/commands/message/search/youtube.js b/commands/message/search/youtube.js index 27f014f..0973b3a 100644 --- a/commands/message/search/youtube.js +++ b/commands/message/search/youtube.js @@ -34,9 +34,9 @@ function createYoutubePage(context, result){ switch(result.type){ case 1: //video iconHeader = [ - iconPill("eye", intToString(parseInt(result.metadata.views))), - iconPill("like", intToString(parseInt(result.metadata.likes))), - iconPill("message", intToString(parseInt(result.metadata.comments))) + iconPill("eye", intToString(parseInt(result.metadata.views)) + ' Views'), + iconPill("like", intToString(parseInt(result.metadata.likes)) + ' Likes'), + '\n' + iconPill("message", intToString(parseInt(result.metadata.comments)) + ' Comments') ] res = page(createEmbed("default", context, { author: { @@ -44,7 +44,7 @@ function createYoutubePage(context, result){ url: result.channel.url, iconUrl: result.channel.icon }, - description: `**${link(result.url, result.name)}**\n${iconHeader.join(' ​ ​ ​ ​')}\n*Uploaded ${timestamp(result.date, "f")}*\n\n${result.description}`, + description: `**${link(result.url, result.name)}**\n\n${iconHeader.join(' ​ ​ ​ ​')}\n\n${result.description}`, thumbnail: { url: result.image }, @@ -56,11 +56,17 @@ function createYoutubePage(context, result){ break; case 2: // channel iconHeader = [ - iconPill("videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US'))), - iconPill("eye", intToString(parseInt(result.metadata.views).toLocaleString('en-US'))) + iconPill("people", intToString(parseInt(result.metadata.subscribers).toLocaleString('en-US')) + ' Subscribers'), + iconPill("eye", intToString(parseInt(result.metadata.views).toLocaleString('en-US')) + ' Views'), + '\n' + iconPill("videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US')) + ' Videos'), ] res = page(createEmbed("default", context, { - description: `**${link(result.url, result.name)}**\n${iconHeader.join(' ​ ​ ​ ​')}\n*Created ${timestamp(result.date, "f")}*\n\n${result.description}`, + author: { + name: result.name, + url: result.url, + iconUrl: result.icon + }, + description: `${iconHeader.join(' ​ ​ ​ ​')}\n\n${result.description}`, thumbnail: { url: result.icon }, @@ -72,10 +78,16 @@ function createYoutubePage(context, result){ break; case 3: // playlist iconHeader = [ - iconPill("videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US'))) + '', + iconPill("videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US')) + ' Videos') ] res = page(createEmbed("default", context, { - description: `**${link(result.url, result.name)}**\n${iconHeader.join(' ​ ​ ​ ​')} ​ ​ ​ *Created ${timestamp(result.date, "f")}*\n\n${result.description}`, + author: { + name: result.channel.name, + url: result.channel.url, + iconUrl: result.channel.icon + }, + description: `**${link(result.url, result.name)}**${iconHeader.join(' ​ ​ ​ ​')}\n\n${result.description}`, thumbnail: { url: result.image }, @@ -85,7 +97,7 @@ function createYoutubePage(context, result){ } })) break; - default: // wtf? + default: break; } return res;