mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
New Would You Rather API
This commit is contained in:
@@ -1048,6 +1048,8 @@ here.
|
|||||||
* undertale ([Apple Kid Font](https://earthboundcentral.com/2009/11/ultimate-earthbound-font-pack/))
|
* undertale ([Apple Kid Font](https://earthboundcentral.com/2009/11/ultimate-earthbound-font-pack/))
|
||||||
- [ebearskittychan](https://twitter.com/ebearskittychan)
|
- [ebearskittychan](https://twitter.com/ebearskittychan)
|
||||||
* temmie (English-to-Temmie Dictionary Data)
|
* temmie (English-to-Temmie Dictionary Data)
|
||||||
|
- [either](http://either.io)
|
||||||
|
* would-you-rather (API)
|
||||||
- [Enkidulga](https://www.dafont.com/profile.php?user=736583)
|
- [Enkidulga](https://www.dafont.com/profile.php?user=736583)
|
||||||
* ace-attorney ([Ace Attorney Font](https://www.dafont.com/ace-attorney.font))
|
* ace-attorney ([Ace Attorney Font](https://www.dafont.com/ace-attorney.font))
|
||||||
- [Esther Verkest](https://www.facebook.com/Esther-Verkest-49667161749/)
|
- [Esther Verkest](https://www.facebook.com/Esther-Verkest-49667161749/)
|
||||||
@@ -1539,8 +1541,6 @@ here.
|
|||||||
* final-grade (Concept, Code)
|
* final-grade (Concept, Code)
|
||||||
- [Rotten Tomatoes](https://www.rottentomatoes.com/)
|
- [Rotten Tomatoes](https://www.rottentomatoes.com/)
|
||||||
* rotten-tomatoes (API)
|
* rotten-tomatoes (API)
|
||||||
- [rrrather](https://www.rrrather.com/)
|
|
||||||
* would-you-rather ([API](https://www.rrrather.com/botapi))
|
|
||||||
- [Ryan Gutierrez](https://twitter.com/gootecks)
|
- [Ryan Gutierrez](https://twitter.com/gootecks)
|
||||||
* pogchamp (Image)
|
* pogchamp (Image)
|
||||||
- [Safebooru](https://safebooru.org/)
|
- [Safebooru](https://safebooru.org/)
|
||||||
|
|||||||
@@ -12,26 +12,24 @@ module.exports = class WouldYouRatherCommand extends Command {
|
|||||||
description: 'Responds with a random "Would you rather ...?" question.',
|
description: 'Responds with a random "Would you rather ...?" question.',
|
||||||
credit: [
|
credit: [
|
||||||
{
|
{
|
||||||
name: 'rrrather',
|
name: 'either',
|
||||||
url: 'https://www.rrrather.com/',
|
url: 'http://either.io',
|
||||||
reason: 'API',
|
reason: 'API'
|
||||||
reasonURL: 'https://www.rrrather.com/botapi'
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
const data = await this.fetchScenario(msg.channel.nsfw || false);
|
const data = await this.fetchScenario();
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
${data.title}
|
${data.prefix ? `${data.prefix}, would you rather...` : 'Would you rather...'}
|
||||||
**${data.choicea}** or **${data.choiceb}**
|
**${data.option_1}** or **${data.option_2}**
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchScenario(nsfw) {
|
async fetchScenario() {
|
||||||
const { body } = await request.get('https://www.rrrather.com/botapi');
|
const { text } = await request.get('http://either.io/');
|
||||||
if (body.nsfw && !nsfw) return this.fetchScenario(nsfw);
|
return JSON.parse(text.match(/window.initial_question = (\{.+\})/)[1]).question;
|
||||||
return body;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "119.23.1",
|
"version": "119.23.2",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user