LEON
LEON
DIAdiscord.js - Imagine an app
Created by LEON on 8/17/2023 in #djs-voice
how to make echobot
No description
5 replies
DIAdiscord.js - Imagine an app
Created by LEON on 8/17/2023 in #djs-voice
how to make echobot
No description
5 replies
DIAdiscord.js - Imagine an app
Created by LEON on 8/17/2023 in #djs-voice
how to make echobot
my attempt:
const { createAudioPlayer, createAudioResource } = require('@discordjs/voice');
const { Client } = require('discord.js');

const client = new Client();

client.on('ready', async() => {
const channel = client.channels.cache.get('1085977431808159744');
const connection = await joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
selfDeaf: false,
selfMute: false
});

const player = createAudioPlayer();
const receiver = connection.receiver;

receiver.speaking.on('start', (userId) => {
console.log(`${userId} - started talking`)

if (userId === '633223783204782090') {
const audioStream = receiver.subscribe(userId);
const resource = createAudioResource(audioStream);

player.play(resource);
connection.subscribe(player);
}
});

receiver.speaking.on('end', (userId) => {
console.log(`${userId} - stopped talking`)

if (userId === '633223783204782090') {
player.stop();
}
});
});
const { createAudioPlayer, createAudioResource } = require('@discordjs/voice');
const { Client } = require('discord.js');

const client = new Client();

client.on('ready', async() => {
const channel = client.channels.cache.get('1085977431808159744');
const connection = await joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
selfDeaf: false,
selfMute: false
});

const player = createAudioPlayer();
const receiver = connection.receiver;

receiver.speaking.on('start', (userId) => {
console.log(`${userId} - started talking`)

if (userId === '633223783204782090') {
const audioStream = receiver.subscribe(userId);
const resource = createAudioResource(audioStream);

player.play(resource);
connection.subscribe(player);
}
});

receiver.speaking.on('end', (userId) => {
console.log(`${userId} - stopped talking`)

if (userId === '633223783204782090') {
player.stop();
}
});
});
5 replies
DIAdiscord.js - Imagine an app
Created by LEON on 4/14/2023 in #djs-questions
Ratelimit question.
thanks
6 replies