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){ module.exports = function (client, interaction){
let stations = new Array(); let stations = new Array();
let options = 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 = { station = {
label: station.name, label: station.name,
description: station.owner, description: station.owner,
value: station.name value: station.name
}; };
options[1].push(station); options.push(station);
});
stations[2] = client.stations.slice(25).forEach(station => {
station = {
label: station.name,
description: station.owner,
value: station.name
};
options[2].push(station);
}); });
const menu = new Discord.MessageActionRow() const menu = new Discord.MessageActionRow()
@ -30,8 +19,7 @@ module.exports = function (client, interaction){
new Discord.MessageSelectMenu() new Discord.MessageSelectMenu()
.setCustomId('play') .setCustomId('play')
.setPlaceholder('Nothing selected') .setPlaceholder('Nothing selected')
.addOptions(options[1]) .addOptions(options)
.addOptions(options[2])
); );
stations = null; stations = null;