mrmBot-Matrix/commands/general/info.js

60 lines
2.2 KiB
JavaScript
Raw Normal View History

import { readFileSync } from "fs";
import { dirname } from "path";
import { fileURLToPath } from "url";
const { version } = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url)));
import Command from "../../classes/command.js";
import { exec as baseExec } from "child_process";
import { promisify } from "util";
const exec = promisify(baseExec);
class InfoCommand extends Command {
async run() {
let owner = await this.ipc.fetchUser(process.env.OWNER.split(",")[0]);
if (!owner) owner = await this.client.getRESTUser(process.env.OWNER.split(",")[0]);
2021-07-05 04:15:27 +00:00
const stats = await this.ipc.getStats();
return {
2021-11-10 04:09:10 +00:00
embeds: [{
color: 16711680,
author: {
name: "esmBot Info/Credits",
icon_url: this.client.user.avatarURL
},
2021-11-10 04:09:10 +00:00
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", { cwd: dirname(fileURLToPath(import.meta.url)) })).stdout.substring(0, 7)})` : ""}`
},
{
2021-11-10 04:09:10 +00:00
name: "📝 Credits:",
value: "Bot by **[Essem](https://essem.space)** and **[various contributors](https://github.com/esmBot/esmBot/graphs/contributors)**\nLogo by **[MintBurrow](https://twitter.com/MintBurrow)**"
},
{
2021-11-10 04:09:10 +00:00
name: "💬 Total Servers:",
value: stats?.guilds ? stats.guilds : `${this.client.guilds.size} (for this cluster only)`
},
{
2021-11-10 04:09:10 +00:00
name: "✅ Official Server:",
value: "[Click here!](https://projectlounge.pw/support)"
},
{
2021-11-10 04:09:10 +00:00
name: "💻 Source Code:",
value: "[Click here!](https://github.com/esmBot/esmBot)"
},
{
name: "🛡️ Privacy Policy:",
value: "[Click here!](https://projectlounge.pw/esmBot/privacy.html)"
},
{
2021-11-10 04:09:10 +00:00
name: "🐦 Twitter:",
value: "[Click here!](https://twitter.com/esmBot_)"
}
]
2021-11-10 04:09:10 +00:00
}]
};
}
static description = "Gets some info and credits about me";
static aliases = ["botinfo", "credits"];
}
export default InfoCommand;