From c17c35ab8d4e727344c7956cf58c1fd4b4c1c810 Mon Sep 17 00:00:00 2001 From: Supositware Date: Wed, 2 Jan 2019 05:51:09 +0100 Subject: [PATCH] replaced self-reload-json by auto-reload --- commands/general/tts.js | 2 +- commands/utility/taglist.js | 4 ++-- listeners/message.js | 6 +++--- listeners/messageReactionAdd.js | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/commands/general/tts.js b/commands/general/tts.js index a9e87b5..171833b 100644 --- a/commands/general/tts.js +++ b/commands/general/tts.js @@ -44,7 +44,7 @@ class TtsCommand extends Command { } // Write the binary audio content to a local file - await fs.writeFile('tts.mp3', response.audioContent, 'binary', err => { + fs.writeFile('tts.mp3', response.audioContent, 'binary', err => { if (err) { console.error('ERROR:', err); message.channel.send('An error has occured, the message is probably too long'); diff --git a/commands/utility/taglist.js b/commands/utility/taglist.js index 28d0331..1ce914a 100644 --- a/commands/utility/taglist.js +++ b/commands/utility/taglist.js @@ -1,6 +1,6 @@ const { Command } = require('discord-akairo'); const Discord = require('discord.js'); -const SelfReloadJSON = require('self-reload-json'); +const reload = require('auto-reload'); const fs = require('fs'); class taglistCommand extends Command { @@ -19,7 +19,7 @@ class taglistCommand extends Command { async exec(message) { try { - let customresponse = new SelfReloadJSON(`./tag/${message.guild.id}.json`); + let customresponse = reload(`../../tag/${message.guild.id}.json`); let count = Object.keys(customresponse).length diff --git a/listeners/message.js b/listeners/message.js index 0f66026..348dafe 100644 --- a/listeners/message.js +++ b/listeners/message.js @@ -2,7 +2,7 @@ const { Listener } = require('discord-akairo'); const responseObject = require("../json/reply.json"); const reactObject = require("../json/react.json"); const imgResponseObject = require("../json/imgreply.json"); -const SelfReloadJSON = require('self-reload-json'); +const reload = require('auto-reload'); class MessageListener extends Listener { constructor() { @@ -13,7 +13,7 @@ class MessageListener extends Listener { } async exec(message) { - let autoresponse = new SelfReloadJSON('./json/autoresponse.json'); + let autoresponse = reload('../json/autoresponse.json'); let message_content = message.content.toLowerCase(); if (message.author.bot) return; { @@ -39,7 +39,7 @@ class MessageListener extends Listener { message.react("496028845967802378") } } - let customresponse = new SelfReloadJSON(`./tag/${message.guild.id}.json`); + let customresponse = reload(`./tag/${message.guild.id}.json`); // User autoresponse if(customresponse[message_content]) { message.channel.send(customresponse[message_content]) diff --git a/listeners/messageReactionAdd.js b/listeners/messageReactionAdd.js index 394e18b..a87f6fd 100644 --- a/listeners/messageReactionAdd.js +++ b/listeners/messageReactionAdd.js @@ -1,6 +1,6 @@ const { Listener } = require('discord-akairo'); const Discord = require('discord.js'); -const SelfReloadJSON = require('self-reload-json'); +const reload = require('auto-reload'); class MessageReactionAddListener extends Listener { constructor() { @@ -15,7 +15,7 @@ class MessageReactionAddListener extends Listener { let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`); if (reaction.emoji.name === '🌟' && reaction.count === 4) { - let starboardChannel = new SelfReloadJSON(`./starboard/${reaction.message.guild.id}.json`); + let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`); const channel = this.client.channels.get(starboardChannel['starboard']); const starEmbed = new Discord.RichEmbed() @@ -28,7 +28,7 @@ class MessageReactionAddListener extends Listener { return channel.send(`From: ${reaction.message.channel}\n${messageAttachments}`); } if (reaction.emoji.name === '✡' && reaction.count === 4) { - let shameboardChannel = new SelfReloadJSON(`./starboard/${message.guild.id}.json`); + let shameboardChannel = reload(`../starboard/${message.guild.id}.json`); const channel = client.channels.get(shameboardChannel['shameboard']); const starEmbed = new Discord.RichEmbed()