Cleverbot

This commit is contained in:
Daniel Odendahl Jr
2017-05-06 05:03:08 +00:00
parent c27ed061fb
commit 89f086c7f2
6 changed files with 45 additions and 2 deletions
+38
View File
@@ -0,0 +1,38 @@
const { Command } = require('discord.js-commando');
const request = require('superagent');
module.exports = class CleverbotCommand extends Command {
constructor(client) {
super(client, {
name: 'cleverbot',
aliases: [
'clevs',
'chat'
],
group: 'random',
memberName: 'cleverbot',
description: 'Talk to Cleverbot.',
args: [
{
key: 'text',
prompt: 'What would you like to say to Cleverbot?',
type: 'string',
parse: text => encodeURIComponent(text)
}
]
});
}
async run(msg, args) {
const { text } = args;
try {
const { body } = await request
.post('https://cleverbot.io/1.0/ask')
.send({ user: process.env.CLEVS_USER, key: process.env.CLEVS_KEY, text });
if(body.status !== 'success') throw new Error(body.status);
return msg.reply(body.response);
} catch(err) {
return msg.say(`An Error Occurred: ${err}`);
}
}
};
+2 -1
View File
@@ -84,7 +84,8 @@ module.exports = class InfoCommand extends Command {
[SoundCloud](https://developers.soundcloud.com/),
[random.cat](http://random.cat/),
[random.dog](https://random.dog/),
[fixer.io](http://fixer.io/)
[fixer.io](http://fixer.io/),
[cleverbot.io](https://cleverbot.io/)
`
);
return msg.embed(embed);
+1
View File
@@ -52,6 +52,7 @@
<li><a href="http://random.cat/">random.cat</a></li>
<li><a href="https://random.dog/">random.dog</a></li>
<li><a href="http://fixer.io/">fixer.io</a></li>
<li><a href="https://cleverbot.io/">cleverbot.io</a></li>
</ul>
<h2>Information</h2>
<ul>
+1
View File
@@ -46,6 +46,7 @@
<li>YuGiOh! Card Data</li>
</ul>
<li>LMGTFY Link Generation!</li>
<li>Cleverbot!</li>
<li>Binary, Morse, Pirate, and Temmie Translators!</li>
<li>Cowsay, Embed, Reverse, Zalgo, and Upside Down Text!</li>
<li>Customizable Prefix!</li>
+2
View File
@@ -43,6 +43,7 @@
<li>YuGiOh! Card Data</li>
</ul>
<li>LMGTFY Link Generation!</li>
<li>Cleverbot!</li>
<li>Binary, Morse, Pirate, and Temmie Translators!</li>
<li>Cowsay, Embed, Reverse, Zalgo, and Upside Down Text!</li>
<li>Customizable Prefix!</li>
@@ -95,6 +96,7 @@
<li><a href="http://random.cat/">random.cat</a></li>
<li><a href="https://random.dog/">random.dog</a></li>
<li><a href="http://fixer.io/">fixer.io</a></li>
<li><a href="https://cleverbot.io/">cleverbot.io</a></li>
</ul>
<h2>Information</h2>
<ul>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "18.3.1",
"version": "18.4.0",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {