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