Compare commits

..

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
aff9a67e2c Fix now playing logic - move track from station to radio interface
Co-authored-by: cwchristerw <13464896+cwchristerw@users.noreply.github.com>
2026-01-06 22:32:16 +00:00
copilot-swe-agent[bot]
ff8d6bc273 Initial plan 2026-01-06 22:26:59 +00:00
5 changed files with 25 additions and 25 deletions

20
package-lock.json generated
View File

@@ -1,19 +1,19 @@
{ {
"name": "eximiabots-radiox", "name": "eximiabots-radiox",
"version": "0.5.14", "version": "0.5.13",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "eximiabots-radiox", "name": "eximiabots-radiox",
"version": "0.5.14", "version": "0.5.13",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@discordjs/voice": "^0.19.0", "@discordjs/voice": "^0.19.0",
"@snazzah/davey": "^0.1.9", "@snazzah/davey": "^0.1.9",
"discord.js": "^14.25.1", "discord.js": "^14.25.1",
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"libsodium-wrappers": "^0.8.0", "libsodium-wrappers": "^0.7.16",
"path": "^0.12.7" "path": "^0.12.7"
}, },
"devDependencies": { "devDependencies": {
@@ -646,18 +646,18 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/libsodium": { "node_modules/libsodium": {
"version": "0.8.0", "version": "0.7.16",
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.8.0.tgz", "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.16.tgz",
"integrity": "sha512-GQ4Sg0/Z0Ui6ZvKeTd8bH7VAAqk1ZHZDAo/pcuSi0uPbIN6LYAAotR0GEYb8v+y4/tSsXZPr06D6hhqKd7tnoQ==", "integrity": "sha512-3HrzSPuzm6Yt9aTYCDxYEG8x8/6C0+ag655Y7rhhWZM9PT4NpdnbqlzXhGZlDnkgR6MeSTnOt/VIyHLs9aSf+Q==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/libsodium-wrappers": { "node_modules/libsodium-wrappers": {
"version": "0.8.0", "version": "0.7.16",
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.8.0.tgz", "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.16.tgz",
"integrity": "sha512-PVyXAtP1nmpQrDKAVnA8pir0f7bj7vmMGs7mb+0OCSJ+BOfLNBb5hPy2GHfrx6cQ+Co9fMliR5R0WRbVuMllNA==", "integrity": "sha512-Gtr/WBx4dKjvRL1pvfwZqu7gO6AfrQ0u9vFL+kXihtHf6NfkROR8pjYWn98MFDI3jN19Ii1ZUfPR9afGiPyfHg==",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"libsodium": "^0.8.0" "libsodium": "^0.7.16"
} }
}, },
"node_modules/lodash": { "node_modules/lodash": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "eximiabots-radiox", "name": "eximiabots-radiox",
"version": "0.5.14", "version": "0.5.13",
"description": "Internet Radio to your Discord guild", "description": "Internet Radio to your Discord guild",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@@ -22,7 +22,7 @@
"@snazzah/davey": "^0.1.9", "@snazzah/davey": "^0.1.9",
"discord.js": "^14.25.1", "discord.js": "^14.25.1",
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"libsodium-wrappers": "^0.8.0", "libsodium-wrappers": "^0.7.16",
"path": "^0.12.7" "path": "^0.12.7"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -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,

View File

@@ -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 {

View File

@@ -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 : "-"
}) })
}, },
{ {