diff --git a/commands/admin/autoresponse.js b/commands/admin/autoresponse.js index c3d1d3c2..de1d3093 100644 --- a/commands/admin/autoresponse.js +++ b/commands/admin/autoresponse.js @@ -38,7 +38,7 @@ class autoresponseCommand extends Command { fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) { if (err) { - fs.close(2); + console.log(err); } else { @@ -48,14 +48,14 @@ class autoresponseCommand extends Command { json = json.replace(/[<#>]/g, ''); fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { if (err) { - fs.close(2); + return console.log(err); } }); } }); - fs.close(2); + return message.channel.send('Auto response have been disable/enable on every channel'); } else if (text == 'disable' || 'enable') { @@ -68,7 +68,7 @@ class autoresponseCommand extends Command { json = JSON.stringify(autoresponse); //convert it back to json fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { if (err) { - fs.close(2); + return console.log(err); } }); @@ -76,7 +76,7 @@ class autoresponseCommand extends Command { }); } - fs.close(2); + return message.channel.send(`Autoresponse have been ${text}d`); } } diff --git a/commands/admin/shameboard.js b/commands/admin/shameboard.js index 9e669bc4..e3aa8c2d 100644 --- a/commands/admin/shameboard.js +++ b/commands/admin/shameboard.js @@ -25,7 +25,7 @@ class shameboardCommand extends Command { if (err) { console.log(err); } - fs.close(2); + return message.channel.send('This channel have been set as the shameboard'); }); } else { @@ -34,13 +34,13 @@ class shameboardCommand extends Command { var json = JSON.stringify(shameboard); //convert it back to json fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { if (err) { - fs.close(2); + return console.log(err); } }); } }); - fs.close(2); + return message.channel.send('This channel have been set as the shameboard'); } } diff --git a/commands/admin/starboard.js b/commands/admin/starboard.js index 53987377..7ceb2613 100644 --- a/commands/admin/starboard.js +++ b/commands/admin/starboard.js @@ -25,7 +25,7 @@ class StarBoardCommand extends Command { if (err) { console.log(err); } - fs.close(2); + return message.channel.send('This channel have been set as the starboard'); }); } else { @@ -34,13 +34,13 @@ class StarBoardCommand extends Command { var json = JSON.stringify(starboard); //convert it back to json fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { if (err) { - fs.close(2); + return console.log(err); } }); } }); - fs.close(2); + return message.channel.send('This channel have been set as the starboard'); } } diff --git a/commands/admin/tag.js b/commands/admin/tag.js index 31f819ea..6324c2ee 100644 --- a/commands/admin/tag.js +++ b/commands/admin/tag.js @@ -39,7 +39,7 @@ class TagCommand extends Command { if (err) { fs.writeFile(`./tag/${message.guild.id}.json`, `{'${trigger}':'${response}'}`, function (err) { if (err) { - fs.close(2); + console.log(err); } }); @@ -49,14 +49,14 @@ class TagCommand extends Command { json = JSON.stringify(customresponse); //convert it back to json fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { if (err) { - fs.close(2); + return console.log(err); } }); } }); - fs.close(2); + return message.channel.send(`autoresponse have been set to ${trigger} : ${response}`); } } diff --git a/commands/admin/untag.js b/commands/admin/untag.js index 11e1d691..f8785d78 100644 --- a/commands/admin/untag.js +++ b/commands/admin/untag.js @@ -40,14 +40,14 @@ class UnTagCommand extends Command { json = JSON.stringify(customresponse); //convert it back to json fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { if (err) { - fs.close(2); + return console.log(err); } }); } }); - fs.close(2); + return message.channel.send(`The following autoresponse have been deleted: ${trigger}`); } diff --git a/commands/general/tts.js b/commands/general/tts.js index a6237aad..91234ff3 100644 --- a/commands/general/tts.js +++ b/commands/general/tts.js @@ -38,7 +38,7 @@ class TtsCommand extends Command { // Performs the Text-to-Speech request gclient.synthesizeSpeech(request, (err, response) => { if (err) { - fs.close(2); + console.error('ERROR:', err); return; } @@ -48,13 +48,13 @@ class TtsCommand extends Command { if (err) { console.error('ERROR:', err); message.channel.send('An error has occured, the message is probably too long'); - fs.close(2); + return; } console.log('Audio content written to file: tts.mp3'); message.channel.send({ files: ['./tts.mp3'] }); }); - fs.close(2); + }); } } diff --git a/commands/general/ttsvc.js b/commands/general/ttsvc.js index bb1e4a01..d489e67e 100644 --- a/commands/general/ttsvc.js +++ b/commands/general/ttsvc.js @@ -50,7 +50,7 @@ class TtsvcCommand extends Command { if (err) { console.error('ERROR:', err); message.channel.send('An error has occured, the message is probably too long'); - fs.close(2); + return; } console.log('Audio content written to file: ttsvc.mp3'); diff --git a/commands/utility/download.js b/commands/utility/download.js index 106ff47f..735d9cb2 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -43,10 +43,10 @@ class DownloadCommand extends Command { message.delete(); message.channel.send(`Downloaded by ${message.author.username}`, { files: ['./video.mp4'] }) .catch(() => message.channel.send('File too big')); - fs.close(2); + }); } else { - fs.close(2); + message.channel.send('You need to input a valid link'); } } diff --git a/commands/utility/taglist.js b/commands/utility/taglist.js index 773bf3c0..43212826 100644 --- a/commands/utility/taglist.js +++ b/commands/utility/taglist.js @@ -25,7 +25,7 @@ class taglistCommand extends Command { await fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { if (err) { console.log(err); - fs.close(2); + return; } let json = JSON.stringify(data); @@ -39,7 +39,7 @@ class taglistCommand extends Command { message.channel.send(tagEmbed); }); - fs.close(2); + message.channel.send('An error has occured, do you have any tags on the server?'); } }