fix "[DEPRECATED] content.embed is deprecated. Use content.embeds instead"

This commit is contained in:
Cynthia Foxwell 2021-08-29 20:04:26 -06:00
parent 4dadf820af
commit 94d3f4b3e6
2 changed files with 63 additions and 45 deletions

View file

@ -89,11 +89,13 @@ async function CommandDispatcher(msg) {
file = response.file;
delete response.file;
}
if (response.embed) {
response.embed.color =
response.embed.color ||
if (response.embeds) {
for (const embed of response.embeds) {
embed.color =
embed.color ||
getTopColor(msg, hf.bot.user.id, pastelize(hf.bot.user.id));
}
}
if (response.reaction) {
msg.addReaction(response.reaction);
} else {

View file

@ -80,13 +80,15 @@ avatar.callback = async function (msg, line) {
: "png?size=1024"
}`;
return {
embed: {
embeds: [
{
title: "Server Icon",
url,
image: {
url,
},
},
],
};
}
} else if (line) {
@ -103,13 +105,15 @@ avatar.callback = async function (msg, line) {
avatar.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
}`;
return {
embed: {
embeds: [
{
title: `Avatar for \`${user.username}#${user.discriminator}\``,
url,
image: {
url,
},
},
],
};
}
} else {
@ -118,13 +122,15 @@ avatar.callback = async function (msg, line) {
avatar.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
}`;
return {
embed: {
embeds: [
{
title: `Avatar for \`${msg.author.username}#${msg.author.discriminator}\``,
url,
image: {
url,
},
},
],
};
}
};
@ -149,13 +155,15 @@ banner.callback = async function (msg, line) {
: "png?size=1024"
}`;
return {
embed: {
embeds: [
{
title: "Server Banner",
url,
image: {
url,
},
},
],
};
}
} else if (line) {
@ -179,13 +187,15 @@ banner.callback = async function (msg, line) {
user.banner.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
}`;
return {
embed: {
embeds: [
{
title: `Banner for \`${user.username}#${user.discriminator}\``,
url,
image: {
url,
},
},
],
};
};
hf.registerCommand(banner);
@ -463,13 +473,15 @@ jumbo.callback = async function (msg, line) {
const animated = animatedFlag === "a";
return {
embed: {
embeds: [
{
title: `:${name}: - \`${id}\``,
url: `${EMOTE_BASE}${id}.${animated ? "gif" : "png"}?v=1`,
image: {
url: `${EMOTE_BASE}${id}.${animated ? "gif" : "png"}?v=1`,
},
},
],
};
} else {
let setName = "twemoji";
@ -506,13 +518,15 @@ jumbo.callback = async function (msg, line) {
.toBuffer();
return {
embed: {
embeds: [
{
title: `${name} (${emoji.toUpperCase().replace(/[-_]/g, ", ")})`,
url,
image: {
url: "attachment://emoji.png",
},
},
],
file: {
file: converted,
name: "emoji.png",
@ -520,13 +534,15 @@ jumbo.callback = async function (msg, line) {
};
} else {
return {
embed: {
embeds: [
{
title: `${name} (${emoji.toUpperCase().replace(/[-_]/g, ", ")})`,
url,
image: {
url,
},
},
],
};
}
}