mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 15:57:47 +02:00
Ignore commands in cleverbot and phone
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,7 +11,6 @@ module.exports = class Cleverbot {
|
||||
this.cs = null;
|
||||
this.timeout = this.setTimeout();
|
||||
this.key = key;
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
async respond(input) {
|
||||
|
||||
Reference in New Issue
Block a user