mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 14:19:56 +02:00
snekfetch why
This commit is contained in:
@@ -19,7 +19,7 @@ module.exports = class WhosThatPokemonCommand extends Command {
|
|||||||
const pokemon = Math.floor(Math.random() * 721) + 1;
|
const pokemon = Math.floor(Math.random() * 721) + 1;
|
||||||
try {
|
try {
|
||||||
const { body } = await snekfetch
|
const { body } = await snekfetch
|
||||||
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}`);
|
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
|
||||||
const names = body.names.map(name => name.name.toLowerCase());
|
const names = body.names.map(name => name.name.toLowerCase());
|
||||||
const displayName = filterPkmn(body.names).name;
|
const displayName = filterPkmn(body.names).name;
|
||||||
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module.exports = class HoroscopeCommand extends Command {
|
|||||||
const { sign } = args;
|
const { sign } = args;
|
||||||
try {
|
try {
|
||||||
const { text } = await snekfetch
|
const { text } = await snekfetch
|
||||||
.get(`http://sandipbgt.com/theastrologer/api/horoscope/${sign}/today`);
|
.get(`http://sandipbgt.com/theastrologer/api/horoscope/${sign}/today/`);
|
||||||
const body = JSON.parse(text);
|
const body = JSON.parse(text);
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0x9797FF)
|
.setColor(0x9797FF)
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ module.exports = class StrawpollCommand extends Command {
|
|||||||
if (options.length > 31) return msg.say('Please provide thirty or less choices.');
|
if (options.length > 31) return msg.say('Please provide thirty or less choices.');
|
||||||
try {
|
try {
|
||||||
const { body } = await snekfetch
|
const { body } = await snekfetch
|
||||||
.post('https://strawpoll.me/api/v2/polls')
|
.post('https://strawpoll.me/api/v2/polls', { followRedirects: true })
|
||||||
|
.set({ 'Content-Type': 'application/json' })
|
||||||
.send({ title, options });
|
.send({ title, options });
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
${body.title}
|
${body.title}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ module.exports = class BulbapediaCommand extends Command {
|
|||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
const { body } = await snekfetch
|
const { body } = await snekfetch
|
||||||
.get('http://bulbapedia.bulbagarden.net/w/api.php')
|
.get('https://bulbapedia.bulbagarden.net/w/api.php')
|
||||||
.query({
|
.query({
|
||||||
action: 'query',
|
action: 'query',
|
||||||
prop: 'extracts',
|
prop: 'extracts',
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module.exports = class PokedexCommand extends Command {
|
|||||||
const { pokemon } = args;
|
const { pokemon } = args;
|
||||||
try {
|
try {
|
||||||
const { body } = await snekfetch
|
const { body } = await snekfetch
|
||||||
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}`);
|
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}/`);
|
||||||
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0xED1C24)
|
.setColor(0xED1C24)
|
||||||
|
|||||||
Reference in New Issue
Block a user