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',
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`);
}
};

View file

@ -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")
}
}});

View file

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