Skip to content

Commit

Permalink
feat(command): add CommandOptionsRunTypeEnum (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
favna authored Aug 25, 2021
1 parent 1ea447f commit 2d21b03
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/lib/structures/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ export abstract class Command<T = Args> extends AliasPiece {

/**
* The allowed values for {@link CommandOptions.runIn}.
* @remark It is discouraged to use this type, we recommend using {@link CommandOptionsRunTypeEnum} instead.
* @since 2.0.0
*/
export type CommandOptionsRunType =
Expand All @@ -333,6 +334,20 @@ export type CommandOptionsRunType =
| 'GUILD_PRIVATE_THREAD'
| 'GUILD_ANY';

/**
* The allowed values for {@link CommandOptions.runIn} as an enum.
* @since 2.0.0
*/
export const enum CommandOptionsRunTypeEnum {
Dm = 'DM',
GuildText = 'GUILD_TEXT',
GuildNews = 'GUILD_NEWS',
GuildNewsThread = 'GUILD_NEWS_THREAD',
GuildPublicThread = 'GUILD_PUBLIC_THREAD',
GuildPrivateThread = 'GUILD_PRIVATE_THREAD',
GuildAny = 'GUILD_ANY'
}

/**
* The available command pre-conditions.
* @since 2.0.0
Expand Down Expand Up @@ -468,7 +483,7 @@ export interface CommandOptions extends AliasPieceOptions, FlagStrategyOptions {
* @since 2.0.0
* @default null
*/
runIn?: CommandOptionsRunType | readonly CommandOptionsRunType[] | null;
runIn?: CommandOptionsRunType | CommandOptionsRunTypeEnum | readonly (CommandOptionsRunType | CommandOptionsRunTypeEnum)[] | null;
}

export interface CommandContext extends Record<PropertyKey, unknown> {
Expand Down

0 comments on commit 2d21b03

Please sign in to comment.