mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 18:05:01 +02:00
Catch Yoda Error
This commit is contained in:
@@ -26,10 +26,14 @@ module.exports = class YodaCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
const { sentence } = args;
|
const { sentence } = args;
|
||||||
const { text } = await snekfetch
|
try {
|
||||||
.get('https://yoda.p.mashape.com/yoda')
|
const { text } = await snekfetch
|
||||||
.query({ sentence })
|
.get('https://yoda.p.mashape.com/yoda')
|
||||||
.set({ 'X-Mashape-Key': MASHAPE_KEY });
|
.query({ sentence })
|
||||||
return msg.say(text);
|
.set({ 'X-Mashape-Key': MASHAPE_KEY });
|
||||||
|
return msg.say(text);
|
||||||
|
} catch (err) {
|
||||||
|
return msg.say(`Oh no, Yoda's being a jerk and not working again: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "30.7.1",
|
"version": "30.7.2",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user