Skip to content

Play File #1067

Closed Answered by SQKo
axellotl22 asked this question in Q&A
Mar 13, 2023 · 1 comment
Discussion options

You must be logged in to vote
$discord->joinVoiceChannel($channel)->then(function (VoiceClient $voice) { // join voice channel

    $voice->playFile('sample-15s.mp3')->then(null, function ($e) { // sample-15s.mp3 is located relatively to your main bot.php file
        echo 'ERROR: '.$e->getMessage();
    })->done();
})->done();

where $channel is a voice channel

But you do not need to always joinVoiceChannel() if the bot is already in the channel.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by axellotl22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants