2022-07-18 20:44:19 +00:00
|
|
|
import { EmbedBuilder } from "discord.js";
|
2021-09-05 00:17:21 +00:00
|
|
|
|
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-08-22 09:38:20 +00:00
|
|
|
category: 'radio',
|
2021-09-05 00:17:21 +00:00
|
|
|
execute(interaction, client) {
|
2020-04-04 03:49:57 +00:00
|
|
|
let message = {};
|
2021-09-09 15:54:23 +00:00
|
|
|
|
2021-09-16 02:16:41 +00:00
|
|
|
if(!client.stations) {
|
2021-08-26 15:14:15 +00:00
|
|
|
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
2021-09-06 11:42:49 +00:00
|
|
|
return interaction.reply({
|
|
|
|
content: client.messageEmojis["error"] + message.errorToGetPlaylist,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
2021-08-26 15:14:15 +00:00
|
|
|
}
|
2021-09-09 09:44:50 +00:00
|
|
|
|
2021-09-02 12:00:04 +00:00
|
|
|
const radio = client.radio.get(interaction.guild.id);
|
2021-09-09 09:44:50 +00:00
|
|
|
|
2021-09-12 14:38:52 +00:00
|
|
|
if(radio && !client.config.maintenanceMode){
|
2021-09-05 00:11:51 +00:00
|
|
|
client.funcs.listStations(client, interaction);
|
2021-09-02 12:00:04 +00:00
|
|
|
} else {
|
2021-09-16 02:16:41 +00:00
|
|
|
let stations = `${client.stations.map(s => `**#** ${s.name}`).join('\n')}`
|
2021-09-02 12:00:04 +00:00
|
|
|
const hashs = stations.split('**#**').length;
|
|
|
|
for (let i = 0; i < hashs; i++) {
|
|
|
|
stations = stations.replace('**#**', `**${i + 1}.**`);
|
|
|
|
}
|
|
|
|
|
2022-07-18 20:44:19 +00:00
|
|
|
let embed = new EmbedBuilder()
|
2021-09-02 12:00:04 +00:00
|
|
|
.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')
|
2022-04-06 09:35:58 +00:00
|
|
|
.setFooter({
|
|
|
|
text: client.messages.footerText,
|
|
|
|
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')
|
|
|
|
});
|
2021-09-02 12:00:04 +00:00
|
|
|
|
|
|
|
interaction.reply({
|
|
|
|
embeds: [embed],
|
|
|
|
ephemeral: true
|
|
|
|
});
|
|
|
|
}
|
2020-03-09 11:29:04 +00:00
|
|
|
}
|
2021-09-09 09:44:50 +00:00
|
|
|
};
|