mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Fix
This commit is contained in:
@@ -93,14 +93,14 @@ module.exports = class TwentyQuestionsCommand extends Command {
|
|||||||
cctkr: 'US,AR,VI,GB,AF,PL'
|
cctkr: 'US,AR,VI,GB,AF,PL'
|
||||||
});
|
});
|
||||||
const $ = cheerio.load(text);
|
const $ = cheerio.load(text);
|
||||||
const text = $('big').eq(2).children().first();
|
const resultText = $('big').eq(2).children().first();
|
||||||
const answers = [];
|
const answers = [];
|
||||||
$(text).find('a').each((i, elem) => {
|
$(resultText).find('a').each((i, elem) => {
|
||||||
const href = `${baseURI}${$(elem).attr('href')}`;
|
const href = `${baseURI}${$(elem).attr('href')}`;
|
||||||
answers.push({ href, text: $(elem).text().trim() })
|
answers.push({ href, text: $(elem).text().trim() })
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
question: text.text().split('\n')[0],
|
question: resultText.text().split('\n')[0],
|
||||||
answers,
|
answers,
|
||||||
url: `${baseURI}${startURL}`
|
url: `${baseURI}${startURL}`
|
||||||
}
|
}
|
||||||
@@ -124,14 +124,14 @@ module.exports = class TwentyQuestionsCommand extends Command {
|
|||||||
result: 'I was unable to guess what you were thinking. Nice job!'
|
result: 'I was unable to guess what you were thinking. Nice job!'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const text = $('big').first().children().first();
|
const resultText = $('big').first().children().first();
|
||||||
const answers = [];
|
const answers = [];
|
||||||
$(text).find('a').each((i, elem) => {
|
$(resultText).find('a').each((i, elem) => {
|
||||||
const href = `${baseURI}${$(elem).attr('href')}`;
|
const href = `${baseURI}${$(elem).attr('href')}`;
|
||||||
answers.push({ href, text: $(elem).text().trim() })
|
answers.push({ href, text: $(elem).text().trim() })
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
question: text.text().split('\n')[0],
|
question: resultText.text().split('\n')[0],
|
||||||
answers,
|
answers,
|
||||||
url: `${baseURI}${startURL}`
|
url: `${baseURI}${startURL}`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user