From 36b3ba35625e49fc10df4a832079d8ba1c57bf13 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Fri, 21 Jan 2022 20:33:16 -0600 Subject: [PATCH] Add radio station from params util --- scripts/server/radio.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/server/radio.js b/scripts/server/radio.js index b0d3bade..889d6eaa 100644 --- a/scripts/server/radio.js +++ b/scripts/server/radio.js @@ -225,4 +225,22 @@ function reloadAllRadioStationsCommand(command, params, client) { messageAdminAction(`All radio stations have been reloaded by an admin!`); } +// =========================================================================== + +function getRadioStationFromParams(params) { + if(isNaN(params)) { + for(let i in getServerData().radioStations) { + if(toLowerCase(getServerData().radioStations[i].name).indexOf(toLowerCase(params)) != -1) { + return i; + } + } + } else { + if(typeof getServerData().radioStations[params] != "undefined") { + return toInteger(params); + } + } + + return false; +} + // =========================================================================== \ No newline at end of file