Added sticker, reimplemented reload, removed user count from stats

This commit is contained in:
Essem 2021-08-23 00:37:09 -05:00
parent 7009ff339f
commit f0e19d6ad3
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
7 changed files with 50 additions and 74 deletions

View file

@ -4,7 +4,7 @@ class ReloadCommand extends Command {
// quite possibly one of the hackiest commands in the bot
run() {
return new Promise((resolve) => {
/*if (this.message.author.id !== process.env.OWNER) resolve("Only the bot owner can reload commands!");
if (this.message.author.id !== process.env.OWNER) resolve("Only the bot owner can reload commands!");
if (this.args.length === 0) resolve("You need to provide a command to reload!");
this.ipc.broadcast("reload", this.args[0]);
this.ipc.register("reloadSuccess", () => {
@ -16,8 +16,7 @@ class ReloadCommand extends Command {
this.ipc.unregister("reloadSuccess");
this.ipc.unregister("reloadFail");
resolve(message);
});*/
resolve("This command is currently disabled until the ECMAScript module format supports unloading imported files.");
});
});
}

View file

@ -42,7 +42,8 @@ class StatsCommand extends Command {
},
{
"name": "Host",
"value": `${os.type()} ${os.release()} (${os.arch()})`
"value": `${os.type()} ${os.release()} (${os.arch()})`,
"inline": true
},
{
"name": "Library",
@ -68,11 +69,6 @@ class StatsCommand extends Command {
"name": "Servers",
"value": stats && stats.guilds ? stats.guilds : `${this.client.guilds.size} (for this cluster only)`,
"inline": true
},
{
"name": "Users (approximation)",
"value": stats && stats.users ? stats.users : `${this.client.users.size} (for this cluster only)`,
"inline": true
}
]
}

View file

@ -0,0 +1,31 @@
import Command from "../../classes/command.js";
class StickerCommand extends Command {
async run() {
if (!this.message.stickerItems) return "You need to provide a sticker!";
const sticker = this.message.stickerItems[0];
if (sticker.format_type === 1) { // PNG
return `https://cdn.discordapp.com/stickers/${sticker.id}.png`;
} else if (sticker.format_type === 2) { // APNG
return {
embed: {
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/${sticker.id}.png)`,
image: {
url: `https://cdn.discordapp.com/stickers/${sticker.id}.png`
}
}
};
} else if (sticker.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/${sticker.id}.json`;
} else {
return "I don't recognize that sticker format!";
}
}
static description = "Gets a raw sticker image";
static aliases = ["s", "stick"];
static arguments = ["[sticker]"];
}
export default StickerCommand;