From 88e82d101c83497644d949cfaa1a4db3716358db Mon Sep 17 00:00:00 2001 From: Supositware Date: Wed, 2 Jan 2019 10:48:26 +0100 Subject: [PATCH] --- commands/admin/autoresponse.js | 10 +++++----- commands/admin/shameboard.js | 6 +++--- commands/admin/starboard.js | 6 +++--- commands/admin/tag.js | 6 +++--- commands/admin/untag.js | 4 ++-- commands/general/tts.js | 6 +++--- commands/general/ttsvc.js | 2 +- commands/utility/download.js | 4 ++-- commands/utility/taglist.js | 4 ++-- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/commands/admin/autoresponse.js b/commands/admin/autoresponse.js index c3d1d3c..de1d309 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 9e669bc..e3aa8c2 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 5398737..7ceb261 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 31f819e..6324c2e 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 11e1d69..f8785d7 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 a6237aa..91234ff 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 bb1e4a0..d489e67 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 106ff47..735d9cb 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 773bf3c..4321282 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?'); } }