Don't mention, respond blank with blank input

This commit is contained in:
Dragon Fire
2021-03-06 13:57:19 -05:00
parent a37a2c051b
commit e37f66c8cc
2 changed files with 6 additions and 2 deletions
+1 -2
View File
@@ -158,10 +158,9 @@ client.on('message', async msg => {
// Cleverbot handler
const cleverbot = client.cleverbots.get(msg.channel.id);
if (cleverbot && cleverbot.active) {
if (!hasText) return;
if (!cleverbot.shouldRespond(msg)) return;
const response = await cleverbot.respond(msg.cleanContent);
await msg.reply(response);
await msg.channel.send(response);
return;
}
+5
View File
@@ -15,6 +15,11 @@ module.exports = class Cleverbot {
}
async respond(input) {
if (!input) {
clearTimeout(this.timeout);
this.timeout = this.setTimeout();
return blankResponses[Math.floor(Math.random() * blankResponses.length)];
}
const { body } = await request
.get('https://www.cleverbot.com/getreply')
.query({