Improve Cleverbot

This commit is contained in:
Daniel Odendahl Jr
2017-05-09 19:55:51 +00:00
parent 2066a94054
commit a4657fda8d
3 changed files with 12 additions and 3 deletions
+5 -2
View File
@@ -49,12 +49,15 @@ client.registry
.registerCommandsIn(path.join(__dirname, 'commands'));
client.on('message', async (msg) => {
if (msg.author.bot) return;
if (msg.channel.type === 'dm')
if (!msg.channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
if (msg.isMentioned(client.user)) {
msg.channel.startTyping();
const message = msg.content.replace(mention, '');
try {
const { body } = await clevs.ask(message);
return msg.reply(body.response)
const { response } = await clevs.ask(message);
return msg.reply(response)
.then(() => msg.channel.stopTyping());
} catch (err) {
return msg.reply(err)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "18.9.3",
"version": "18.9.4",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {
+6
View File
@@ -14,6 +14,9 @@ class Cleverbot {
user: this.user,
key: this.key,
nick: this.nick
})
.then(response => {
return response.body;
});
}
@@ -25,6 +28,9 @@ class Cleverbot {
key: this.key,
nick: this.nick,
text
})
.then(response => {
return response.body;
});
}
}