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

21 lines
No EOL
749 B
JavaScript

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