Skip to content

Commit

Permalink
feat(APIApplicationCommand): add channel_types field to channel opt…
Browse files Browse the repository at this point in the history
…ions (#198)
  • Loading branch information
suneettipirneni committed Oct 3, 2021
1 parent 0331518 commit 77396b5
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 8 deletions.
15 changes: 13 additions & 2 deletions deno/payloads/v8/_interactions/_applicationCommands/chatInput.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { APIRole, APIUser } from '../../mod.ts';
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
Expand All @@ -13,7 +13,6 @@ interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
Expand All @@ -28,6 +27,7 @@ interface APIApplicationCommandOptionBase {
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase;

/**
Expand All @@ -54,6 +54,17 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
choices?: APIApplicationCommandOptionChoice[];
}

/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
Expand Down
15 changes: 13 additions & 2 deletions deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { APIRole, APIUser } from '../../mod.ts';
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
Expand All @@ -13,7 +13,6 @@ interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
Expand All @@ -28,6 +27,7 @@ interface APIApplicationCommandOptionBase {
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase;

/**
Expand All @@ -54,6 +54,17 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
choices?: APIApplicationCommandOptionChoice[];
}

/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
Expand Down
15 changes: 13 additions & 2 deletions payloads/v8/_interactions/_applicationCommands/chatInput.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { APIRole, APIUser } from '../../index';
import type { APIRole, APIUser, ChannelType } from '../../index';
import type { Snowflake } from '../../../../globals';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type {
Expand All @@ -13,7 +13,6 @@ interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
Expand All @@ -28,6 +27,7 @@ interface APIApplicationCommandOptionBase {
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase;

/**
Expand All @@ -54,6 +54,17 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
choices?: APIApplicationCommandOptionChoice[];
}

/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
Expand Down
15 changes: 13 additions & 2 deletions payloads/v9/_interactions/_applicationCommands/chatInput.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { APIRole, APIUser } from '../../index';
import type { APIRole, APIUser, ChannelType } from '../../index';
import type { Snowflake } from '../../../../globals';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type {
Expand All @@ -13,7 +13,6 @@ interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
Expand All @@ -28,6 +27,7 @@ interface APIApplicationCommandOptionBase {
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase;

/**
Expand All @@ -54,6 +54,17 @@ export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicatio
choices?: APIApplicationCommandOptionChoice[];
}

/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
Expand Down

0 comments on commit 77396b5

Please sign in to comment.