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
This commit is contained in:
parent
4209113dc0
commit
ed28d27738
6
bot.js
6
bot.js
@ -8,7 +8,7 @@ const ytdl = require('ytdl-core-discord');
|
|||||||
// Include our local auth key, so that we don't leak keys
|
// Include our local auth key, so that we don't leak keys
|
||||||
const auth = require('./auth.json');
|
const auth = require('./auth.json');
|
||||||
// Volume for playback (fraction)
|
// Volume for playback (fraction)
|
||||||
var volume = 0.6;
|
const volume = 0.60;
|
||||||
|
|
||||||
// **** PROGRAM START ****
|
// **** PROGRAM START ****
|
||||||
// This program is 2 lines of code, the rest is callback function definition, wherein the bot magic happens
|
// 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();
|
const connection = await message.member.voice.channel.join();
|
||||||
// TODO: Switch to fs-based file read?
|
// TODO: Switch to fs-based file read?
|
||||||
// Play the sound file as requested
|
// 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('start', () => { console.log(`Playing ${soundPath}`); });
|
||||||
dispatcher.on('finish', () => { console.log(`Finished ${soundPath}`); });
|
dispatcher.on('finish', () => { console.log(`Finished ${soundPath}`); });
|
||||||
dispatcher.on('error', console.error);
|
dispatcher.on('error', console.error);
|
||||||
@ -165,7 +165,7 @@ client.on('message', async message => {
|
|||||||
// Play the video as requested
|
// Play the video as requested
|
||||||
try {
|
try {
|
||||||
//TODO: process the timestamp with ffmpeg or whatever
|
//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('start', () => { console.log(`Playing ${yturl}`); });
|
||||||
dispatcher.on('finish', () => { console.log(`Finished ${yturl}`); });
|
dispatcher.on('finish', () => { console.log(`Finished ${yturl}`); });
|
||||||
dispatcher.on('error', console.error);
|
dispatcher.on('error', console.error);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user