Remove fromPattern from Cleverbot

This commit is contained in:
Dragon Fire
2020-10-29 00:47:15 -04:00
parent b8071ca857
commit 7830bee5b5
+1 -6
View File
@@ -33,11 +33,7 @@ module.exports = class CleverbotCommand extends Command {
this.convos = new Map(); this.convos = new Map();
} }
async run(msg, { text }, fromPattern) { async run(msg, { text }) {
if (fromPattern) {
if (msg.guild && !msg.channel.permissionsFor(this.client.user).has('SEND_MESSAGES')) return null;
text = msg.patternMatches[2];
}
try { try {
const convo = this.convos.get(msg.channel.id); const convo = this.convos.get(msg.channel.id);
const { body } = await request const { body } = await request
@@ -52,7 +48,6 @@ module.exports = class CleverbotCommand extends Command {
this.convos.set(msg.channel.id, { cs: body.cs, timeout }); this.convos.set(msg.channel.id, { cs: body.cs, timeout });
return msg.reply(body.output || blankResponses[Math.floor(Math.random() * blankResponses.length)]); return msg.reply(body.output || blankResponses[Math.floor(Math.random() * blankResponses.length)]);
} catch (err) { } catch (err) {
if (fromPattern) return null;
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
} }
} }