text: const { MessageEmbed, MessageButton, MessageActionRow } = require("discord.js");
  const { check_if_dj } = require("../../handlers/functions");
  const wait = require('util').promisify(setTimeout);
  module.exports = {
  	name: "play",
  	description: "Play any music from youtube or spotify",
  	cooldown: 2,
  	requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL]
  	alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL]
  	options: [
  		{
  			"String": {
  				name: "song",
  				description: "Which song do you want to play?",
  				required: true
  			}
  		},
  	],
  	run: async (client, interaction) => {
  		try {
  			const { member, channelId, guildId, options } = interaction;
  			const { guild } = member;
  			const { channel } = member.voice;
  			let color = client.settings.get(guild.id, `audiomack`);
  			let emoji = client.settings.get(guild.id, `audioemoji`);
  			let rabbit = client.settings.get(guild.id, `emoji`);
  			const row = new MessageActionRow()
  			.addComponents(
  				new MessageButton()
  				.setLabel('Support Server')
  				.setURL("https://discord.com/invite/MJ5tYb4Jh9")
  				.setStyle('LINK')
  				.setEmoji('✈'),
  	
  				new MessageButton()
  				.setURL(`https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=1533303193591&scope=bot%20applications.commands`)
  				.setLabel("Invite")
  				.setEmoji('💌')
  				.setStyle("LINK"),
  			
  				new MessageButton()
  				.setLabel('Vote')
  				.setURL("https://top.gg/bot/897819791732121621")
  				.setStyle('LINK')
  				.setEmoji('🐰'),
  			)
  			if (!channel) {
  			return interaction.reply({
  			content: `**${rabbit} Drop a review on \`${client.user.username}\` using \`/info feedback\` **`,
  			embeds: [new MessageEmbed()
  			.setColor(color)
  			.setDescription(`You have to be in a voice channel to use this command!`)
  			.setTitle(`NOT IN A VOICE CHANNEL!`)
  			],
  			components: [row],
  			ephemeral: true
  			});
  			}
  			if (channel.guild.me.voice.channel && channel.guild.me.voice.channel.id != channel.id) {
  			return interaction.reply({
  			content: `**${rabbit} Drop a review on \`${client.user.username}\` using \`/info feedback\` **`,
  			embeds: [new MessageEmbed()
  			.setColor(color)
  			.setDescription(`You must be in the same voice channel as me - <#${guild.me.voice.channel.id}>`)
  			.setTitle(`NOT IN SAME VOICE!`)
  			],
  			components: [row],
  			ephemeral: true
  			});
  			}
  			if (channel.userLimit != 0 && channel.full)
  			return interaction.reply({
  			content: `**${rabbit} Drop a review on \`${client.user.username}\` using \`/info feedback\` **`,
  			embeds: [new MessageEmbed()
  		    .setColor(color)
  			.setTitle(`VOICE CHANNEL LIMIT!`)
  			.setDescription(`Your Voice Channel is full and I'm unable to join!`)
  			],
  			components: [row],
  			ephemeral: true
  			});
  			if (channel.guild.me.voice.channel && channel.guild.me.voice.channel.id != channel.id) {
  			return interaction.reply({
  			content: `**${rabbit} Drop a review on \`${client.user.username}\` using \`/info feedback\` **`,
  		    embeds: [new MessageEmbed()
  			.setColor(color)
  			.setTitle(`ALREADY IN A VOICE CHANNEL!`)
  			.setDescription(`Oops it seems I'm already connected to another channel`)
  			],
  			components: [row],
  			ephemeral: true
  			});
  			}
  			const Text = options.getString("song"); //same as in StringChoices //RETURNS STRING 
  			await interaction.reply({ content: `${emoji} **Searching...** \`${Text}\``, components: [row] });
  			try {
  			let queue = client.distube.getQueue(guildId)
  			let options = { member: member }
  			if (!queue) options.textChannel = guild.channels.cache.get(channelId)
  			await client.distube.playVoiceChannel(channel, Text, options)
  			//Edit the reply
  			interaction.editReply({ content: `${queue?.songs?.length > 0 ? " " + emoji + "  **Added:**" : " " + emoji + " **Now Playing:**"} \`${Text}\``, components: [row] });
  			await wait(4000);
  			interaction.deleteReply();
  			} catch (e) {
  			console.log(e.stack ? e.stack : e);
  			interaction.editReply({
  			embeds: [
  			new MessageEmbed()
  			.setColor("#e63064")
  			.setTitle("❌ AN ERROR OCCURED!")
  			.setDescription(`\`\`\`${e.stack.toString().substr(0, 800)}\`\`\``)
  			.setFooter("Error in code: Report this error to kotlin0427")
  			],
  			ephemeral: true
  			});
  			}
  		} catch (e) {
  			console.log(String(e.stack));
  		}
  	}
  }