mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2026-01-09 13:55:43 +00:00
Fix now playing logic - move track from station to radio interface
Co-authored-by: cwchristerw <13464896+cwchristerw@users.noreply.github.com>
This commit is contained in:
@@ -10,6 +10,7 @@ export interface radio {
|
|||||||
connection: VoiceConnection | undefined,
|
connection: VoiceConnection | undefined,
|
||||||
message: Message | null,
|
message: Message | null,
|
||||||
station: station,
|
station: station,
|
||||||
|
track?: string,
|
||||||
datastore?: datastore,
|
datastore?: datastore,
|
||||||
currentTime?: number,
|
currentTime?: number,
|
||||||
startTime: number,
|
startTime: number,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ export interface station {
|
|||||||
type: "radioplay" | "supla" | "yle",
|
type: "radioplay" | "supla" | "yle",
|
||||||
address: string | string
|
address: string | string
|
||||||
}
|
}
|
||||||
track?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Stations extends Array {
|
export default class Stations extends Array {
|
||||||
|
|||||||
@@ -20,27 +20,27 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
});
|
});
|
||||||
|
|
||||||
radio.station.track = "-";
|
radio.track = "-";
|
||||||
|
|
||||||
if(playlist){
|
if(playlist){
|
||||||
switch(radio.station.playlist.type){
|
switch(radio.station.playlist.type){
|
||||||
case "radioplay":
|
case "radioplay":
|
||||||
if(playlist[0] && playlist[0].stationNowPlaying && playlist[0].stationNowPlaying.nowPlayingArtist && playlist[0].stationNowPlaying.nowPlayingTrack){
|
if(playlist[0] && playlist[0].stationNowPlaying && playlist[0].stationNowPlaying.nowPlayingArtist && playlist[0].stationNowPlaying.nowPlayingTrack){
|
||||||
radio.station.track = "__" + playlist[0].stationNowPlaying.nowPlayingArtist + "__" + "\n" + playlist[0].stationNowPlaying.nowPlayingTrack;
|
radio.track = "__" + playlist[0].stationNowPlaying.nowPlayingArtist + "__" + "\n" + playlist[0].stationNowPlaying.nowPlayingTrack;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "supla":
|
case "supla":
|
||||||
if(playlist.items && playlist.items[0] && playlist.items[0].artist && playlist.items[0].song){
|
if(playlist.items && playlist.items[0] && playlist.items[0].artist && playlist.items[0].song){
|
||||||
radio.station.track = "__" + playlist.items[0].artist + "__" + "\n" + playlist.items[0].song;
|
radio.track = "__" + playlist.items[0].artist + "__" + "\n" + playlist.items[0].song;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "yle":
|
case "yle":
|
||||||
if(playlist.data && playlist.data.performer && playlist.data.title){
|
if(playlist.data && playlist.data.performer && playlist.data.title){
|
||||||
radio.station.track = "__" + playlist.data.performer + "__" + "\n" + playlist.data.title;
|
radio.track = "__" + playlist.data.performer + "__" + "\n" + playlist.data.title;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
radio.station.track = "-";
|
radio.track = "-";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,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 != undefined ? "\n\n" + radio.station.track : "-"
|
"%radio.station.track%": radio.track != undefined ? "\n\n" + radio.track : "-"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -135,27 +135,27 @@ export default async function play(client: RadioClient, interaction: ChatInputCo
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
});
|
});
|
||||||
|
|
||||||
radio.station.track = "-";
|
radio.track = "-";
|
||||||
|
|
||||||
if(playlist){
|
if(playlist){
|
||||||
switch(radio.station.playlist?.type){
|
switch(radio.station.playlist?.type){
|
||||||
case "radioplay":
|
case "radioplay":
|
||||||
if(playlist[0] && playlist[0].stationNowPlaying && playlist[0].stationNowPlaying.nowPlayingArtist && playlist[0].stationNowPlaying.nowPlayingTrack){
|
if(playlist[0] && playlist[0].stationNowPlaying && playlist[0].stationNowPlaying.nowPlayingArtist && playlist[0].stationNowPlaying.nowPlayingTrack){
|
||||||
radio.station.track = "__" + playlist[0].stationNowPlaying.nowPlayingArtist + "__" + "\n" + playlist[0].stationNowPlaying.nowPlayingTrack;
|
radio.track = "__" + playlist[0].stationNowPlaying.nowPlayingArtist + "__" + "\n" + playlist[0].stationNowPlaying.nowPlayingTrack;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "supla":
|
case "supla":
|
||||||
if(playlist.items && playlist.items[0] && playlist.items[0].artist && playlist.items[0].song){
|
if(playlist.items && playlist.items[0] && playlist.items[0].artist && playlist.items[0].song){
|
||||||
radio.station.track = "__" + playlist.items[0].artist + "__" + "\n" + playlist.items[0].song;
|
radio.track = "__" + playlist.items[0].artist + "__" + "\n" + playlist.items[0].song;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "yle":
|
case "yle":
|
||||||
if(playlist.data && playlist.data.performer && playlist.data.title){
|
if(playlist.data && playlist.data.performer && playlist.data.title){
|
||||||
radio.station.track = "__" + playlist.data.performer + "__" + "\n" + playlist.data.title;
|
radio.track = "__" + playlist.data.performer + "__" + "\n" + playlist.data.title;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
radio.station.track = "-";
|
radio.track = "-";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,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 != undefined ? "\n\n" + radio.station.track : "-"
|
"%radio.station.track%": radio.track != undefined ? "\n\n" + radio.track : "-"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user