Making interaction.options nullable in play.js

This commit is contained in:
Christer Warén 2021-08-31 10:48:04 +03:00
parent b5d5ca1fe6
commit 277b67e3df

View File

@ -17,7 +17,7 @@ module.exports = {
category: "radio",
async execute(interaction, client, Discord, command) {
let message = {};
let query = interaction.options.getString("query");
let query = interaction.options?.getString("query");
let url = query ? query.replace(/<(.+)>/g, "$1") : "";
const radio = client.radio.get(interaction.guild.id);
const voiceChannel = interaction.member.voice.channel;
@ -182,7 +182,6 @@ async function play(interaction, guild, client, url, Discord) {
.setCustomId('list')
.setEmoji(client.messageEmojis["list"])
.setStyle('PRIMARY')
.setDisabled(true)
)
.addComponents(
new Discord.MessageButton()
@ -193,10 +192,9 @@ async function play(interaction, guild, client, url, Discord) {
)
.addComponents(
new Discord.MessageButton()
.setCustomId('play')
.setCustomId('stop')
.setEmoji(client.messageEmojis["stop"])
.setStyle('PRIMARY')
.setDisabled(true)
)
.addComponents(
new Discord.MessageButton()
@ -210,7 +208,6 @@ async function play(interaction, guild, client, url, Discord) {
.setCustomId('statistics')
.setEmoji(client.messageEmojis["statistics"])
.setStyle('PRIMARY')
.setDisabled(true)
);
if(!radio.message){