Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(command): add CommandOptionsRunTypeEnum #254

Merged
merged 2 commits into from
Aug 25, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
GUILD_TEXT = 'GUILD_TEXT',
GUILD_NEWS = 'GUILD_NEWS',
GUILD_NEWS_THREAD = 'GUILD_NEWS_THREAD',
GUILD_PUBLIC_THREAD = 'GUILD_PUBLIC_THREAD',
GUILD_PRIVATE_THREAD = 'GUILD_PRIVATE_THREAD',
GUILD_ANY = 'GUILD_ANY'
favna marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* 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