2024-07-24 19:27:50 +07:00
|
|
|
// Join a voice channel and do nothing
|
|
|
|
|
|
2024-07-25 10:25:11 +07:00
|
|
|
/*
|
|
|
|
|
Install:
|
|
|
|
|
- An Opus library: @discordjs/opus or opusscript
|
|
|
|
|
- An encryption packages:
|
|
|
|
|
+ sodium (best performance)
|
|
|
|
|
+ libsodium-wrappers
|
|
|
|
|
+ tweetnacl (slowest)
|
|
|
|
|
- ffmpeg (install and add to your system environment)
|
|
|
|
|
*/
|
|
|
|
|
|
2024-07-24 19:27:50 +07:00
|
|
|
const { Client } = require('../../src/index');
|
|
|
|
|
const client = new Client();
|
|
|
|
|
|
|
|
|
|
client.on('ready', async () => {
|
|
|
|
|
console.log(`${client.user.username} is ready!`);
|
|
|
|
|
const channel = client.channels.cache.get('voice_channel');
|
|
|
|
|
const connection = await client.voice.joinChannel(channel, {
|
|
|
|
|
selfMute: true,
|
|
|
|
|
selfDeaf: true,
|
|
|
|
|
selfVideo: false,
|
|
|
|
|
});
|
|
|
|
|
// Leave voice
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
connection.disconnect();
|
|
|
|
|
}, 5_000);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
client.login('token');
|