Skip to content

@discordjs/voice example is incorrect #2

@mstan

Description

@mstan

Which package is this bug report for?

voice

Issue description

See:

connection.subscribe(player);

ISSUE: Bot will never begin playing audio because the "player" object will never emit 'stateChange'

PERCEIVED CAUSE: A state change is not being emitted until "player.play()" is called, which will emit the stateChange event that performs "attachRecorder()".

In the example, the following code is as follows:

const connection = await connectToChannel(channel);
connection.subscribe(player);
await message.reply('Playing now!');

Although a subscription is added, that in itself is not enough to emit a state change or cause the player to begin playing. In the example, following connection.subscribe(player), a new line with "player.play()" should be added.

Code sample

No response

Package version

v13.7

Node.js version

16.12

Operating system

Windows

Priority this issue should have

Medium (should be fixed soon)

Which partials do you have configured?

Not applicable (subpackage bug)

Which gateway intents are you subscribing to?

Not applicable (subpackage bug)

I have tested this issue on a development release

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions