2020-03-09 11:29:04 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'list',
|
2021-08-26 15:00:04 +00:00
|
|
|
description: 'List radio stations',
|
2020-03-09 11:29:04 +00:00
|
|
|
permission: 'none',
|
2020-08-22 09:38:20 +00:00
|
|
|
category: 'radio',
|
2021-08-18 22:52:16 +00:00
|
|
|
execute(interaction, client, Discord, command) {
|
2020-04-04 03:49:57 +00:00
|
|
|
let message = {};
|
2021-08-26 15:14:15 +00:00
|
|
|
if(!client.stations) {
|
|
|
|
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
|
|
|
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
|
|
|
}
|
2021-08-26 19:06:15 +00:00
|
|
|
|
2021-09-02 12:00:04 +00:00
|
|
|
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}.**`);
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
.setDescription(stations)
|
2021-09-03 00:46:44 +00:00
|
|
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
2021-09-02 12:00:04 +00:00
|
|
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
|
|
|
|
|
|
|
interaction.reply({
|
|
|
|
embeds: [embed],
|
|
|
|
ephemeral: true
|
|
|
|
});
|
|
|
|
}
|
2020-03-09 11:29:04 +00:00
|
|
|
}
|
|
|
|
};
|