Updated listStations function

This commit is contained in:
Christer Warén 2021-09-06 00:52:35 +03:00
parent 2d9b0ce732
commit 552d3c81f9

View File

@ -2,27 +2,16 @@ import Discord from "discord.js";
module.exports = function (client, interaction){
let stations = new Array();
let options = new Array();
options[1] = new Array();
options[2] = new Array();
stations[1] = client.stations.slice(0,24).forEach(station => {
stations = client.stations.forEach(station => {
if(station.name == "GrooveFM") return;
station = {
label: station.name,
description: station.owner,
value: station.name
};
options[1].push(station);
});
stations[2] = client.stations.slice(25).forEach(station => {
station = {
label: station.name,
description: station.owner,
value: station.name
};
options[2].push(station);
options.push(station);
});
const menu = new Discord.MessageActionRow()
@ -30,8 +19,7 @@ module.exports = function (client, interaction){
new Discord.MessageSelectMenu()
.setCustomId('play')
.setPlaceholder('Nothing selected')
.addOptions(options[1])
.addOptions(options[2])
.addOptions(options)
);
stations = null;