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-09-11 04:06:40 +00:00
|
|
|
await this.acknowledge();
|
2022-04-05 03:05:28 +00:00
|
|
|
if (this.type === "classic") {
|
|
|
|
this.origOptions.args.shift();
|
|
|
|
} else {
|
2022-09-24 16:26:56 +00:00
|
|
|
this.origOptions.interaction.data.options.raw = this.origOptions.interaction.data.options.raw[0].options;
|
2022-04-05 03:05:28 +00:00
|
|
|
}
|
|
|
|
if (aliases.has(cmd)) cmd = aliases.get(cmd);
|
|
|
|
if (commands.has(cmd) && info.get(cmd).category === "music") {
|
|
|
|
const command = commands.get(cmd);
|
2022-09-21 05:05:03 +00:00
|
|
|
const inst = new command(this.client, this.origOptions);
|
2022-09-01 01:00:34 +00:00
|
|
|
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;
|