feat(APIApplicationCommand): add channel_types field to channel options (#198)

This commit is contained in:
Suneet Tipirneni
2021-10-03 09:18:45 -04:00
committed by GitHub
parent 0331518c49
commit 77396b557c
4 changed files with 52 additions and 8 deletions

View File

@@ -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 {
@@ -13,7 +13,6 @@ interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
@@ -28,6 +27,7 @@ interface APIApplicationCommandOptionBase {
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase;
/**
@@ -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
*/

View File

@@ -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 {
@@ -13,7 +13,6 @@ interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
@@ -28,6 +27,7 @@ interface APIApplicationCommandOptionBase {
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase;
/**
@@ -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
*/

View File

@@ -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 {
@@ -13,7 +13,6 @@ interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
@@ -28,6 +27,7 @@ interface APIApplicationCommandOptionBase {
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase;
/**
@@ -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
*/

View File

@@ -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 {
@@ -13,7 +13,6 @@ interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
@@ -28,6 +27,7 @@ interface APIApplicationCommandOptionBase {
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase;
/**
@@ -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
*/