Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Fixed waifu.pics API #1251

Merged
merged 2 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/commands/anime/neko.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { Command, SwitchbladeEmbed } = require('../../')
const fetch = require('node-fetch')
const nekoAPI = 'https://waifu.pics/api/'
const nekoAPI = 'https://waifu.pics/api'

module.exports = class Neko extends Command {
constructor (client) {
Expand All @@ -16,12 +16,12 @@ module.exports = class Neko extends Command {
channel.startTyping()

// Send a lewd neko if the channel is NSFW
const endpoint = channel.nsfw ? 'nsfw' : 'sfw'
const type = channel.nsfw ? 'nsfw' : 'sfw'

const { url } = await fetch(nekoAPI + endpoint + 'neko').then(res => res.json())
const { url } = await fetch(`${nekoAPI}/${type}/neko`).then(res => res.json())

embed.setImage(url)
.setDescription(t('commands:neko.hereIsYour', { context: endpoint }))
.setDescription(t('commands:neko.hereIsYour', { context: type }))

channel.send(embed).then(() => channel.stopTyping())
}
Expand Down
8 changes: 4 additions & 4 deletions src/commands/anime/waifu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { Command, SwitchbladeEmbed } = require('../../')
const fetch = require('node-fetch')
const waifuAPI = 'https://waifu.pics/api/'
const waifuAPI = 'https://waifu.pics/api'

module.exports = class Waifu extends Command {
constructor (client) {
Expand All @@ -15,12 +15,12 @@ module.exports = class Waifu extends Command {
channel.startTyping()

// Send a lewd waifu if the channel is NSFW
const endpoint = channel.nsfw ? 'nsfw' : 'sfw'
const type = channel.nsfw ? 'nsfw' : 'sfw'

const { url } = await fetch(waifuAPI + endpoint + 'waifu').then(res => res.json())
const { url } = await fetch(`${waifuAPI}/${type}/waifu`).then(res => res.json())

embed.setImage(url)
.setDescription(t('commands:waifu.hereIsYour', { context: endpoint }))
.setDescription(t('commands:waifu.hereIsYour', { context: type }))

channel.send(embed).then(() => channel.stopTyping())
}
Expand Down