Switched to content.embeds

This commit is contained in:
Essem 2021-11-09 22:09:10 -06:00
parent ef5023b639
commit fae75db44a
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
19 changed files with 195 additions and 197 deletions

View file

@ -25,18 +25,18 @@ class CountCommand extends Command {
});
for (const [i, value] of groups.entries()) {
embeds.push({
"embed": {
"title": "Command Usage Counts",
"color": 16711680,
"footer": {
"text": `Page ${i + 1} of ${groups.length}`
embeds: [{
title: "Command Usage Counts",
color: 16711680,
footer: {
text: `Page ${i + 1} of ${groups.length}`
},
"description": value.join("\n"),
"author": {
"name": this.message.author.username,
"icon_url": this.message.author.avatarURL
description: value.join("\n"),
author: {
name: this.message.author.username,
icon_url: this.message.author.avatarURL
}
}
}]
});
}
return paginator(this.client, this.message, embeds);

View file

@ -16,35 +16,35 @@ class HelpCommand extends Command {
const info = collections.info.get(command);
const counts = await database.getCounts();
const embed = {
"embed": {
"author": {
"name": "esmBot Help",
"icon_url": this.client.user.avatarURL
embeds: [{
author: {
name: "esmBot Help",
icon_url: this.client.user.avatarURL
},
"title": `${this.message.channel.guild ? prefix : ""}${command}`,
"url": "https://projectlounge.pw/esmBot/help.html",
"description": command === "tags" ? "The main tags command. Check the help page for more info: https://projectlounge.pw/esmBot/help.html" : info.description,
"color": 16711680,
"fields": [{
"name": "Aliases",
"value": info.aliases.length !== 0 ? info.aliases.join(", ") : "None"
title: `${this.message.channel.guild ? prefix : ""}${command}`,
url: "https://projectlounge.pw/esmBot/help.html",
description: command === "tags" ? "The main tags command. Check the help page for more info: https://projectlounge.pw/esmBot/help.html" : info.description,
color: 16711680,
fields: [{
name: "Aliases",
value: info.aliases.length !== 0 ? info.aliases.join(", ") : "None"
}, {
"name": "Times Used",
"value": counts[command],
"inline": true
name: "Times Used",
value: counts[command],
inline: true
}, {
"name": "Parameters",
"value": command === "tags" ? "[name]" : (info.params ? (info.params.length !== 0 ? info.params.join(" ") : "None") : "None"),
"inline": true
name: "Parameters",
value: command === "tags" ? "[name]" : (info.params ? (info.params.length !== 0 ? info.params.join(" ") : "None") : "None"),
inline: true
}]
}
}]
};
if (info.flags.length !== 0) {
const flagInfo = [];
for (const flag of info.flags) {
flagInfo.push(`\`--${flag.name}${flag.type ? `=[${flag.type}]` : ""}\` - ${flag.description}`);
}
embed.embed.fields.push({
embed.embeds[0].fields.push({
"name": "Flags",
"value": flagInfo.join("\n")
});
@ -74,25 +74,25 @@ class HelpCommand extends Command {
const embeds = [];
for (const [i, value] of pages.entries()) {
embeds.push({
"embed": {
"author": {
"name": "esmBot Help",
"icon_url": this.client.user.avatarURL
embeds: [{
author: {
name: "esmBot Help",
icon_url: this.client.user.avatarURL
},
"title": value.title,
"description": value.page.join("\n"),
"color": 16711680,
"footer": {
"text": `Page ${i + 1} of ${pages.length}`
title: value.title,
description: value.page.join("\n"),
color: 16711680,
footer: {
text: `Page ${i + 1} of ${pages.length}`
},
"fields": [{
"name": "Prefix",
"value": this.message.channel.guild ? prefix : "N/A"
fields: [{
name: "Prefix",
value: this.message.channel.guild ? prefix : "N/A"
}, {
"name": "Tip",
"value": random(tips)
name: "Tip",
value: random(tips)
}]
}
}]
});
}
return paginator(this.client, this.message, embeds);

View file

@ -16,21 +16,21 @@ class ImageSearchCommand extends Command {
const images = rawImages.results.filter((val) => !val.img_src.startsWith("data:"));
for (const [i, value] of images.entries()) {
embeds.push({
"embed": {
"title": "Search Results",
"color": 16711680,
"footer": {
"text": `Page ${i + 1} of ${images.length}`
embeds: [{
title: "Search Results",
color: 16711680,
footer: {
text: `Page ${i + 1} of ${images.length}`
},
"description": value.title,
"image": {
"url": encodeURI(value.img_src)
description: value.title,
image: {
url: encodeURI(value.img_src)
},
"author": {
"name": this.message.author.username,
"icon_url": this.message.author.avatarURL
author: {
name: this.message.author.username,
icon_url: this.message.author.avatarURL
}
}
}]
});
}
return paginator(this.client, this.message, embeds);

View file

@ -5,7 +5,7 @@ class ImageStatsCommand extends Command {
await this.client.sendChannelTyping(this.message.channel.id);
const servers = await this.ipc.command("image", { type: "stats" }, true);
const embed = {
embed: {
embeds: [{
"author": {
"name": "esmBot Image Statistics",
"icon_url": this.client.user.avatarURL
@ -13,10 +13,10 @@ class ImageStatsCommand extends Command {
"color": 16711680,
"description": `The bot is currently connected to ${servers.length} image server(s).`,
"fields": []
}
}]
};
for (let i = 0; i < servers.length; i++) {
embed.embed.fields.push({
embed.embeds[0].fields.push({
name: `Server ${i + 1}`,
value: `Running Jobs: ${servers[i].runningJobs}\nQueued: ${servers[i].queued}\nMax Jobs: ${servers[i].max}`
});

View file

@ -10,39 +10,39 @@ class InfoCommand extends Command {
const owner = await this.ipc.fetchUser(process.env.OWNER.split(",")[0]);
const stats = await this.ipc.getStats();
return {
"embed": {
"color": 16711680,
"author": {
"name": "esmBot Info/Credits",
"icon_url": this.client.user.avatarURL
embeds: [{
color: 16711680,
author: {
name: "esmBot Info/Credits",
icon_url: this.client.user.avatarURL
},
"description": `This instance is managed by **${owner.username}#${owner.discriminator}**.`,
"fields": [{
"name": " Version:",
"value": `v${version}${process.env.NODE_ENV === "development" ? `-dev (${(await exec("git rev-parse HEAD")).stdout.substring(0, 7)})` : ""}`
description: `This instance is managed by **${owner.username}#${owner.discriminator}**.`,
fields: [{
name: " Version:",
value: `v${version}${process.env.NODE_ENV === "development" ? `-dev (${(await exec("git rev-parse HEAD")).stdout.substring(0, 7)})` : ""}`
},
{
"name": "📝 Credits:",
"value": "Bot by **[Essem](https://essem.space)** and **[various contributors](https://github.com/esmBot/esmBot/graphs/contributors)**\nIcon by **[MintBurrow](https://twitter.com/MintBurrow)**"
name: "📝 Credits:",
value: "Bot by **[Essem](https://essem.space)** and **[various contributors](https://github.com/esmBot/esmBot/graphs/contributors)**\nIcon by **[MintBurrow](https://twitter.com/MintBurrow)**"
},
{
"name": "💬 Total Servers:",
"value": stats && stats.guilds ? stats.guilds : `${this.client.guilds.size} (for this cluster only)`
name: "💬 Total Servers:",
value: stats && stats.guilds ? stats.guilds : `${this.client.guilds.size} (for this cluster only)`
},
{
"name": "✅ Official Server:",
"value": "[Click here!](https://projectlounge.pw/support)"
name: "✅ Official Server:",
value: "[Click here!](https://projectlounge.pw/support)"
},
{
"name": "💻 Source Code:",
"value": "[Click here!](https://github.com/esmBot/esmBot)"
name: "💻 Source Code:",
value: "[Click here!](https://github.com/esmBot/esmBot)"
},
{
"name": "🐦 Twitter:",
"value": "[Click here!](https://twitter.com/esmBot_)"
name: "🐦 Twitter:",
value: "[Click here!](https://twitter.com/esmBot_)"
}
]
}
}]
};
}

View file

@ -5,43 +5,43 @@ class ServerInfoCommand extends Command {
if (!this.message.channel.guild) return "This command only works in servers!";
const owner = await this.message.channel.guild.members.get(this.message.channel.guild.ownerID);
return {
"embed": {
"title": this.message.channel.guild.name,
"thumbnail": {
"url": this.message.channel.guild.iconURL
embeds: [{
title: this.message.channel.guild.name,
thumbnail: {
url: this.message.channel.guild.iconURL
},
"color": 16711680,
"fields": [
color: 16711680,
fields: [
{
"name": "🔢 **ID:**",
"value": this.message.channel.guild.id
name: "🔢 **ID:**",
value: this.message.channel.guild.id
},
{
"name": "👤 **Owner:**",
"value": owner ? `${owner.user.username}#${owner.user.discriminator}` : this.message.channel.guild.ownerID
name: "👤 **Owner:**",
value: owner ? `${owner.user.username}#${owner.user.discriminator}` : this.message.channel.guild.ownerID
},
{
"name": "🗺 **Region:**",
"value": this.message.channel.guild.region
name: "🗺 **Region:**",
value: this.message.channel.guild.region
},
{
"name": "🗓 **Created on:**",
"value": `<t:${Math.floor(this.message.channel.guild.createdAt / 1000)}:F>`
name: "🗓 **Created on:**",
value: `<t:${Math.floor(this.message.channel.guild.createdAt / 1000)}:F>`
},
{
"name": "👥 **Users:**",
"value": this.message.channel.guild.memberCount
name: "👥 **Users:**",
value: this.message.channel.guild.memberCount
},
{
"name": "💬 **Channels:**",
"value": this.message.channel.guild.channels.size
name: "💬 **Channels:**",
value: this.message.channel.guild.channels.size
},
{
"name": "😃 **Emojis:**",
"value": this.message.channel.guild.emojis.length
name: "😃 **Emojis:**",
value: this.message.channel.guild.emojis.length
}
]
}
}]
};
}

View file

@ -14,7 +14,7 @@ class StatsCommand extends Command {
const owner = await this.ipc.fetchUser(process.env.OWNER.split(",")[0]);
const stats = await this.ipc.getStats();
return {
embed: {
embeds: [{
"author": {
"name": "esmBot Statistics",
"icon_url": this.client.user.avatarURL
@ -74,7 +74,7 @@ class StatsCommand extends Command {
"inline": true
}
]
}
}]
};
}

View file

@ -9,13 +9,13 @@ class StickerCommand extends Command {
return `https://cdn.discordapp.com/stickers/${result.id}.png`;
} else if (result.format_type === 2) { // APNG
return {
embed: {
embeds: [{
color: 16711680,
description: `[This sticker is an APNG; however, since Discord doesn't allow displaying APNGs outside of stickers, you'll have to save it or open it in your browser to view it.](https://cdn.discordapp.com/stickers/${result.id}.png)`,
image: {
url: `https://cdn.discordapp.com/stickers/${result.id}.png`
}
}
}]
};
} else if (result.format_type === 3) { // Lottie
return `I can't display this sticker because it uses the Lottie animation format; however, I can give you the raw JSON link to it: https://cdn.discordapp.com/stickers/${result.id}.json`;

View file

@ -17,35 +17,35 @@ class UserInfoCommand extends Command {
}
const member = this.message.channel.guild ? this.message.channel.guild.members.get(user.id) : undefined;
return {
"embed": {
"title": `${user.username}#${user.discriminator}`,
"thumbnail": {
"url": user.avatarURL
embeds: [{
title: `${user.username}#${user.discriminator}`,
thumbnail: {
url: user.avatarURL
},
"color": 16711680,
"fields": [
color: 16711680,
fields: [
{
"name": "🔢 **ID:**",
"value": user.id
name: "🔢 **ID:**",
value: user.id
},
{
"name": "📛 **Nickname:**",
"value": member ? (member.nick ? member.nick : "None") : "N/A"
name: "📛 **Nickname:**",
value: member ? (member.nick ? member.nick : "None") : "N/A"
},
{
"name": "🤖 **Bot:**",
"value": user.bot ? "Yes" : "No"
name: "🤖 **Bot:**",
value: user.bot ? "Yes" : "No"
},
{
"name": "🗓️ **Joined Discord on:**",
"value": `<t:${Math.floor(user.createdAt / 1000)}:F>`
name: "🗓️ **Joined Discord on:**",
value: `<t:${Math.floor(user.createdAt / 1000)}:F>`
},
{
"name": "💬 **Joined this server on:**",
"value": member ? `<t:${Math.floor(member.joinedAt / 1000)}:F>` : "N/A"
name: "💬 **Joined this server on:**",
value: member ? `<t:${Math.floor(member.joinedAt / 1000)}:F>` : "N/A"
}
]
}
}]
};
}