mirror of
https://github.com/1disk/edp445.git
synced 2024-08-14 22:47:02 +00:00
Updated the file extension
This commit is contained in:
parent
85f7200e49
commit
8e6baac2f8
2 changed files with 77 additions and 0 deletions
56
functions/AI.js
Normal file
56
functions/AI.js
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
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;
|
||||||
|
}
|
21
functions/cleverbot.js
Normal file
21
functions/cleverbot.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const Discord = require('discord.js') //Import Discord API
|
||||||
|
require('discord-inline-reply'); //Import inline replies for Discord API
|
||||||
|
const fetch = require('node-fetch'); //Import the FETCH API
|
||||||
|
|
||||||
|
module.exports = async (message, author, guild, client) => {
|
||||||
|
const cleverbot = require('cleverbot-free') //Install the cleverbot api
|
||||||
|
|
||||||
|
var text = message.content.replace(`<@${client.user.id}> botai `, '')
|
||||||
|
let conversation = [] //History of the conversation
|
||||||
|
|
||||||
|
cleverbot(text, conversation).then(res => {
|
||||||
|
conversation.push(text)
|
||||||
|
conversation.push(res)
|
||||||
|
|
||||||
|
message.channel.startTyping();
|
||||||
|
setTimeout(function(){
|
||||||
|
message.channel.stopTyping();
|
||||||
|
return message.lineReply(res)
|
||||||
|
}, 2000);
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in a new issue