Fix jeopardy

This commit is contained in:
Dragon Fire
2024-03-20 18:48:42 -04:00
parent 51a81624f3
commit 91d14f00a4
+2 -16
View File
@@ -19,7 +19,7 @@ module.exports = class JeopardyCommand extends Command {
credit: [ credit: [
{ {
name: 'jService', name: 'jService',
url: 'http://jservice.io/', url: 'https://jservice.xyz/',
reason: 'API' reason: 'API'
}, },
{ {
@@ -74,21 +74,7 @@ module.exports = class JeopardyCommand extends Command {
} }
async fetchQuestion() { async fetchQuestion() {
const { body } = await request const { body } = await request.get('https://jservice.xyz/api/random-clue');
.get('http://jservice.io/api/random')
.query({ count: 1 });
const data = body[0];
if (!data.question || !data.answer) {
await this.markInvalid(data.id);
return this.fetchQuestion();
}
return data;
}
async markInvalid(id) {
const { body } = await request
.post('http://jservice.io/api/invalid')
.query({ id });
return body; return body;
} }