mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Change Yoda API
This commit is contained in:
@@ -1259,6 +1259,8 @@ here.
|
||||
* hollywood-star ([Image](http://www.redkid.net/generator/star/))
|
||||
- [Rest Countries](https://restcountries.eu/)
|
||||
* country (API)
|
||||
- [richchurcher](https://github.com/richchurcher)
|
||||
* yoda ([API](https://github.com/richchurcher/yoda-api))
|
||||
- [Right Stuf Anime](https://www.rightstufanime.com/)
|
||||
* right-stuf (API)
|
||||
- [Riot Games](https://www.riotgames.com/en)
|
||||
@@ -1337,8 +1339,6 @@ here.
|
||||
* newspaper (API)
|
||||
- [The Onion](https://www.theonion.com/)
|
||||
* the-onion ([RSS Feed](https://www.theonion.com/rss))
|
||||
- [The Yoda-Speak Generator](https://www.yodaspeak.co.uk/)
|
||||
* yoda (API)
|
||||
- [This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net/)
|
||||
* waifu (API)
|
||||
- [Tim's Printables](https://www.timvandevall.com/)
|
||||
|
||||
+10
-16
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const soap = require('soap');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class YodaCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -11,9 +11,10 @@ module.exports = class YodaCommand extends Command {
|
||||
description: 'Converts text to Yoda speak.',
|
||||
credit: [
|
||||
{
|
||||
name: 'The Yoda-Speak Generator',
|
||||
url: 'https://www.yodaspeak.co.uk/',
|
||||
reason: 'API'
|
||||
name: 'richchurcher',
|
||||
url: 'https://github.com/richchurcher',
|
||||
reason: 'API',
|
||||
reasonURL: 'https://github.com/richchurcher/yoda-api'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
@@ -25,24 +26,17 @@ module.exports = class YodaCommand extends Command {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.soapClient = null;
|
||||
}
|
||||
|
||||
async run(msg, { sentence }) {
|
||||
try {
|
||||
if (!this.soapClient) await this.setUpClient();
|
||||
const response = await this.soapClient.yodaTalkAsync({ inputText: sentence });
|
||||
const text = response[0].return;
|
||||
if (!text) return msg.reply('Empty, this message is. Try again later, you must.');
|
||||
return msg.say(text);
|
||||
const { body } = await request
|
||||
.get('https://yoda-api.appspot.com/api/v1/yodish')
|
||||
.query({ text: sentence });
|
||||
if (!body.yodish) return msg.reply('Empty, this message is. Try again later, you must.');
|
||||
return msg.say(body.yodish);
|
||||
} catch (err) {
|
||||
return msg.reply(`Being a jerk again, Yoda is: \`${err.message}\`. Try again later, you must.`);
|
||||
}
|
||||
}
|
||||
|
||||
async setUpClient() {
|
||||
this.soapClient = await soap.createClientAsync('http://www.yodaspeak.co.uk/webservice/yodatalk.php?wsdl');
|
||||
return this.soapClient;
|
||||
}
|
||||
};
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "114.28.1",
|
||||
"version": "114.28.2",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
@@ -53,7 +53,6 @@
|
||||
"pokersolver": "^2.1.3",
|
||||
"random-js": "^2.1.0",
|
||||
"rss-parser": "^3.8.0",
|
||||
"soap": "^0.31.0",
|
||||
"winston": "^3.2.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user