From ed28d27738d4a26d64c895787a8c4cb9bc790511 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 11 Jun 2022 02:03:11 -0700 Subject: [PATCH] Make use of the defined volume variable One of @moosecrab 's previous commits defined this variable at the global scope, but then did nothing with it --- bot.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot.js b/bot.js index 7c8653a..ed1df51 100644 --- a/bot.js +++ b/bot.js @@ -8,7 +8,7 @@ const ytdl = require('ytdl-core-discord'); // Include our local auth key, so that we don't leak keys const auth = require('./auth.json'); // Volume for playback (fraction) -var volume = 0.6; +const volume = 0.60; // **** PROGRAM START **** // This program is 2 lines of code, the rest is callback function definition, wherein the bot magic happens @@ -115,7 +115,7 @@ client.on('message', async message => { const connection = await message.member.voice.channel.join(); // TODO: Switch to fs-based file read? // Play the sound file as requested - const dispatcher = connection.play(soundPath, { volume: 0.60 }); + const dispatcher = connection.play(soundPath, { volume: volume }); dispatcher.on('start', () => { console.log(`Playing ${soundPath}`); }); dispatcher.on('finish', () => { console.log(`Finished ${soundPath}`); }); dispatcher.on('error', console.error); @@ -165,7 +165,7 @@ client.on('message', async message => { // Play the video as requested try { //TODO: process the timestamp with ffmpeg or whatever - const dispatcher = connection.play(await ytdl(yturl), { type: 'opus', volume: 0.60, begin: timestamp}); + const dispatcher = connection.play(await ytdl(yturl), { type: 'opus', volume: volume, begin: timestamp}); dispatcher.on('start', () => { console.log(`Playing ${yturl}`); }); dispatcher.on('finish', () => { console.log(`Finished ${yturl}`); }); dispatcher.on('error', console.error);