mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Don't mention, respond blank with blank input
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user