- show subscribers on youtube channel

- display channel on playlists
- add labels to stat pills
This commit is contained in:
derpystuff 2023-07-18 00:41:10 +02:00
parent bfc3f1f186
commit 9b98c6de95

View file

@ -34,9 +34,9 @@ function createYoutubePage(context, result){
switch(result.type){ switch(result.type){
case 1: //video case 1: //video
iconHeader = [ iconHeader = [
iconPill("eye", intToString(parseInt(result.metadata.views))), iconPill("eye", intToString(parseInt(result.metadata.views)) + ' Views'),
iconPill("like", intToString(parseInt(result.metadata.likes))), iconPill("like", intToString(parseInt(result.metadata.likes)) + ' Likes'),
iconPill("message", intToString(parseInt(result.metadata.comments))) '\n' + iconPill("message", intToString(parseInt(result.metadata.comments)) + ' Comments')
] ]
res = page(createEmbed("default", context, { res = page(createEmbed("default", context, {
author: { author: {
@ -44,7 +44,7 @@ function createYoutubePage(context, result){
url: result.channel.url, url: result.channel.url,
iconUrl: result.channel.icon 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: { thumbnail: {
url: result.image url: result.image
}, },
@ -56,11 +56,17 @@ function createYoutubePage(context, result){
break; break;
case 2: // channel case 2: // channel
iconHeader = [ iconHeader = [
iconPill("videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US'))), iconPill("people", intToString(parseInt(result.metadata.subscribers).toLocaleString('en-US')) + ' Subscribers'),
iconPill("eye", intToString(parseInt(result.metadata.views).toLocaleString('en-US'))) 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, { 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: { thumbnail: {
url: result.icon url: result.icon
}, },
@ -72,10 +78,16 @@ function createYoutubePage(context, result){
break; break;
case 3: // playlist case 3: // playlist
iconHeader = [ 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, { 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: { thumbnail: {
url: result.image url: result.image
}, },
@ -85,7 +97,7 @@ function createYoutubePage(context, result){
} }
})) }))
break; break;
default: // wtf? default:
break; break;
} }
return res; return res;