Merge branch 'fleet'
This commit is contained in:
commit
e725c4d1eb
28 changed files with 851 additions and 544 deletions
|
@ -1,21 +1,9 @@
|
|||
const image = require("../../utils/image.js");
|
||||
const logger = require("../../utils/logger.js");
|
||||
const Command = require("../../classes/command.js");
|
||||
|
||||
class ImageReloadCommand extends Command {
|
||||
async run() {
|
||||
if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can reload the image servers!";
|
||||
await image.disconnect();
|
||||
await image.repopulate();
|
||||
let amount = 0;
|
||||
for (const server of image.servers) {
|
||||
try {
|
||||
await image.connect(server);
|
||||
amount += 1;
|
||||
} catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
const amount = await this.ipc.command("image", { type: "reload" }, true);
|
||||
if (amount > 0) {
|
||||
return `Successfully connected to ${amount} image servers.`;
|
||||
} else {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const image = require("../../utils/image.js");
|
||||
const Command = require("../../classes/command.js");
|
||||
|
||||
class ImageStatsCommand extends Command {
|
||||
async run() {
|
||||
const servers = await this.ipc.command("image", { type: "stats" }, true);
|
||||
const embed = {
|
||||
embed: {
|
||||
"author": {
|
||||
|
@ -10,11 +10,10 @@ class ImageStatsCommand extends Command {
|
|||
"icon_url": this.client.user.avatarURL
|
||||
},
|
||||
"color": 16711680,
|
||||
"description": `The bot is currently connected to ${image.connections.size} image server(s).`,
|
||||
"description": `The bot is currently connected to ${servers.length} image server(s).`,
|
||||
"fields": []
|
||||
}
|
||||
};
|
||||
const servers = await image.getRunning();
|
||||
for (let i = 0; i < servers.length; i++) {
|
||||
embed.embed.fields.push({
|
||||
name: `Server ${i + 1}`,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const { version } = require("../../package.json");
|
||||
const collections = require("../../utils/collections.js");
|
||||
const Command = require("../../classes/command.js");
|
||||
|
||||
class InfoCommand extends Command {
|
||||
async run() {
|
||||
const owner = await this.ipc.fetchUser(process.env.OWNER);
|
||||
const stats = await this.ipc.getStats();
|
||||
return {
|
||||
"embed": {
|
||||
"color": 16711680,
|
||||
|
@ -23,7 +23,7 @@ class InfoCommand extends Command {
|
|||
},
|
||||
{
|
||||
"name": "💬 Total Servers:",
|
||||
"value": collections.stats.guilds ? collections.stats.guilds : `${this.client.guilds.size} (for this cluster only)`
|
||||
"value": stats.guilds ? stats.guilds : `${this.client.guilds.size} (for this cluster only)`
|
||||
},
|
||||
{
|
||||
"name": "✅ Official Server:",
|
||||
|
|
|
@ -6,7 +6,7 @@ class ReloadCommand extends Command {
|
|||
return new Promise((resolve) => {
|
||||
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", { cmd: this.args[0] });
|
||||
this.ipc.broadcast("reload", this.args[0]);
|
||||
this.ipc.register("reloadSuccess", () => {
|
||||
this.ipc.unregister("reloadSuccess");
|
||||
this.ipc.unregister("reloadFail");
|
||||
|
|
|
@ -11,7 +11,8 @@ class RestartCommand extends Command {
|
|||
for (const command of collections.commands) {
|
||||
await handler.unload(command);
|
||||
}
|
||||
this.ipc.broadcast("restart");
|
||||
this.ipc.restartAllClusters();
|
||||
//this.ipc.broadcast("restart");
|
||||
}
|
||||
|
||||
static description = "Restarts me";
|
||||
|
|
|
@ -10,7 +10,7 @@ class SoundReloadCommand extends Command {
|
|||
this.ipc.register("soundReloadSuccess", (msg) => {
|
||||
this.ipc.unregister("soundReloadSuccess");
|
||||
this.ipc.unregister("soundReloadFail");
|
||||
resolve(`Successfully connected to ${msg.length} Lavalink node(s).`);
|
||||
resolve(`Successfully connected to ${msg.msg.length} Lavalink node(s).`);
|
||||
});
|
||||
this.ipc.register("soundReloadFail", () => {
|
||||
this.ipc.unregister("soundReloadSuccess");
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const { version } = require("../../package.json");
|
||||
const collections = require("../../utils/collections.js");
|
||||
const day = require("dayjs");
|
||||
day.extend(require("dayjs/plugin/duration"));
|
||||
const os = require("os");
|
||||
|
@ -10,6 +9,7 @@ class StatsCommand extends Command {
|
|||
const duration = day.duration(this.client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
|
||||
const uptime = day.duration(process.uptime(), "seconds").format(" D [days], H [hrs], m [mins], s [secs]");
|
||||
const owner = await this.ipc.fetchUser(process.env.OWNER);
|
||||
const stats = await this.ipc.getStats();
|
||||
return {
|
||||
embed: {
|
||||
"author": {
|
||||
|
@ -24,12 +24,12 @@ class StatsCommand extends Command {
|
|||
},
|
||||
{
|
||||
"name": "Cluster Memory Usage",
|
||||
"value": `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB`,
|
||||
"value": `${stats.clusters[this.cluster].ram.toFixed(2)} MB`,
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Total Memory Usage",
|
||||
"value": collections.stats.totalRam ? `${collections.stats.totalRam.toFixed(2)} MB` : "Unknown",
|
||||
"value": stats.totalRam ? `${stats.totalRam.toFixed(2)} MB` : "Unknown",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
|
@ -66,12 +66,12 @@ class StatsCommand extends Command {
|
|||
},
|
||||
{
|
||||
"name": "Servers",
|
||||
"value": collections.stats.guilds ? collections.stats.guilds : `${this.client.guilds.size} (for this cluster only)`,
|
||||
"value": stats.guilds ? stats.guilds : `${this.client.guilds.size} (for this cluster only)`,
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Users (approximation)",
|
||||
"value": collections.stats.users ? collections.stats.users : `${this.client.users.size} (for this cluster only)`,
|
||||
"value": stats.users ? stats.users : `${this.client.users.size} (for this cluster only)`,
|
||||
"inline": true
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue