discord.js-selfbot-v13/Document/VoiceCall.md
2022-05-21 21:14:59 +07:00

900 B

Setup

  • Before you use it, properly initialize the module (@discordjs/voice patch)
new Client({
  patchVoice: true, // Enable default
})

Usage: Call DM / Group DM

const dmChannel = client.channels.cache.get('id');
/* or
const dmChannel = User.dmChannel || await User.createDM();
*/
const connection = await dmChannel.call();
/* Return @discordjs/voice VoiceConnection */

Play Music using play-dl

const connection = await message.member.user.dmChannel.call();
const play = require('play-dl');
const {
	createAudioPlayer,
	createAudioResource,
} = require('@discordjs/voice');
let stream = await play.stream('youtube link');
let resource = createAudioResource(stream.stream, {
	inputType: stream.type,
});
let player = createAudioPlayer({
	behaviors: {
		noSubscriber: NoSubscriberBehavior.Play,
	},
});
player.play(resource);
connection.subscribe(player);