feat(types/interaction): add "resolved" field to DiscordInteractionCommand (#603)

* fix(types): DiscordMember not extending DiscordBaseMember

* add(types): DiscordInteractionDataResolved

* add(types): resolved field to DiscordInteractionData

* fix(types): DiscordInteractionData options is optional

* Apply suggestions from code review

Co-authored-by: ayntee <ayyantee@gmail.com>

Co-authored-by: ayntee <ayyantee@gmail.com>
This commit is contained in:
ITOH
2021-03-07 16:32:15 +01:00
committed by GitHub
parent b511a0d39f
commit bbe3c636f1
2 changed files with 24 additions and 3 deletions

View File

@@ -1,4 +1,9 @@
import { DiscordMember } from "./mod.ts";
import {
DiscordChannel,
DiscordMember,
DiscordRole,
DiscordUser,
} from "./mod.ts";
export interface DiscordInteractionCommand {
/** id of the interaction */
@@ -31,8 +36,24 @@ export interface DiscordInteractionData {
id: string;
/** the name of the invoked command */
name: string;
/** converted users + roles + channels */
resolved?: DiscordApplicationCommandInteractionDataResolved;
/** the params + values from the user */
options: DiscordInteractionDataOption[];
options?: DiscordInteractionDataOption[];
}
export interface DiscordApplicationCommandInteractionDataResolved {
/** the IDs and User objects */
users?: Record<string, DiscordUser>;
/** the IDs and partial Member objects */
members?: Record<string, Omit<DiscordMember, "user" | "deaf" | "mute">>;
/** the IDs and Role objects */
roles?: Record<string, DiscordRole>;
/** the IDs and partial Channel objects */
channels?: Record<
string,
Pick<DiscordChannel, "id" | "name" | "type" | "permission_overwrites">
>;
}
export interface DiscordInteractionDataOption {

View File

@@ -83,7 +83,7 @@ export interface DiscordBaseMember {
}
/** https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure */
export interface DiscordMember {
export interface DiscordMember extends DiscordBaseMember {
/** the user this guild member represents */
user?: DiscordUser;
}