1
0
Fork 0
mirror of https://github.com/1disk/edp445.git synced 2024-08-14 22:47:02 +00:00
edp445/functions/AI.JS
2022-11-26 15:27:07 +01:00

56 lines
No EOL
1.5 KiB
JavaScript

module.exports = async (message, author) => {
var msc = message.toLowerCase()
var compliment = require('./detections/compliment.js')
var insult = require('./detections/insult.js')
var neutral = require('./detections/neutral.js')
var questionyon = require('./detections/question-yon.js')
var or = require('./detections/or.js')
var additionalreaction = require('./detections/additional-reaction.js')
var final;
//look for compliments
compliment(msc).detections.some(element => {
if (msc.includes(element)) {
final = compliment(msc, author).reply
return;
}
});
//look for insults
insult(msc).detections.some(element => {
if (msc.includes(element)) {
final = insult(msc, element, author).reply
return;
}
});
//look for a yes or no question
questionyon(msc).detections.some(element => {
if (msc.includes(element)) {
final = questionyon(msc, author).reply
return;
}
});
or(msc).detections.some(element => {
if (msc.includes(element)) {
final = or(msc, author).reply
return;
}
});
additionalreaction(msc).detections.some(element => {
if (msc.includes(element)) {
final = additionalreaction(msc, author).reply
return;
}
});
if(!final){
final = neutral(msc, author).reply
}
return final;
}