From 227062e7020c0cdfb75e8805a685144c3439a988 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 7 Mar 2021 16:37:54 -0500 Subject: [PATCH] Ignore commands in cleverbot and phone --- Xiao.js | 3 ++- commands/other/cleverbot.js | 6 ++---- structures/Cleverbot.js | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Xiao.js b/Xiao.js index d8116a28..050a61d6 100644 --- a/Xiao.js +++ b/Xiao.js @@ -155,10 +155,11 @@ client.on('message', async msg => { const hasEmbed = msg.embeds.length !== 0; if (msg.author.bot || (!hasText && !hasImage && !hasEmbed)) return; if (client.blacklist.user.includes(msg.author.id)) return; + if (msg.isCommand) return; // Cleverbot handler const cleverbot = client.cleverbots.get(msg.channel.id); - if (cleverbot && cleverbot.active) { + if (cleverbot) { if (!cleverbot.shouldRespond(msg)) return; const response = await cleverbot.respond(msg.cleanContent); await msg.channel.send(response); diff --git a/commands/other/cleverbot.js b/commands/other/cleverbot.js index 74d88a36..65c2dcd6 100644 --- a/commands/other/cleverbot.js +++ b/commands/other/cleverbot.js @@ -21,18 +21,16 @@ module.exports = class CleverbotCommand extends Command { }); } - async run(msg) { + run(msg) { if (this.client.cleverbots.has(msg.channel.id)) { return msg.say('There is already a Cleverbot conversation in this channel.'); } const cleverbot = new Cleverbot(this.client, msg.channel.id, msg.author.id); this.client.cleverbots.set(msg.channel.id, cleverbot); const usage = this.client.registry.commands.get('cleverbot-end').usage(); - await msg.reply(stripIndents` + return msg.reply(stripIndents` Cleverbot is now active in this channel, replying to ${msg.author}. To end the conversation, use ${usage}. `); - cleverbot.active = true; - return null; } }; diff --git a/structures/Cleverbot.js b/structures/Cleverbot.js index 8ae9e591..2321b695 100644 --- a/structures/Cleverbot.js +++ b/structures/Cleverbot.js @@ -11,7 +11,6 @@ module.exports = class Cleverbot { this.cs = null; this.timeout = this.setTimeout(); this.key = key; - this.active = false; } async respond(input) {