mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2026-03-10 05:34:22 +00:00
Add track info from Supla playlist
This commit is contained in:
@@ -16,6 +16,24 @@ export default {
|
||||
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
||||
const completed = (radio.playTime);
|
||||
|
||||
if(radio.station?.playlist?.type == "supla" || radio.station?.playlist?.type == "yle"){
|
||||
let playlist: any = await fetch(radio.station.playlist.address)
|
||||
.then((response: Response) => response.json())
|
||||
.catch(error => {
|
||||
});
|
||||
|
||||
switch(radio.station?.playlist.type){
|
||||
case "supla":
|
||||
radio.station.track = "__" + playlist.items[0].artist + "__" + "\n" + playlist.items[0].song;
|
||||
break;
|
||||
case "yle":
|
||||
radio.station.track = "-";
|
||||
break;
|
||||
default:
|
||||
radio.station.track = "-";
|
||||
}
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.nowplayingTitle)
|
||||
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messages.emojis["play"].replace(/[^0-9]+/g, '')))
|
||||
@@ -23,7 +41,8 @@ export default {
|
||||
.setDescription(client.messages.replace(client.messages.nowplayingDescription, {
|
||||
"%radio.station.name%": radio.station.name,
|
||||
"%radio.station.owner%\n": radio.station.name != radio.station.owner ? radio.station.owner + "\n" : "",
|
||||
"%client.funcs.msToTime(completed)%": client.funcs.msToTime(completed)
|
||||
"%client.funcs.msToTime(completed)%": client.funcs.msToTime(completed),
|
||||
"\n\n%radio.station.track%": radio.station.track != "-" ? "\n\n" + radio.station.track : ""
|
||||
}))
|
||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||
.setFooter({
|
||||
|
||||
Reference in New Issue
Block a user