mirror of
https://github.com/Technicolor-creamsicle/Osselbot.git
synced 2025-01-21 13:47:18 -05:00
fumck
This commit is contained in:
parent
03a9b72247
commit
a9cf34717b
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Launch Program",
|
||||||
|
"skipFiles": [
|
||||||
|
"<node_internals>/**"
|
||||||
|
],
|
||||||
|
"program": "${workspaceFolder}/src/index.js"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
35
src/index.js
35
src/index.js
@ -238,33 +238,28 @@ client.on("message", async message => {
|
|||||||
/////////Funny DHS is funny///////////
|
/////////Funny DHS is funny///////////
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
if (command == "xkcd") {
|
if (command == "xkcd") {
|
||||||
let comic = ""
|
async function getcomic(args) {
|
||||||
if (!isNaN(args[0])) {
|
var comic
|
||||||
fetch(`https://xkcd.com/${args[0]}/info.0.json`)
|
try {
|
||||||
.then(res => res.json())
|
var response = await fetch(`https://xkcd.com/${args[0]}/info.0.json`);
|
||||||
.then(json => comic = json)
|
comic = await response.text();
|
||||||
// eslint-disable-next-line no-unused-vars
|
} catch (e) {
|
||||||
.catch(err => message.reply("Something went wrong... Check your number and try again later."));
|
console.error(e);
|
||||||
|
return 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);
|
|
||||||
}
|
}
|
||||||
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."));
|
getcomic();
|
||||||
|
|
||||||
let embed = new Discord.MessageEmbed()
|
let embed = new Discord.MessageEmbed()
|
||||||
.setTitle(`xkcd #${args[0]}`)
|
.setTitle(`xkcd #${comic.num}`)
|
||||||
.setAuthor("Randel Munroe")
|
.setAuthor("Randel Munroe")
|
||||||
.setColor(0xffffff)
|
.setColor(0xffffff)
|
||||||
.image(`${comic.img}`);
|
.image(`${comic.img}`);
|
||||||
return message.channel.send(embed);
|
return message.channel.send(embed);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user