mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Lots of Changes
This commit is contained in:
+13
-13
@@ -35,7 +35,8 @@ module.exports = class XKCDCommand extends Command {
|
||||
.setImage(current.body.img)
|
||||
.setFooter(current.body.alt);
|
||||
return msg.embed(embed);
|
||||
} else if (type === 'random') {
|
||||
}
|
||||
if (type === 'random') {
|
||||
const random = Math.floor(Math.random() * current.body.num) + 1;
|
||||
const { body } = await snekfetch
|
||||
.get(`https://xkcd.com/${random}/info.0.json`);
|
||||
@@ -46,18 +47,17 @@ module.exports = class XKCDCommand extends Command {
|
||||
.setImage(body.img)
|
||||
.setFooter(body.alt);
|
||||
return msg.embed(embed);
|
||||
} else {
|
||||
const choice = parseInt(type, 10);
|
||||
if (isNaN(choice) || current.body.num < choice || choice < 1) return msg.say('Invalid Number.');
|
||||
const { body } = await snekfetch
|
||||
.get(`https://xkcd.com/${choice}/info.0.json`);
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle(`${body.num} - ${body.title}`)
|
||||
.setColor(0x9797FF)
|
||||
.setURL(`https://xkcd.com/${body.num}`)
|
||||
.setImage(body.img)
|
||||
.setFooter(body.alt);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
const choice = parseInt(type, 10);
|
||||
if (isNaN(choice) || current.body.num < choice || choice < 1) return msg.say('Invalid number.');
|
||||
const { body } = await snekfetch
|
||||
.get(`https://xkcd.com/${choice}/info.0.json`);
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle(`${body.num} - ${body.title}`)
|
||||
.setColor(0x9797FF)
|
||||
.setURL(`https://xkcd.com/${body.num}`)
|
||||
.setImage(body.img)
|
||||
.setFooter(body.alt);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user