How can I use opus to make my bot playing a specific mp3. in a voice channel with the command /play

I want to make a bot playing specific .mp3 in a voice channel, like that : /play {name of the mp3} and he play it
4 Replies
d.js toolkit
d.js toolkitβ€’10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Sun β˜€ | NTG | IT'S MY BIRTHDAY !
my code is like that for the moment https://pastebin.com/5JFNCwWS
Pastebin
Code - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
πŸŒΊπŸ‡«πŸ‡· Shigu :3 🌺
@ntgv_ You just leaked your token publicly. This is a minimal example you can use to get started
import { joinVoiceChannel, createAudioPlayer, createAudioResource } from "@discordjs/voice";

const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});

const player = createAudioPlayer();
const resource = createAudioResource(filepath);

// Needs GuildVoiceStates intent.
connection.subscribe(player);
player.play(resource);
import { joinVoiceChannel, createAudioPlayer, createAudioResource } from "@discordjs/voice";

const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});

const player = createAudioPlayer();
const resource = createAudioResource(filepath);

// Needs GuildVoiceStates intent.
connection.subscribe(player);
player.play(resource);
Sun β˜€ | NTG | IT'S MY BIRTHDAY !
don’t worry it’s a old token ok thanks for ur help !