Remove delay parameter, change argument handling, make help command show proper flag types
This commit is contained in:
parent
28f0245652
commit
6b34cb9d9e
63 changed files with 82 additions and 219 deletions
|
@ -13,7 +13,7 @@ class Command {
|
|||
this.author = options.message.author;
|
||||
this.member = options.message.member;
|
||||
this.content = options.content;
|
||||
this.specialArgs = options.specialArgs;
|
||||
this.specialArgs = this.options = options.specialArgs;
|
||||
this.reference = {
|
||||
messageReference: {
|
||||
channelID: this.channel.id,
|
||||
|
@ -27,6 +27,7 @@ class Command {
|
|||
};
|
||||
} else if (options.type === "application") {
|
||||
this.interaction = options.interaction;
|
||||
this.args = [];
|
||||
this.channel = options.interaction.channel;
|
||||
this.author = this.member = options.interaction.guildID ? options.interaction.member : options.interaction.user;
|
||||
if (options.interaction.data.options) {
|
||||
|
|
|
@ -68,7 +68,6 @@ class ImageCommand extends Command {
|
|||
magickParams.path = image.path;
|
||||
magickParams.params.type = image.type;
|
||||
magickParams.url = image.url; // technically not required but can be useful for text filtering
|
||||
magickParams.params.delay = image.delay ?? 0;
|
||||
if (this.constructor.requiresGIF) magickParams.onlyGIF = true;
|
||||
} catch (e) {
|
||||
runningCommands.delete(this.author.id);
|
||||
|
@ -77,7 +76,7 @@ class ImageCommand extends Command {
|
|||
}
|
||||
|
||||
if (this.constructor.requiresText) {
|
||||
const text = this.type === "classic" ? this.args : this.options.text;
|
||||
const text = this.options.text ?? this.args;
|
||||
if (text.length === 0 || !await this.criteria(text)) {
|
||||
runningCommands.delete(this.author.id);
|
||||
return this.constructor.noText;
|
||||
|
@ -86,7 +85,7 @@ class ImageCommand extends Command {
|
|||
|
||||
switch (typeof this.params) {
|
||||
case "function":
|
||||
Object.assign(magickParams.params, this.params(magickParams.url, magickParams.delay));
|
||||
Object.assign(magickParams.params, this.params(magickParams.url));
|
||||
break;
|
||||
case "object":
|
||||
Object.assign(magickParams.params, this.params);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue