Slash command preparations

This commit is contained in:
Essem 2022-03-22 15:43:26 -05:00
parent a438fe26df
commit f996180fa9
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
20 changed files with 136 additions and 34 deletions

View file

@ -1,35 +1,49 @@
class Command {
constructor(client, cluster, worker, ipc, message, args, content, specialArgs) {
constructor(client, cluster, worker, ipc, options) {
this.client = client;
this.cluster = cluster;
this.worker = worker;
this.ipc = ipc;
this.message = message;
this.args = args;
this.content = content;
this.specialArgs = specialArgs;
this.reference = {
messageReference: {
channelID: this.message.channel.id,
messageID: this.message.id,
guildID: this.message.channel.guild ? this.message.channel.guild.id : undefined,
failIfNotExists: false
},
allowedMentions: {
repliedUser: false
}
};
this.type = options.type;
this.args = options.args;
if (options.type === "classic") {
this.message = options.message;
this.content = options.content;
this.specialArgs = options.specialArgs;
this.reference = {
messageReference: {
channelID: this.message.channel.id,
messageID: this.message.id,
guildID: this.message.channel.guild ? this.message.channel.guild.id : undefined,
failIfNotExists: false
},
allowedMentions: {
repliedUser: false
}
};
} else {
this.interaction = options.interaction;
}
}
async run() {
return "It works!";
}
async acknowledge() {
if (this.type === "classic") {
await this.message.channel.sendTyping();
} else {
await this.interaction.acknowledge();
}
}
static description = "No description found";
static aliases = [];
static arguments = [];
static flags = [];
static requires = [];
static slashAllowed = true;
}
export default Command;

View file

@ -96,7 +96,7 @@ class ImageCommand extends Command {
if (magickParams.params.type === "image/gif") {
status = await this.processMessage(this.message);
} else {
this.client.sendChannelTyping(this.message.channel.id);
this.acknowledge();
}
try {