mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 14:55:40 +02:00
Fix
This commit is contained in:
@@ -48,15 +48,13 @@ module.exports = class RecipeCommand extends Command {
|
||||
}
|
||||
|
||||
async fetchRecipe(query) {
|
||||
let result;
|
||||
try {
|
||||
const { text } = await request
|
||||
.get('http://www.recipepuppy.com/api/')
|
||||
.query({ q: query });
|
||||
result = text;
|
||||
return JSON.parse(result);
|
||||
} catch {
|
||||
return JSON.parse(result.split('<!DOCTYPE html')[0]);
|
||||
return JSON.parse(text);
|
||||
} catch (err) {
|
||||
return JSON.parse(err.text.split('<!DOCTYPE html')[0]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user