Created
January 9, 2019 17:45
-
-
Save BradleyJinks/779a3314871ae1927580f33c268a8236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Discord = require('discord.js'); | |
const client = new Discord.Client(); | |
client.on('ready', () => { | |
console.log(`Logged in as ${client.user.tag}!`); | |
let channel = client.channels.find('name', 'General'); | |
channel.join().then(connection => { | |
const receiver = connection.createReceiver(); | |
connection.on('speaking', (user, speaking) => { | |
console.log(user.username, 'speaking:', speaking); | |
if (speaking) { | |
const voiceStream = receiver.createOpusStream(user); | |
voiceStream.on('data', chunk => { | |
console.log(`voiceStream received: ${chunk}`); | |
}); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment