discord.js-selfbot-v13 icon indicating copy to clipboard operation
discord.js-selfbot-v13 copied to clipboard

RecordingAudio.js doesn't work correctly

Open ruka-64 opened this issue 7 months ago • 6 comments

Which package has the bugs?

The core library

Issue description

How to reproduce

  1. copy this code
  2. run (node RecordingAudio.js)
  3. Noise-filled sound coming from Speaker

Observed Behavior

Able to hear audio normally

Expected Behavior

Noise-filled sound coming from the speaker

Code sample

Copy&Pasted from example

const { Client } = require('discord.js-selfbot-v13');
const client = new Client();

const fs = require('fs');
const Speaker = require('speaker');

client.on('ready', async client => {
  console.log(`${client.user.username} is ready!`);

  const speaker = new Speaker({
    channels: 2, // 2 channels
    bitDepth: 16, // 16-bit samples
    sampleRate: 48000, // 48000 Hz sample rate
  });

  const channel = client.channels.cache.get('voice_id');
  const connection = await client.voice.joinChannel(channel, {
    selfMute: true,
    selfDeaf: true,
    selfVideo: false,
  });

  const audio = connection.receiver.createStream('user_id', {
    mode: 'pcm',
    end: 'manual',
    paddingSilence: true,
  });

  audio.pipe(fs.createWriteStream('test.pcm'));

  // After 15s
  setTimeout(() => {
    console.log('Stop recording');
    audio.destroy();
    // Play this record...
    fs.createReadStream('test.pcm').pipe(speaker);
  }, 15_000);
});


client.login('token');

Package version

^3.6.1

Node.js version

v22.14.0

Operating system

Ubuntu 20.04

Priority this issue should have

Medium (should be fixed soon)

Checklist

  • [x] I have searched the open issues for duplicates.
  • [x] I have shared the entire traceback.
  • [x] I am using a user token (and it isn't visible in the code).

Additional Information

Is Discord's implementation of E2EE having an impact? I have no idea what is going on, but it is true that even the sample code is no longer working correctly. I can confirm that playAudio() works fine.

ruka-64 avatar Apr 09 '25 14:04 ruka-64