Can disable autoresponse

This commit is contained in:
loicbersier 2018-10-21 20:46:57 +02:00
parent f7e9fb5892
commit af3d618591
3 changed files with 20 additions and 3 deletions

View file

@ -8,11 +8,11 @@ module.exports = class sayCommand extends Command {
group: 'admin', group: 'admin',
memberName: 'autoresponse', memberName: 'autoresponse',
userPermissions: ['MANAGE_MESSAGES'], userPermissions: ['MANAGE_MESSAGES'],
description: `Repeat the text you send`, description: `Can disable autoresponse in the channel`,
args: [ args: [
{ {
key: 'text', key: 'text',
prompt: 'What do you want me to say', prompt: 'Disable or enable?',
type: 'string', type: 'string',
oneOf: ['disable', 'enable'], oneOf: ['disable', 'enable'],
} }
@ -40,6 +40,6 @@ module.exports = class sayCommand extends Command {
} }
})}}); })}});
message.say(text); message.say(`Autoresponse have been ${text}d`);
} }
}; };

View file

@ -5,6 +5,7 @@ const { token, prefix, statsChannel, ownerID, supportServer } = require('./confi
const responseObject = require("./json/reply.json"); const responseObject = require("./json/reply.json");
const reactObject = require("./json/react.json"); const reactObject = require("./json/react.json");
const imgResponseObject = require("./json/imgreply.json"); const imgResponseObject = require("./json/imgreply.json");
var SelfReloadJSON = require('self-reload-json');
// Prefix and ownerID and invite to support server // Prefix and ownerID and invite to support server
const client = new CommandoClient({ const client = new CommandoClient({
commandPrefix: prefix, commandPrefix: prefix,
@ -80,18 +81,33 @@ client.registry
if (message.author.bot) return; { if (message.author.bot) return; {
// Reply with images as attachement // Reply with images as attachement
if(imgResponseObject[message_content]) { 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]]}); message.channel.send({files: [imgResponseObject[message_content]]});
} }
// React only to the messages // React only to the messages
else if(reactObject[message_content]) { 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]); message.react(reactObject[message_content]);
} }
// auto respond to messages // auto respond to messages
else if(responseObject[message_content]) { 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]); message.channel.send(responseObject[message_content]);
} else if (message_content.includes("like if")) { } 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}") message.react("\u{1F44D}")
} else if (message_content.includes("jeff")) { } 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") message.react("496028845967802378")
} }
}}); }});

View file

@ -23,6 +23,7 @@
"discord.js-commando": "^0.10.0", "discord.js-commando": "^0.10.0",
"faceapp": "^0.4.4", "faceapp": "^0.4.4",
"node-fetch": "^2.2.0", "node-fetch": "^2.2.0",
"self-reload-json": "^0.4.0",
"superagent": "^4.0.0-beta.5", "superagent": "^4.0.0-beta.5",
"ytdl-core": "^0.26.1" "ytdl-core": "^0.26.1"
} }