Updated play.js

This commit is contained in:
Christer Warén 2021-08-19 01:59:47 +03:00
parent 0b7c04d242
commit 97317449f9

View File

@ -113,7 +113,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();
play(interaction.guild, client, url); play(interaction, interaction.guild, client, url);
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);
@ -131,7 +131,7 @@ module.exports = {
} }
} }
}; };
function play(guild, client, url) { function play(interaction, guild, client, url) {
let message = {}; let message = {};
const radio = client.radio.get(guild.id); const radio = client.radio.get(guild.id);
const resource = createAudioResource(url); const resource = createAudioResource(url);
@ -152,11 +152,11 @@ function play(guild, client, url) {
console.error(error); console.error(error);
radio.connection.destroy(); radio.connection.destroy();
client.radio.delete(guild.id); client.radio.delete(guild.id);
return radio.textChannel.send(client.messages.errorPlaying); return interaction.reply(client.messages.errorPlaying);
}); });
message.play = client.messages.play.replace("%radio.station.name%", radio.station.name); message.play = client.messages.play.replace("%radio.station.name%", radio.station.name);
radio.textChannel.send(client.messageEmojis["play"] + message.play); interaction.reply(client.messageEmojis["play"] + message.play);
} }
function searchStation(key, client) { function searchStation(key, client) {