Skip to content

Commit

Permalink
fix: only a partial object is needed when updating attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyynthia committed Dec 9, 2021
1 parent 315ce35 commit 32a52e7
Show file tree
Hide file tree
Showing 28 changed files with 1,204 additions and 8 deletions.
183 changes: 183 additions & 0 deletions deno/payloads/v8/_interactions/_applicationCommands/chatInput.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIApplicationCommandInteractionWrapper, APIInteractionDataResolvedChannel, APIInteractionDataResolvedGuildMember, ApplicationCommandType } from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type: ApplicationCommandOptionType.Boolean | ApplicationCommandOptionType.User | ApplicationCommandOptionType.Role | ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
required?: boolean;
autocomplete?: never;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export declare type APIApplicationCommandOption = APIApplicationCommandStringArgumentOptions | APIApplicationCommandSubCommandOptions | APIApplicationCommandOptionBase | APIApplicationCommandChannelOptions | APIApplicationCommandOptionBase | APIApplicationCommandNumberArgumentOptions | APIApplicationCommandStringAutocompleteOptions | APIApplicationCommandNumericAutocompleteOptions;
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a `choices` one
*/
export interface APIApplicationCommandStringArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String;
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`, these types cannot have an `options` array,
* but they can have a `choices`, a `min_value` and `max_value` field
*/
export interface APIApplicationCommandNumberArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
*/
max_value?: number;
autocomplete?: false;
}
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandStringAutocompleteOptions extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String;
autocomplete: true;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandNumericAutocompleteOptions extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
autocomplete: true;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
/**
* 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
*/
export declare enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup = 2,
String = 3,
Integer = 4,
Boolean = 5,
User = 6,
Channel = 7,
Role = 8,
Mentionable = 9,
Number = 10
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export declare type APIApplicationCommandInteractionDataOption = ApplicationCommandInteractionDataOptionSubCommand | ApplicationCommandInteractionDataOptionSubCommandGroup | APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export declare type APIApplicationCommandInteractionDataOptionWithValues = ApplicationCommandInteractionDataOptionString | ApplicationCommandInteractionDataOptionRole | ApplicationCommandInteractionDataOptionChannel | ApplicationCommandInteractionDataOptionUser | ApplicationCommandInteractionDataOptionMentionable | ApplicationCommandInteractionDataOptionInteger | ApplicationCommandInteractionDataOptionNumber | ApplicationCommandInteractionDataOptionBoolean;
export interface ApplicationCommandInteractionDataOptionString extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}
export declare type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<ApplicationCommandOptionType.Role, Snowflake>;
export declare type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<ApplicationCommandOptionType.Channel, Snowflake>;
export declare type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<ApplicationCommandOptionType.User, Snowflake>;
export declare type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<ApplicationCommandOptionType.Mentionable, Snowflake>;
export interface ApplicationCommandInteractionDataOptionInteger extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}
export interface ApplicationCommandInteractionDataOptionNumber extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}
export declare type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<ApplicationCommandOptionType.Boolean, boolean>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIChatInputApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIChatInputApplicationCommandInteraction = APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIChatInputApplicationCommandDMInteraction = APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIChatInputApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;
export {};
//# sourceMappingURL=chatInput.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import type { APIUser } from '../../user.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIMessage } from '../../channel.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIApplicationCommandInteractionWrapper, APIInteractionDataResolvedGuildMember, ApplicationCommandType } from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIUserApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.User> {
target_id: Snowflake;
resolved: APIUserApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIUserApplicationCommandInteractionDataResolved {
users: Record<Snowflake, APIUser>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIMessageApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.Message> {
target_id: Snowflake;
resolved: APIMessageApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIMessageApplicationCommandInteractionDataResolved {
messages: Record<Snowflake, APIMessage>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export declare type APIContextMenuInteractionData = APIUserApplicationCommandInteractionData | APIMessageApplicationCommandInteractionData;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIUserApplicationCommandInteraction = APIApplicationCommandInteractionWrapper<APIUserApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIUserApplicationCommandDMInteraction = APIDMInteractionWrapper<APIUserApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIUserApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIUserApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIMessageApplicationCommandInteraction = APIApplicationCommandInteractionWrapper<APIMessageApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIMessageApplicationCommandDMInteraction = APIDMInteractionWrapper<APIMessageApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIMessageApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIMessageApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIContextMenuDMInteraction = APIUserApplicationCommandDMInteraction | APIMessageApplicationCommandDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export declare type APIContextMenuGuildInteraction = APIUserApplicationCommandGuildInteraction | APIMessageApplicationCommandGuildInteraction;
//# sourceMappingURL=contextMenu.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Snowflake } from '../../../../globals.ts';
import type { ApplicationCommandType } from '../applicationCommands.ts';
export interface APIBaseApplicationCommandInteractionData<Type extends ApplicationCommandType> {
id: Snowflake;
type: Type;
name: string;
}
//# sourceMappingURL=internals.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { Snowflake } from '../../../../globals.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
export interface APIGuildApplicationCommandPermissions {
/**
* The id of the command
*/
id: Snowflake;
/**
* The id of the application the command belongs to
*/
application_id: Snowflake;
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The permissions for the command in the guild
*/
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure
*/
export interface APIApplicationCommandPermission {
/**
* The id of the role or user
*/
id: Snowflake;
/**
* Role or user
*/
type: ApplicationCommandPermissionType;
/**
* `true` to allow, `false`, to disallow
*/
permission: boolean;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type
*/
export declare enum ApplicationCommandPermissionType {
Role = 1,
User = 2
}
//# sourceMappingURL=permissions.d.ts.map
Loading

0 comments on commit 32a52e7

Please sign in to comment.