mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 08:22:22 +02:00
Would You Rather like WYPTB
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class WouldYouRatherCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'would-you-rather',
|
||||
aliases: ['wy-rather', 'wyr'],
|
||||
group: 'random-res',
|
||||
memberName: 'would-you-rather',
|
||||
description: 'Responds with a random "Would you rather ...?" question.',
|
||||
credit: [
|
||||
{
|
||||
name: 'either',
|
||||
url: 'http://either.io',
|
||||
reason: 'API'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const data = await this.fetchScenario();
|
||||
return msg.say(stripIndents`
|
||||
${data.prefix ? `${data.prefix}, would you rather...` : 'Would you rather...'}
|
||||
**${data.option_1}** or **${data.option_2}**
|
||||
`);
|
||||
}
|
||||
|
||||
async fetchScenario() {
|
||||
const { text } = await request.get('http://either.io/');
|
||||
return JSON.parse(text.match(/window.initial_question = (\{.+\})/)[1]).question;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user