Switched to content.embeds
This commit is contained in:
parent
ef5023b639
commit
fae75db44a
19 changed files with 195 additions and 197 deletions
|
@ -12,12 +12,12 @@ class AncientCommand extends Command {
|
|||
const data = await fetch("https://projectlounge.pw/meme/", { redirect: "manual", signal: controller.signal });
|
||||
clearTimeout(timeout);
|
||||
return {
|
||||
embed: {
|
||||
embeds: [{
|
||||
color: 16711680,
|
||||
image: {
|
||||
url: data.headers.get("location")
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
} catch (e) {
|
||||
if (e.name === "AbortError") {
|
||||
|
|
|
@ -7,12 +7,12 @@ class BirdCommand extends Command {
|
|||
const imageData = await fetch("http://shibe.online/api/birds");
|
||||
const json = await imageData.json();
|
||||
return {
|
||||
embed: {
|
||||
embeds: [{
|
||||
color: 16711680,
|
||||
image: {
|
||||
url: json[0]
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,12 @@ class CatCommand extends Command {
|
|||
const data = await fetch("https://projectlounge.pw/cta/", { redirect: "manual", signal: controller.signal });
|
||||
clearTimeout(timeout);
|
||||
return {
|
||||
embed: {
|
||||
embeds: [{
|
||||
color: 16711680,
|
||||
description: "Cat images are sourced from a subset of the [dm4catbot](https://twitter.com/dm4catbot) database.",
|
||||
image: {
|
||||
url: data.headers.get("location")
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
} catch (e) {
|
||||
if (e.name === "AbortError") {
|
||||
|
|
|
@ -7,12 +7,12 @@ class DogCommand extends Command {
|
|||
const imageData = await fetch("https://dog.ceo/api/breeds/image/random");
|
||||
const json = await imageData.json();
|
||||
return {
|
||||
embed: {
|
||||
embeds: [{
|
||||
color: 16711680,
|
||||
image: {
|
||||
url: json.message
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -7,18 +7,17 @@ class XKCDCommand extends Command {
|
|||
try {
|
||||
const request = await fetch(url);
|
||||
const json = await request.json();
|
||||
const embed = {
|
||||
"embed": {
|
||||
"title": json.safe_title,
|
||||
"url": `https://xkcd.com/${json.num}`,
|
||||
"color": 16711680,
|
||||
"description": json.alt,
|
||||
"image": {
|
||||
"url": json.img
|
||||
return {
|
||||
embeds: [{
|
||||
title: json.safe_title,
|
||||
url: `https://xkcd.com/${json.num}`,
|
||||
color: 16711680,
|
||||
description: json.alt,
|
||||
image: {
|
||||
url: json.img
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
return embed;
|
||||
} catch {
|
||||
return "I couldn't get that XKCD!";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue