Updated next & prev command

This commit is contained in:
Christer Warén 2021-09-05 04:42:11 +03:00
parent 11573a5113
commit 8fdcdd0116
2 changed files with 24 additions and 2 deletions

View File

@ -6,7 +6,18 @@ module.exports = {
async execute(interaction, client, command) {
if (client.funcs.check(client, interaction, command)) {
const radio = client.radio.get(interaction.guild.id);
console.log(client.stations.find(station => station.name == radio.station.name));
let station = client.stations[client.stations.findIndex(station => station.name == radio.station.name) + 1];
client.funcs.statisticsUpdate(client, interaction.guild, radio);
radio.audioPlayer.stop();
let date = new Date();
radio.station = station;
radio.textChannel = interaction.channel;
radio.startTime = date.getTime();
client.funcs.play(interaction, interaction.guild, client, url);
return;
}
}
}

View File

@ -6,7 +6,18 @@ module.exports = {
async execute(interaction, client) {
if (client.funcs.check(client, interaction, command)) {
const radio = client.radio.get(interaction.guild.id);
console.log(client.stations.find(station => station.name == radio.station.name));
let station = client.stations[client.stations.findIndex(station => station.name == radio.station.name) - 1];
client.funcs.statisticsUpdate(client, interaction.guild, radio);
radio.audioPlayer.stop();
let date = new Date();
radio.station = station;
radio.textChannel = interaction.channel;
radio.startTime = date.getTime();
client.funcs.play(interaction, interaction.guild, client, url);
return;
}
}
}