replaced self-reload-json by auto-reload

This commit is contained in:
Supositware 2019-01-02 05:51:09 +01:00
parent c229227ef2
commit c17c35ab8d
4 changed files with 9 additions and 9 deletions

View file

@ -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');

View file

@ -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

View file

@ -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])

View file

@ -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()