mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const request = require('node-superfetch');
|
const request = require('node-superfetch');
|
||||||
const { stripIndents } = require('common-tags');
|
const { stripIndent } = require('common-tags');
|
||||||
|
|
||||||
module.exports = class PoemCommand extends Command {
|
module.exports = class PoemCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -38,8 +38,9 @@ module.exports = class PoemCommand extends Command {
|
|||||||
async run(msg, { author, title }) {
|
async run(msg, { author, title }) {
|
||||||
try {
|
try {
|
||||||
const { body } = await request.get(`https://poetrydb.org/author,title/${author};${title}`);
|
const { body } = await request.get(`https://poetrydb.org/author,title/${author};${title}`);
|
||||||
|
if (body.status === 404) return msg.say('Could not find any results.');
|
||||||
const data = body[0];
|
const data = body[0];
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndent`
|
||||||
**${data.title}** by **${data.author}**
|
**${data.title}** by **${data.author}**
|
||||||
${data.lines.join('\n')}
|
${data.lines.join('\n')}
|
||||||
`);
|
`);
|
||||||
|
|||||||
Reference in New Issue
Block a user