mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 01:13:17 +00:00
Updated list command
This commit is contained in:
parent
da71137f68
commit
12337f499b
@ -11,13 +11,61 @@ module.exports = {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
|
||||
if(radio){
|
||||
let menu = [];
|
||||
|
||||
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 => {
|
||||
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);
|
||||
});
|
||||
|
||||
menu = new Discord.MessageActionRow()
|
||||
.addComponents(
|
||||
new Discord.MessageSelectMenu()
|
||||
.setCustomId('play')
|
||||
.setPlaceholder('Change station')
|
||||
.addOptions(options[1])
|
||||
.addOptions(options[2])
|
||||
);
|
||||
|
||||
stations = null;
|
||||
options = null;
|
||||
|
||||
interaction.reply({
|
||||
content: '**Select station:**',
|
||||
components: [menu],
|
||||
ephemeral: true
|
||||
});
|
||||
} else {
|
||||
let stations = `${client.stations.map(s => `**#** ${s.name}`).join('\n')}`
|
||||
const hashs = stations.split('**#**').length;
|
||||
for (let i = 0; i < hashs; i++) {
|
||||
stations = stations.replace('**#**', `**${i + 1}.**`);
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.listTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
@ -29,4 +77,5 @@ module.exports = {
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user