This commit is contained in:
Supositware 2019-01-02 10:48:26 +01:00
parent e871aafef9
commit 88e82d101c
9 changed files with 24 additions and 24 deletions

View file

@ -38,7 +38,7 @@ class autoresponseCommand extends Command {
fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) { fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
fs.close(2);
console.log(err); console.log(err);
} else { } else {
@ -48,14 +48,14 @@ class autoresponseCommand extends Command {
json = json.replace(/[<#>]/g, ''); json = json.replace(/[<#>]/g, '');
fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(2);
return console.log(err); return console.log(err);
} }
}); });
} }
}); });
fs.close(2);
return message.channel.send('Auto response have been disable/enable on every channel'); return message.channel.send('Auto response have been disable/enable on every channel');
} else if (text == 'disable' || 'enable') { } else if (text == 'disable' || 'enable') {
@ -68,7 +68,7 @@ class autoresponseCommand extends Command {
json = JSON.stringify(autoresponse); //convert it back to json json = JSON.stringify(autoresponse); //convert it back to json
fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) { fs.writeFile('./json/autoresponse.json', json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(2);
return console.log(err); return console.log(err);
} }
}); });
@ -76,7 +76,7 @@ class autoresponseCommand extends Command {
}); });
} }
fs.close(2);
return message.channel.send(`Autoresponse have been ${text}d`); return message.channel.send(`Autoresponse have been ${text}d`);
} }
} }

View file

@ -25,7 +25,7 @@ class shameboardCommand extends Command {
if (err) { if (err) {
console.log(err); console.log(err);
} }
fs.close(2);
return message.channel.send('This channel have been set as the shameboard'); return message.channel.send('This channel have been set as the shameboard');
}); });
} else { } else {
@ -34,13 +34,13 @@ class shameboardCommand extends Command {
var json = JSON.stringify(shameboard); //convert it back to json var json = JSON.stringify(shameboard); //convert it back to json
fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(2);
return console.log(err); return console.log(err);
} }
}); });
} }
}); });
fs.close(2);
return message.channel.send('This channel have been set as the shameboard'); return message.channel.send('This channel have been set as the shameboard');
} }
} }

View file

@ -25,7 +25,7 @@ class StarBoardCommand extends Command {
if (err) { if (err) {
console.log(err); console.log(err);
} }
fs.close(2);
return message.channel.send('This channel have been set as the starboard'); return message.channel.send('This channel have been set as the starboard');
}); });
} else { } else {
@ -34,13 +34,13 @@ class StarBoardCommand extends Command {
var json = JSON.stringify(starboard); //convert it back to json var json = JSON.stringify(starboard); //convert it back to json
fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) { fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(2);
return console.log(err); return console.log(err);
} }
}); });
} }
}); });
fs.close(2);
return message.channel.send('This channel have been set as the starboard'); return message.channel.send('This channel have been set as the starboard');
} }
} }

View file

@ -39,7 +39,7 @@ class TagCommand extends Command {
if (err) { if (err) {
fs.writeFile(`./tag/${message.guild.id}.json`, `{'${trigger}':'${response}'}`, function (err) { fs.writeFile(`./tag/${message.guild.id}.json`, `{'${trigger}':'${response}'}`, function (err) {
if (err) { if (err) {
fs.close(2);
console.log(err); console.log(err);
} }
}); });
@ -49,14 +49,14 @@ class TagCommand extends Command {
json = JSON.stringify(customresponse); //convert it back to json json = JSON.stringify(customresponse); //convert it back to json
fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(2);
return console.log(err); return console.log(err);
} }
}); });
} }
}); });
fs.close(2);
return message.channel.send(`autoresponse have been set to ${trigger} : ${response}`); return message.channel.send(`autoresponse have been set to ${trigger} : ${response}`);
} }
} }

View file

@ -40,14 +40,14 @@ class UnTagCommand extends Command {
json = JSON.stringify(customresponse); //convert it back to json json = JSON.stringify(customresponse); //convert it back to json
fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) { fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function (err) {
if (err) { if (err) {
fs.close(2);
return console.log(err); return console.log(err);
} }
}); });
} }
}); });
fs.close(2);
return message.channel.send(`The following autoresponse have been deleted: ${trigger}`); return message.channel.send(`The following autoresponse have been deleted: ${trigger}`);
} }

View file

@ -38,7 +38,7 @@ class TtsCommand extends Command {
// Performs the Text-to-Speech request // Performs the Text-to-Speech request
gclient.synthesizeSpeech(request, (err, response) => { gclient.synthesizeSpeech(request, (err, response) => {
if (err) { if (err) {
fs.close(2);
console.error('ERROR:', err); console.error('ERROR:', err);
return; return;
} }
@ -48,13 +48,13 @@ class TtsCommand extends Command {
if (err) { if (err) {
console.error('ERROR:', err); console.error('ERROR:', err);
message.channel.send('An error has occured, the message is probably too long'); message.channel.send('An error has occured, the message is probably too long');
fs.close(2);
return; return;
} }
console.log('Audio content written to file: tts.mp3'); console.log('Audio content written to file: tts.mp3');
message.channel.send({ files: ['./tts.mp3'] }); message.channel.send({ files: ['./tts.mp3'] });
}); });
fs.close(2);
}); });
} }
} }

View file

@ -50,7 +50,7 @@ class TtsvcCommand extends Command {
if (err) { if (err) {
console.error('ERROR:', err); console.error('ERROR:', err);
message.channel.send('An error has occured, the message is probably too long'); message.channel.send('An error has occured, the message is probably too long');
fs.close(2);
return; return;
} }
console.log('Audio content written to file: ttsvc.mp3'); console.log('Audio content written to file: ttsvc.mp3');

View file

@ -43,10 +43,10 @@ class DownloadCommand extends Command {
message.delete(); message.delete();
message.channel.send(`Downloaded by ${message.author.username}`, { files: ['./video.mp4'] }) message.channel.send(`Downloaded by ${message.author.username}`, { files: ['./video.mp4'] })
.catch(() => message.channel.send('File too big')); .catch(() => message.channel.send('File too big'));
fs.close(2);
}); });
} else { } else {
fs.close(2);
message.channel.send('You need to input a valid link'); message.channel.send('You need to input a valid link');
} }
} }

View file

@ -25,7 +25,7 @@ class taglistCommand extends Command {
await fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) { await fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
if (err) { if (err) {
console.log(err); console.log(err);
fs.close(2);
return; return;
} }
let json = JSON.stringify(data); let json = JSON.stringify(data);
@ -39,7 +39,7 @@ class taglistCommand extends Command {
message.channel.send(tagEmbed); message.channel.send(tagEmbed);
}); });
fs.close(2);
message.channel.send('An error has occured, do you have any tags on the server?'); message.channel.send('An error has occured, do you have any tags on the server?');
} }
} }