- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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!
#no voice
20 messages · Page 1 of 1 (latest)
We don’t support TOS violations.
What are TOS Violations?
- Discord developer ToS: learn more
- ToS Q&A summary: learn more
In your case you violate them by proxy, because you violate YouTube‘s TOS
YouTube bans bot playback of its videos?
But I tried to play a video that I downloaded on my computer, and there was no sound either
To debug your voice connection and player:
- Use
debug: truewhen creating yourVoiceConnectionandAudioPlayer - Add an event listener to the <VoiceConnection> and the <AudioPlayer>:
// Add one for each class if applicable
<AudioPlayer | VoiceConnection>
.on('debug', console.log)
.on('error', console.error)
- Add an
errorlistener to the stream you are passing to the resource:
<Stream>.on('error', console.error)
Note: The
<>represents classes that need to be adapted to their respective name in your code
Getting Started: Installation - Extra Dependencies
read more
Show your dependency report
const fs = require('fs');
if (command === 'playlocal') {
const voiceChannel = message.member.voice.channel;
if (!voiceChannel) return message.channel.send('в канал зайди долбаеб.');
const connection = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator,
});
const filePath = './test.mp3';
const stream = fs.createReadStream(filePath);
const resource = createAudioResource(stream);
const player = createAudioPlayer();
player.play(resource);
connection.subscribe(player);
player.on('error', error => {
console.error(`ошибка долбаеб: ${error}`);
connection.destroy();
});
return message.channel.send(`сейчас хуярит: ${filePath}`);
} ```
This one, run it and show the result
And show your intents of your client constructor
Подключение к голосовому каналу...
Подключено. Получение потока...
Поток получен. Создание ресурса...
Ресурс создан. Воспроизведение...
Воспроизведение началось.
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.16.0
- prism-media: 1.3.5
Opus Libraries
- @discordjs/opus: not found
- opusscript: not found
Encryption Libraries
- sodium-native: not found
- sodium: not found
- libsodium-wrappers: not found
- tweetnacl: not found
FFmpeg
- version: 5.0.1-essentials_build-www.gyan.dev
- libopus: yes
--------------------------------------------------```
There’s your issue. You need to have an opus and a sodium lib installed
And what to install them for?
To… have sound?
Discord voice connections send encrypted opus packages. So unless your audio already is encoded as that /voice needs to transcode it before sending
Ok, I installed opus, do I need to change anything in the code?