Added ding.mp3 that plays before the reciever is invoked

This commit is contained in:
Sravanth Chebrolu 2020-09-10 13:35:30 +05:30
parent a1d2653b0f
commit c8d0754033
2 changed files with 6 additions and 1 deletions

View file

@ -11,7 +11,7 @@ const appendChunkToFile = (fileName) => {
client.on('message', msg => { client.on('message', msg => {
if (msg.content.startsWith(config.PREFIX)) { if (msg.content.startsWith(config.PREFIX)) {
const commandBody = msg.content.split(config.PREFIX)[1].split(' '); const commandBody = msg.content.substring(config.PREFIX.length).split(' ');
const channelName = commandBody[1]; const channelName = commandBody[1];
if (commandBody[0] === ('enter') && commandBody[1] && commandBody[2]) { if (commandBody[0] === ('enter') && commandBody[1] && commandBody[2]) {
@ -23,7 +23,12 @@ client.on('message', msg => {
console.log(`Sliding into ${voiceChannel.name}...`); console.log(`Sliding into ${voiceChannel.name}...`);
voiceChannel.join() voiceChannel.join()
.then(conn => { .then(conn => {
const dispatcher = conn.play('./sounds/ding.mp3');
dispatcher.on('start', () => { console.log('ding.mp3 is playing..'); });
dispatcher.on('finish', () => { console.log('ding.mp3 has finished playing..'); });
console.log(`Joined ${voiceChannel.name}!\n\nREADY TO RECORD\n`); console.log(`Joined ${voiceChannel.name}!\n\nREADY TO RECORD\n`);
const receiver = conn.receiver; const receiver = conn.receiver;
conn.on('speaking', (user, speaking) => { conn.on('speaking', (user, speaking) => {
if (speaking) { if (speaking) {

BIN
sounds/ding.mp3 Normal file

Binary file not shown.