mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:26:21 +02:00
Improve Cleverbot
This commit is contained in:
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "18.9.3",
|
||||
"version": "18.9.4",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user