mrmBot-Matrix/commands/general/soundreload.js

27 lines
1 KiB
JavaScript
Raw Normal View History

import Command from "../../classes/command.js";
class SoundReloadCommand extends Command {
2021-05-22 15:10:42 +00:00
// another very hacky command
run() {
return new Promise((resolve) => {
if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can reload Lavalink!";
2021-08-14 02:34:44 +00:00
this.client.sendChannelTyping(this.message.channel.id);
2021-05-22 15:10:42 +00:00
this.ipc.broadcast("soundreload");
this.ipc.register("soundReloadSuccess", (msg) => {
this.ipc.unregister("soundReloadSuccess");
this.ipc.unregister("soundReloadFail");
2021-07-06 12:53:09 +00:00
resolve(`Successfully connected to ${msg.msg.length} Lavalink node(s).`);
2021-05-22 15:10:42 +00:00
});
this.ipc.register("soundReloadFail", () => {
this.ipc.unregister("soundReloadSuccess");
this.ipc.unregister("soundReloadFail");
resolve("I couldn't connect to any Lavalink nodes!");
});
});
}
static description = "Attempts to reconnect to all available Lavalink nodes";
static aliases = ["lava", "lavalink", "lavaconnect", "soundconnect"];
}
export default SoundReloadCommand;