Update play command

This commit is contained in:
Christer Warén 2021-09-11 17:16:11 +03:00
parent 9517ba1fa9
commit b4a24de8cd

View File

@ -1,5 +1,4 @@
const { const {
createAudioPlayer,
getVoiceConnection, getVoiceConnection,
joinVoiceChannel joinVoiceChannel
} = require("@discordjs/voice"); } = require("@discordjs/voice");
@ -79,7 +78,6 @@ module.exports = {
ephemeral: true ephemeral: true
}); });
} else { } else {
url = client.stations[number].stream[client.stations[number].stream.default];
station = client.stations[number]; station = client.stations[number];
} }
} else { } else {
@ -92,19 +90,17 @@ module.exports = {
content: client.messageEmojis["error"] + client.messages.noSearchResults, content: client.messageEmojis["error"] + client.messages.noSearchResults,
ephemeral: true ephemeral: true
}); });
url = sstation.stream[sstation.stream.default];
station = sstation; station = sstation;
} }
if (radio) { if (radio) {
client.funcs.statisticsUpdate(client, interaction.guild, radio); client.funcs.statisticsUpdate(client, interaction.guild, radio);
radio.audioPlayer.stop();
let date = new Date(); let date = new Date();
radio.station = station; radio.station = station;
radio.textChannel = interaction.channel; radio.textChannel = interaction.channel;
radio.startTime = date.getTime(); radio.startTime = date.getTime();
client.funcs.play(interaction, interaction.guild, client, url); client.funcs.play(client, interaction, interaction.guild, station);
return; return;
} }
@ -114,7 +110,6 @@ module.exports = {
voiceChannel: voiceChannel, voiceChannel: voiceChannel,
connection: null, connection: null,
message: null, message: null,
audioPlayer: createAudioPlayer(),
station: station station: station
}; };
client.radio.set(interaction.guild.id, construct); client.radio.set(interaction.guild.id, construct);
@ -130,7 +125,7 @@ module.exports = {
construct.connection = connection; construct.connection = connection;
let date = new Date(); let date = new Date();
construct.startTime = date.getTime(); construct.startTime = date.getTime();
client.funcs.play(interaction, interaction.guild, client, url); client.funcs.play(client, interaction, interaction.guild, station);
client.datastore.checkEntry(interaction.guild.id); client.datastore.checkEntry(interaction.guild.id);
construct.currentGuild = client.datastore.getEntry(interaction.guild.id); construct.currentGuild = client.datastore.getEntry(interaction.guild.id);