Remove "requires" command field, overhaul Lavalink connection, fix message objects not being properly sent

This commit is contained in:
Essem 2022-10-11 10:46:10 -05:00
parent a274acd00c
commit e5fd71b388
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
10 changed files with 51 additions and 84 deletions

View file

@ -1,5 +1,5 @@
import Command from "../../classes/command.js";
import { checkStatus, reload } from "../../utils/soundplayer.js";
import { reload } from "../../utils/soundplayer.js";
class SoundReloadCommand extends Command {
async run() {
@ -9,17 +9,16 @@ class SoundReloadCommand extends Command {
return "Only the bot owner can reload Lavalink!";
}
await this.acknowledge();
const soundStatus = await checkStatus();
if (!soundStatus) {
const length = reload();
if (process.env.PM2_USAGE) {
process.send({
type: "process:msg",
data: {
type: "soundreload"
}
});
}
const length = await reload();
if (process.env.PM2_USAGE) {
process.send({
type: "process:msg",
data: {
type: "soundreload"
}
});
}
if (length) {
return `Successfully connected to ${length} Lavalink node(s).`;
} else {
return "I couldn't connect to any Lavalink nodes!";