From ca88c0b2dbd91dba0b70242fa345dafa80274dd1 Mon Sep 17 00:00:00 2001 From: Loic Bersier Date: Thu, 20 Sep 2018 14:50:05 +0200 Subject: [PATCH] Added auto reply that delete the previous messages ( DISABLED ) --- delreply.json | 3 +++ index.js | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 delreply.json diff --git a/delreply.json b/delreply.json new file mode 100644 index 00000000..9c3c586c --- /dev/null +++ b/delreply.json @@ -0,0 +1,3 @@ +{ + "test": "tteesstt" +} \ No newline at end of file diff --git a/index.js b/index.js index 5d44556b..ae444adb 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ const { CommandoClient } = require('discord.js-commando'); const path = require('path'); -const { token, prefix, botID, statsChannel, ownerID, supportServer, activity } = require('./config.json'); +const { token, prefix, botID, statsChannel, ownerID, supportServer } = require('./config.json'); const responseObject = require("./reply.json"); +const delresponseObject = require("./delreply.json"); const reactObject = require("./react.json"); // Prefix and ownerID and invite to support server @@ -63,16 +64,24 @@ client.registry channel.send({ embed: kickEmbed }); }) -// Auto respond to messages client.on("message", async (message) => { let message_content = message.content.toLowerCase(); + +// Delete the messages that triggered it and send a messages +// if(delresponseObject[message_content]) { +// message.delete(); +// message.channel.send(delresponseObject[message_content]); +// } else +// React to the message and send an auto response with it if(responseObject[message_content] && reactObject[message_content]) { message.channel.send(responseObject[message_content]); message.react(reactObject[message_content]); +// React only to the messages } else if(reactObject[message_content]) { message.react(reactObject[message_content]); } +// auto respond to messages else if(responseObject[message_content]) { message.channel.send(responseObject[message_content]); }