mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 03:40:19 +00:00
Temp handle TypeError in missing playlist info
This commit is contained in:
parent
2d3c7e1184
commit
e690958cef
@ -21,10 +21,10 @@ export default {
|
|||||||
.then((response: Response) => response.json())
|
.then((response: Response) => response.json())
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
});
|
});
|
||||||
|
try {
|
||||||
switch(radio.station?.playlist.type){
|
switch(radio.station?.playlist.type){
|
||||||
case "supla":
|
case "supla":
|
||||||
radio.station.track = "__" + playlist.items[0].artist + "__" + "\n" + playlist.items[0].song;
|
radio.station.track = "__" + playlist.items[0]?.artist + "__" + "\n" + playlist.items[0]?.song;
|
||||||
break;
|
break;
|
||||||
case "yle":
|
case "yle":
|
||||||
radio.station.track = "-";
|
radio.station.track = "-";
|
||||||
@ -32,6 +32,9 @@ export default {
|
|||||||
default:
|
default:
|
||||||
radio.station.track = "-";
|
radio.station.track = "-";
|
||||||
}
|
}
|
||||||
|
} catch(TypeError) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
@ -42,7 +45,7 @@ export default {
|
|||||||
"%radio.station.name%": radio.station.name,
|
"%radio.station.name%": radio.station.name,
|
||||||
"%radio.station.owner%\n": radio.station.name != radio.station.owner ? radio.station.owner + "\n" : "",
|
"%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 : ""
|
"\n\n%radio.station.track%": radio.station.track != undefined ? "\n\n" + radio.station.track : ""
|
||||||
}))
|
}))
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter({
|
.setFooter({
|
||||||
|
@ -16,9 +16,10 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
switch(radio.station?.playlist.type){
|
switch(radio.station?.playlist.type){
|
||||||
case "supla":
|
case "supla":
|
||||||
radio.station.track = "__" + playlist.items[0].artist + "__" + "\n" + playlist.items[0].song;
|
radio.station.track = "__" + playlist.items[0]?.artist + "__" + "\n" + playlist.items[0]?.song;
|
||||||
break;
|
break;
|
||||||
case "yle":
|
case "yle":
|
||||||
radio.station.track = "-";
|
radio.station.track = "-";
|
||||||
@ -26,6 +27,9 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
default:
|
default:
|
||||||
radio.station.track = "-";
|
radio.station.track = "-";
|
||||||
}
|
}
|
||||||
|
} catch(TypeError) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
@ -42,7 +46,7 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
{
|
{
|
||||||
name: client.messages.playTitle2,
|
name: client.messages.playTitle2,
|
||||||
value: client.messages.replace(client.messages.playDescription2, {
|
value: client.messages.replace(client.messages.playDescription2, {
|
||||||
"%radio.station.track%": radio.station.track
|
"%radio.station.track%": radio.station.track != undefined ? "\n\n" + radio.station.track : "-"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
@ -102,7 +106,7 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
.then((response: Response) => response.json())
|
.then((response: Response) => response.json())
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
});
|
});
|
||||||
|
try {
|
||||||
switch(radio.station?.playlist.type){
|
switch(radio.station?.playlist.type){
|
||||||
case "supla":
|
case "supla":
|
||||||
if(radio.station.track != playlist.items[0].artist + "\n" + playlist.items[0].song){
|
if(radio.station.track != playlist.items[0].artist + "\n" + playlist.items[0].song){
|
||||||
@ -116,6 +120,9 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
default:
|
default:
|
||||||
radio.station.track = "-";
|
radio.station.track = "-";
|
||||||
}
|
}
|
||||||
|
} catch(TypeError) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(changed == true){
|
if(changed == true){
|
||||||
@ -133,7 +140,7 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
{
|
{
|
||||||
name: client.messages.playTitle2,
|
name: client.messages.playTitle2,
|
||||||
value: client.messages.replace(client.messages.playDescription2, {
|
value: client.messages.replace(client.messages.playDescription2, {
|
||||||
"%radio.station.track%": radio.station.track
|
"%radio.station.track%": radio.station.track != undefined ? "\n\n" + radio.station.track : "-"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
|
Loading…
Reference in New Issue
Block a user