2021-09-04 23:12:43 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'next',
|
|
|
|
description: 'Next Station',
|
2021-09-05 03:26:34 +00:00
|
|
|
category: 'radio',
|
2021-09-05 00:37:03 +00:00
|
|
|
async execute(interaction, client, command) {
|
|
|
|
if (client.funcs.check(client, interaction, command)) {
|
|
|
|
const radio = client.radio.get(interaction.guild.id);
|
2021-09-09 09:44:50 +00:00
|
|
|
|
2021-09-16 02:16:41 +00:00
|
|
|
let index = client.stations.findIndex(station => station.name == radio.station.name) + 1;
|
|
|
|
if(index == client.stations.length) index = 0;
|
2021-09-05 02:41:13 +00:00
|
|
|
|
2021-09-16 02:16:41 +00:00
|
|
|
let station = client.stations[index];
|
2021-09-05 02:41:13 +00:00
|
|
|
|
|
|
|
if(!station) return interaction.reply({
|
|
|
|
content: client.messageEmojis["error"] + client.messages.noSearchResults,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
|
|
|
|
2021-09-16 01:52:30 +00:00
|
|
|
client.statistics.update(client, interaction.guild, radio);
|
2021-09-09 09:44:50 +00:00
|
|
|
|
2021-09-05 01:42:11 +00:00
|
|
|
let date = new Date();
|
|
|
|
radio.station = station;
|
|
|
|
radio.textChannel = interaction.channel;
|
|
|
|
radio.startTime = date.getTime();
|
2021-09-06 19:35:14 +00:00
|
|
|
|
|
|
|
if(interaction.isCommand()) {
|
2021-09-11 14:15:04 +00:00
|
|
|
client.funcs.play(client, interaction, interaction.guild, station);
|
2021-09-06 19:35:14 +00:00
|
|
|
}
|
|
|
|
if(interaction.isButton()) {
|
|
|
|
interaction.deferUpdate();
|
2021-09-11 14:15:04 +00:00
|
|
|
client.funcs.play(client, null, interaction.guild, station);
|
2021-09-06 19:35:14 +00:00
|
|
|
}
|
2021-09-04 23:12:43 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-09 09:44:50 +00:00
|
|
|
}
|