Fiddlekins / podbot

A Discord bot designed to record voice chat audio, aimed at recording a specific podcast
82 stars 16 forks source link

processFragments.js is broken #4

Closed sandotto closed 7 years ago

sandotto commented 7 years ago

Does not work. node processFragments.js 123123123123

/home/me/discord/processFragments.js:159 fs.readdir(inputDirectory, async(err, files) => { ^ SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:393:7)
at startup (bootstrap_node.js:150:9)

Also, bot crashes on direct message command, so _onMessage should have a if(message.channel.type != "dm") { or similar.

Fiddlekins commented 7 years ago

Good catch regarding DMing the bot, fixed that now.

AS for the processFragments crashing - that syntax error is caused by node failing to interpret the async statement properly.

This is because it's a recent feature, and prior to v7.6.x of node you had to enable it with the --harmony flag. If you grab the latest version of node you shouldn't have any issues with it.