mirror of
https://github.com/Technicolor-creamsicle/Osselbot.git
synced 2026-08-04 06:10:35 -04:00
fumck
This commit is contained in:
+20
-25
@@ -238,33 +238,28 @@ client.on("message", async message => {
|
||||
/////////Funny DHS is funny///////////
|
||||
//////////////////////////////////////
|
||||
if (command == "xkcd") {
|
||||
let comic = ""
|
||||
if (!isNaN(args[0])) {
|
||||
fetch(`https://xkcd.com/${args[0]}/info.0.json`)
|
||||
.then(res => res.json())
|
||||
.then(json => comic = json)
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
.catch(err => message.reply("Something went wrong... Check your number and try again later."));
|
||||
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(`xkcd #${args[0]}`)
|
||||
.setAuthor("Randel Munroe")
|
||||
.setColor(0xffffff)
|
||||
.image(`${comic.img}`);
|
||||
return message.channel.send(embed);
|
||||
async function getcomic(args) {
|
||||
var comic
|
||||
try {
|
||||
var response = await fetch(`https://xkcd.com/${args[0]}/info.0.json`);
|
||||
comic = await response.text();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return message.reply("Something went wrong... Check your number and try again later.")
|
||||
}
|
||||
fetch(`https://xkcd.com/info.0.json`)
|
||||
.then(res => res.json())
|
||||
.then(json => comic = json)
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
.catch(err => message.reply("Something went wrong... Check your number and try again later."));
|
||||
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(`xkcd #${args[0]}`)
|
||||
.setAuthor("Randel Munroe")
|
||||
.setColor(0xffffff)
|
||||
.image(`${comic.img}`);
|
||||
return message.channel.send(embed);
|
||||
}
|
||||
|
||||
|
||||
getcomic();
|
||||
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(`xkcd #${comic.num}`)
|
||||
.setAuthor("Randel Munroe")
|
||||
.setColor(0xffffff)
|
||||
.image(`${comic.img}`);
|
||||
return message.channel.send(embed);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user