mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 05:51:42 +02:00
Fix jeopardy
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user