Audio not playing

const Discord = require("discord.js")
const { Server, RCON, MasterServer } = require('@fabricio-191/valve-server-query');
const { joinVoiceChannel } = require("@discordjs/voice")
const { createAudioPlayer } = require('@discordjs/voice');
const { createAudioResource } = require('@discordjs/voice');


module.exports = {
name: "up",
description: "will @everyone when server goes up",
options: [
{
name: "ip",
type: 3,
description: "server query ip",
required: true
}
],
timeout: 5000,
run: async (interaction, client) => {
await interaction.reply('Will @everyone once server is up')
const voiceChannel = interaction.member.voice.channel
const ip = interaction.options.get("ip").value

const ipsemidone = ip.split(":")

const buff = 1
while (buff == 1){
try{
const server = await Server({
ip: ipsemidone[0],//`'${ipsemidone[0]}'`,
port: parseInt(ipsemidone[1]),//parseInt(ipsemidone[1]),
timeout: 700,
});
break
}catch(err){
console.log('server is down')
}
}

console.log('Server UP')
await interaction.channel.send('@everyone SERVER UP!')

const connection = joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator
})
const player = createAudioPlayer();
const resource = createAudioResource('C:\Users\ElBretxa\Desktop\Music-Slash-Bot-main\voicebooking-speech.mp3');
player.play(resource);


await interaction.channel.send('@everyone SERVER UP!')

//connection.destroy();
}
}
const Discord = require("discord.js")
const { Server, RCON, MasterServer } = require('@fabricio-191/valve-server-query');
const { joinVoiceChannel } = require("@discordjs/voice")
const { createAudioPlayer } = require('@discordjs/voice');
const { createAudioResource } = require('@discordjs/voice');


module.exports = {
name: "up",
description: "will @everyone when server goes up",
options: [
{
name: "ip",
type: 3,
description: "server query ip",
required: true
}
],
timeout: 5000,
run: async (interaction, client) => {
await interaction.reply('Will @everyone once server is up')
const voiceChannel = interaction.member.voice.channel
const ip = interaction.options.get("ip").value

const ipsemidone = ip.split(":")

const buff = 1
while (buff == 1){
try{
const server = await Server({
ip: ipsemidone[0],//`'${ipsemidone[0]}'`,
port: parseInt(ipsemidone[1]),//parseInt(ipsemidone[1]),
timeout: 700,
});
break
}catch(err){
console.log('server is down')
}
}

console.log('Server UP')
await interaction.channel.send('@everyone SERVER UP!')

const connection = joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator
})
const player = createAudioPlayer();
const resource = createAudioResource('C:\Users\ElBretxa\Desktop\Music-Slash-Bot-main\voicebooking-speech.mp3');
player.play(resource);


await interaction.channel.send('@everyone SERVER UP!')

//connection.destroy();
}
}
The bot joins the voice channel, but it doesnt play anything. I think I followed the steps from the resourses so just linking them wont help.
2 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
[ 💖 ] ElBretxa
Node : v18.12.1 - discord.js@13.6.0 Code showed above The bot doesnt play the audio file