const voiceDiscord = require("@discordjs/voice"); module.exports = { name: "sound", description: "play a sound", aliases: [], async execute(message, client, args) { const channel = message.member.voice.channel; if (!channel) return message.channel.send("You must be in a VC to play the sound!"); const player = voiceDiscord.createAudioPlayer(); const resource = voiceDiscord.createAudioResource( "https://cdn.discordapp.com/attachments/952174406195638322/954299117679575080/no.mp3" ); const connection = voiceDiscord.joinVoiceChannel({ channelId: channel.id, guildId: message.guild.id, adapterCreator: message.guild.voiceAdapterCreator, }); player.play(resource); connection.subscribe(player); player.on(voiceDiscord.AudioPlayerStatus.Idle, () => { connection.destroy(); }); }, };