More slash commands, rework soundboard commands, added generic music and soundboard commands, tweak speechbubble
This commit is contained in:
parent
c821d91254
commit
a91c73b5bd
68 changed files with 502 additions and 389 deletions
|
@ -4,12 +4,14 @@ class Command {
|
|||
this.cluster = cluster;
|
||||
this.worker = worker;
|
||||
this.ipc = ipc;
|
||||
this.origOptions = options;
|
||||
this.type = options.type;
|
||||
this.args = options.args;
|
||||
if (options.type === "classic") {
|
||||
this.message = options.message;
|
||||
this.channel = options.message.channel;
|
||||
this.author = options.message.author;
|
||||
this.member = options.message.member;
|
||||
this.content = options.content;
|
||||
this.specialArgs = options.specialArgs;
|
||||
this.reference = {
|
||||
|
@ -26,12 +28,13 @@ class Command {
|
|||
} else if (options.type === "application") {
|
||||
this.interaction = options.interaction;
|
||||
this.channel = options.interaction.channel;
|
||||
this.author = options.interaction.guildID ? options.interaction.member : options.interaction.user;
|
||||
this.author = this.member = options.interaction.guildID ? options.interaction.member : options.interaction.user;
|
||||
if (options.interaction.data.options) {
|
||||
this.specialArgs = this.options = options.interaction.data.options.reduce((obj, item) => {
|
||||
obj[item.name] = item.value;
|
||||
return obj;
|
||||
}, {});
|
||||
this.optionsArray = options.interaction.data.options;
|
||||
} else {
|
||||
this.specialArgs = this.options = {};
|
||||
}
|
||||
|
@ -50,6 +53,10 @@ class Command {
|
|||
}
|
||||
}
|
||||
|
||||
static init() {
|
||||
return this;
|
||||
}
|
||||
|
||||
static description = "No description found";
|
||||
static aliases = [];
|
||||
static arguments = [];
|
||||
|
|
|
@ -33,30 +33,6 @@ class ImageCommand extends Command {
|
|||
]
|
||||
};*/
|
||||
|
||||
constructor(client, cluster, worker, ipc, options) {
|
||||
super(client, cluster, worker, ipc, options);
|
||||
this.flags = [];
|
||||
if (this.constructor.requiresText || this.constructor.textOptional) {
|
||||
this.flags.push({
|
||||
name: "text",
|
||||
type: 3,
|
||||
description: "The text to put on the image",
|
||||
required: !this.constructor.textOptional
|
||||
});
|
||||
}
|
||||
if (this.constructor.requiresImage) {
|
||||
this.flags.push({
|
||||
name: "image",
|
||||
type: 11,
|
||||
description: "An image/GIF attachment"
|
||||
}, {
|
||||
name: "link",
|
||||
type: 3,
|
||||
description: "An image/GIF URL"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async criteria() {
|
||||
return true;
|
||||
}
|
||||
|
@ -98,7 +74,6 @@ class ImageCommand extends Command {
|
|||
runningCommands.delete(this.author.id);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.constructor.requiresText) {
|
||||
|
@ -122,7 +97,7 @@ class ImageCommand extends Command {
|
|||
if (magickParams.params.type === "image/gif" && this.type === "classic") {
|
||||
status = await this.processMessage(this.message);
|
||||
} else {
|
||||
this.acknowledge();
|
||||
await this.acknowledge();
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -148,6 +123,30 @@ class ImageCommand extends Command {
|
|||
return this.client.createMessage(message.channel.id, `${random(emotes) || process.env.PROCESSING_EMOJI || "<a:processing:479351417102925854>"} Processing... This might take a while`);
|
||||
}
|
||||
|
||||
static init() {
|
||||
this.flags = [];
|
||||
if (this.requiresText || this.textOptional) {
|
||||
this.flags.push({
|
||||
name: "text",
|
||||
type: 3,
|
||||
description: "The text to put on the image",
|
||||
required: !this.textOptional
|
||||
});
|
||||
}
|
||||
if (this.requiresImage) {
|
||||
this.flags.push({
|
||||
name: "image",
|
||||
type: 11,
|
||||
description: "An image/GIF attachment"
|
||||
}, {
|
||||
name: "link",
|
||||
type: 3,
|
||||
description: "An image/GIF URL"
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
static requiresImage = true;
|
||||
static requiresText = false;
|
||||
static textOptional = false;
|
||||
|
|
14
classes/soundboardCommand.js
Normal file
14
classes/soundboardCommand.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Command from "./command.js";
|
||||
import { play } from "../utils/soundplayer.js";
|
||||
|
||||
// only exists to sort the various soundboard commands
|
||||
class SoundboardCommand extends Command {
|
||||
async run() {
|
||||
return await play(this.client, this.constructor.file, { channel: this.channel, author: this.author, type: this.type, interaction: this.interaction });
|
||||
}
|
||||
|
||||
static requires = ["sound"];
|
||||
static slashAllowed = false;
|
||||
}
|
||||
|
||||
export default SoundboardCommand;
|
Loading…
Add table
Add a link
Reference in a new issue