diff --git a/commands/admin/autoresponse b/commands/admin/autoresponse.js similarity index 89% rename from commands/admin/autoresponse rename to commands/admin/autoresponse.js index 89feb6b..a497b1e 100644 --- a/commands/admin/autoresponse +++ b/commands/admin/autoresponse.js @@ -8,11 +8,11 @@ module.exports = class sayCommand extends Command { group: 'admin', memberName: 'autoresponse', userPermissions: ['MANAGE_MESSAGES'], - description: `Repeat the text you send`, + description: `Can disable autoresponse in the channel`, args: [ { key: 'text', - prompt: 'What do you want me to say', + prompt: 'Disable or enable?', type: 'string', oneOf: ['disable', 'enable'], } @@ -40,6 +40,6 @@ module.exports = class sayCommand extends Command { } })}}); - message.say(text); + message.say(`Autoresponse have been ${text}d`); } }; \ No newline at end of file diff --git a/index.js b/index.js index 1517fa0..e18088a 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ const { token, prefix, statsChannel, ownerID, supportServer } = require('./confi const responseObject = require("./json/reply.json"); const reactObject = require("./json/react.json"); const imgResponseObject = require("./json/imgreply.json"); +var SelfReloadJSON = require('self-reload-json'); // Prefix and ownerID and invite to support server const client = new CommandoClient({ commandPrefix: prefix, @@ -80,18 +81,33 @@ client.registry if (message.author.bot) return; { // Reply with images as attachement if(imgResponseObject[message_content]) { + var autoresponse = new SelfReloadJSON('./json/autoresponse.json'); + if(autoresponse[message.channel.id] == 'disable') + return console.log('disable') message.channel.send({files: [imgResponseObject[message_content]]}); } // React only to the messages else if(reactObject[message_content]) { + var autoresponse = new SelfReloadJSON('./json/autoresponse.json'); + if(autoresponse[message.channel.id] == 'disable') + return console.log('disable') message.react(reactObject[message_content]); } // auto respond to messages else if(responseObject[message_content]) { + var autoresponse = new SelfReloadJSON('./json/autoresponse.json'); + if(autoresponse[message.channel.id] == 'disable') + return console.log('disable') message.channel.send(responseObject[message_content]); } else if (message_content.includes("like if")) { + var autoresponse = new SelfReloadJSON('./json/autoresponse.json'); + if(autoresponse[message.channel.id] == 'disable') + return console.log('disable') message.react("\u{1F44D}") } else if (message_content.includes("jeff")) { + var autoresponse = new SelfReloadJSON('./json/autoresponse.json'); + if(autoresponse[message.channel.id] == 'disable') + return console.log('disable') message.react("496028845967802378") } }}); diff --git a/package.json b/package.json index 7117938..c426ba3 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "discord.js-commando": "^0.10.0", "faceapp": "^0.4.4", "node-fetch": "^2.2.0", + "self-reload-json": "^0.4.0", "superagent": "^4.0.0-beta.5", "ytdl-core": "^0.26.1" }