2021-08-18 22:59:55 +00:00
|
|
|
module.exports = function (client, interaction, command) {
|
2020-03-12 22:57:20 +00:00
|
|
|
let message = {};
|
2021-08-18 22:53:04 +00:00
|
|
|
const radio = client.radio.get(interaction.guild.id);
|
|
|
|
const permissions = interaction.channel.permissionsFor(interaction.user);
|
2021-09-05 00:33:48 +00:00
|
|
|
if(!client.stations) {
|
|
|
|
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
2021-09-05 03:22:47 +00:00
|
|
|
interaction.reply({
|
2021-09-05 00:33:48 +00:00
|
|
|
content: client.messageEmojis["error"] + message.errorToGetPlaylist,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
2021-09-05 03:22:47 +00:00
|
|
|
return false;
|
2021-09-05 00:33:48 +00:00
|
|
|
}
|
2020-03-22 15:10:46 +00:00
|
|
|
if (!radio) {
|
2021-08-26 19:06:15 +00:00
|
|
|
interaction.reply({
|
|
|
|
content: client.messageEmojis["error"] + client.messages.notPlaying,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
2020-03-13 18:55:50 +00:00
|
|
|
return false;
|
|
|
|
}
|
2021-08-18 22:53:04 +00:00
|
|
|
if (interaction.member.voice.channel !== radio.voiceChannel) {
|
2021-08-26 19:06:15 +00:00
|
|
|
interaction.reply({
|
|
|
|
content: client.messageEmojis["error"] + client.messages.wrongVoiceChannel,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
2020-03-13 18:55:50 +00:00
|
|
|
return false;
|
|
|
|
}
|
2020-03-30 01:20:45 +00:00
|
|
|
if(!command.permission == 'none'){
|
|
|
|
if (!permissions.has(command.permission)) {
|
|
|
|
message.noPerms = client.messages.noPerms.replace("%command.permission%", command.permission);
|
2021-08-26 19:06:15 +00:00
|
|
|
interaction.reply({
|
|
|
|
content: client.messageEmojis["error"] + message.noPerms,
|
|
|
|
ephemeral: true
|
|
|
|
});
|
2020-03-30 01:20:45 +00:00
|
|
|
return false;
|
|
|
|
} else return true;
|
2020-03-02 19:38:42 +00:00
|
|
|
} else return true;
|
|
|
|
};
|