2022-04-05 03:05:28 +00:00
|
|
|
import Command from "../../classes/command.js";
|
|
|
|
import { commands, aliases, info, categories } from "../../utils/collections.js";
|
|
|
|
|
|
|
|
// all-in-one music command
|
|
|
|
class MusicAIOCommand extends Command {
|
|
|
|
async run() {
|
|
|
|
let cmd = this.type === "classic" ? this.args[0] : this.optionsArray[0].name;
|
2022-09-01 01:00:34 +00:00
|
|
|
if (cmd === "music" || this.constructor.aliases.includes(cmd)) return "https://projectlounge.pw/robotdance.gif";
|
2022-04-05 03:05:28 +00:00
|
|
|
if (this.type === "classic") {
|
|
|
|
this.origOptions.args.shift();
|
|
|
|
} else {
|
|
|
|
this.origOptions.interaction.data.options = this.origOptions.interaction.data.options[0].options;
|
|
|
|
}
|
|
|
|
if (aliases.has(cmd)) cmd = aliases.get(cmd);
|
|
|
|
if (commands.has(cmd) && info.get(cmd).category === "music") {
|
|
|
|
const command = commands.get(cmd);
|
2022-09-01 01:00:34 +00:00
|
|
|
const inst = new command(this.client, this.cluster, this.worker, this.ipc, this.origOptions);
|
|
|
|
const result = await inst.run();
|
|
|
|
this.success = inst.success;
|
|
|
|
return result;
|
2022-04-05 03:05:28 +00:00
|
|
|
} else {
|
2022-09-01 01:00:34 +00:00
|
|
|
this.success = false;
|
2022-04-05 03:05:28 +00:00
|
|
|
return "That isn't a valid music command!";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static postInit() {
|
|
|
|
this.flags = [];
|
|
|
|
for (const cmd of categories.get("music")) {
|
|
|
|
if (cmd === "music") continue;
|
|
|
|
const cmdInfo = info.get(cmd);
|
|
|
|
this.flags.push({
|
|
|
|
name: cmd,
|
|
|
|
type: 1,
|
|
|
|
description: cmdInfo.description,
|
|
|
|
options: cmdInfo.flags
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
static description = "Handles music playback";
|
|
|
|
static requires = ["sound"];
|
|
|
|
static aliases = ["m"];
|
2022-06-28 21:15:31 +00:00
|
|
|
static directAllowed = false;
|
2022-04-05 03:05:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default MusicAIOCommand;
|