mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
snekfetch
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class StrawpollCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -38,7 +38,7 @@ module.exports = class StrawpollCommand extends Command {
|
||||
if (options.length < 2) return msg.say('You provided less than two choices.');
|
||||
if (options.length > 31) return msg.say('You provided more than thirty choices.');
|
||||
try {
|
||||
const { body } = await request
|
||||
const { body } = await snekfetch
|
||||
.post('https://strawpoll.me/api/v2/polls')
|
||||
.send({ title, options });
|
||||
return msg.say(stripIndents`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class TodayCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -17,9 +17,8 @@ module.exports = class TodayCommand extends Command {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { text } = await request
|
||||
.get('http://history.muffinlabs.com/date')
|
||||
.buffer(true);
|
||||
const { text } = await snekfetch
|
||||
.get('http://history.muffinlabs.com/date');
|
||||
const parsed = JSON.parse(text);
|
||||
const events = parsed.data.Events;
|
||||
const event = events[Math.floor(Math.random() * events.length)];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class WouldYouRatherCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -18,7 +18,7 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { body } = await request
|
||||
const { body } = await snekfetch
|
||||
.get('http://www.rrrather.com/botapi');
|
||||
const embed = new RichEmbed()
|
||||
.setTitle(`${body.title}...`)
|
||||
|
||||
Reference in New Issue
Block a user