Updated play command

This commit is contained in:
Christer Warén 2021-09-06 05:22:20 +03:00
parent 9303dd1c19
commit aa715aaafa

View File

@ -15,14 +15,14 @@ module.exports = {
category: "radio", category: "radio",
async execute(interaction, client) { async execute(interaction, client) {
let message = {}; let message = {};
let query = interaction.options?.getString("query") ?? interaction.values?.[0];
if(!query){
if(!client.stations) { if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist); return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
} }
client.funcs.listStations(client, interaction); let query = interaction.options?.getString("query") ?? interaction.values?.[0];
if(!query){
return client.funcs.listStations(client, interaction);
} }
let url = query ? query.replace(/<(.+)>/g, "$1") : ""; let url = query ? query.replace(/<(.+)>/g, "$1") : "";
const radio = client.radio.get(interaction.guild.id); const radio = client.radio.get(interaction.guild.id);
@ -40,16 +40,6 @@ module.exports = {
ephemeral: true ephemeral: true
}); });
} }
if (!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace(
"%client.config.supportGuild%",
client.config.supportGuild
);
return interaction.reply({
content: client.messageEmojis["error"] + message.errorToGetPlaylist,
ephemeral: true
});
}
if (!query) return interaction.reply(client.messages.noQuery); if (!query) return interaction.reply(client.messages.noQuery);
const permissions = voiceChannel.permissionsFor(interaction.client.user); const permissions = voiceChannel.permissionsFor(interaction.client.user);
if (!permissions.has("CONNECT")) { if (!permissions.has("CONNECT")) {