2022-04-05 03:05:28 +00:00
|
|
|
import { play } from "../../utils/soundplayer.js";
|
|
|
|
import Command from "../../classes/command.js";
|
|
|
|
import { sounds, info } from "../../utils/collections.js";
|
|
|
|
|
|
|
|
// all-in-one soundboard command
|
|
|
|
class SoundboardAIOCommand extends Command {
|
|
|
|
async run() {
|
|
|
|
const soundName = this.type === "classic" ? this.args[0] : this.optionsArray[0].name;
|
2022-09-01 01:00:34 +00:00
|
|
|
if (!sounds.has(soundName)) {
|
|
|
|
this.success = false;
|
|
|
|
return "You need to provide a sound to play!";
|
|
|
|
}
|
2022-04-05 03:05:28 +00:00
|
|
|
const name = sounds.get(soundName);
|
2022-09-27 19:46:07 +00:00
|
|
|
await this.acknowledge();
|
2022-04-10 16:20:52 +00:00
|
|
|
return await play(this.client, name, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction });
|
2022-04-05 03:05:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static postInit() {
|
|
|
|
this.flags = [];
|
|
|
|
for (const sound of sounds.keys()) {
|
|
|
|
this.flags.push({
|
|
|
|
name: sound,
|
|
|
|
type: 1,
|
|
|
|
description: info.get(sound).description
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
static description = "Plays a sound effect";
|
|
|
|
static aliases = ["sound", "sb"];
|
2022-06-28 21:15:31 +00:00
|
|
|
static directAllowed = false;
|
2022-04-05 03:05:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default SoundboardAIOCommand;
|