Loic Bersier 6 years ago
parent 9742ffc8cd
commit 505cd1c2b2

@ -34,14 +34,14 @@ module.exports = class CustomResponseCommand extends Command {
let customresponse = {} let customresponse = {}
let json = JSON.stringify(customresponse) let json = JSON.stringify(customresponse)
fs.readFile('DiscordBot/json/customresponse.json', 'utf8', function readFileCallback(err, data){ fs.readFile('./json/customresponse.json', 'utf8', function readFileCallback(err, data){
if (err){ if (err){
console.log(err); console.log(err);
} else { } else {
customresponse = JSON.parse(data); //now it an object customresponse = JSON.parse(data); //now it an object
customresponse [message.guild.id] = { 'text': trigger, 'response': response } customresponse [message.guild.id] = { 'text': trigger, 'response': response }
json = JSON.stringify(customresponse); //convert it back to json json = JSON.stringify(customresponse); //convert it back to json
fs.writeFile('DiscordBot/json/customresponse.json', json, 'utf8', function(err) { fs.writeFile('./json/customresponse.json', json, 'utf8', function(err) {
if(err) { if(err) {
return console.log(err); return console.log(err);
} }
Loading…
Cancel
Save