Skip to content

Commit

Permalink
feat(APIBaseInteraction): add channel (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx authored Apr 6, 2023
1 parent 4aa9646 commit 311b7a2
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 20 deletions.
5 changes: 4 additions & 1 deletion deno/payloads/v10/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export type APIApplicationCommandInteractionData =
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<
Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data' | 'app_permissions'>
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, Data>,
'channel' | 'channel_id' | 'data' | 'app_permissions'
>
>;

/**
Expand Down
8 changes: 7 additions & 1 deletion deno/payloads/v10/_interactions/base.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { InteractionType } from './responses.ts';
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIRole, LocaleString } from '../../../v10.ts';
import type { APIAttachment, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel.ts';
import type { APIAttachment, APIChannel, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';

Expand Down Expand Up @@ -81,6 +81,12 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* The channel it was sent from
*/
channel?: Partial<APIChannel> & Pick<APIChannel, 'id' | 'type'>;
/**
* The id of the channel it was sent from
*
* @deprecated Use {@apilink APIBaseInteraction#channel} instead
*/
channel_id?: Snowflake;
/**
* Guild member data for the invoking user, including permissions
Expand Down
6 changes: 3 additions & 3 deletions deno/payloads/v10/_interactions/messageComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type APIMessageComponentInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageComponentInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand All @@ -26,7 +26,7 @@ export type APIMessageComponentButtonInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageButtonInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand All @@ -37,7 +37,7 @@ export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageSelectMenuInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand Down
5 changes: 4 additions & 1 deletion deno/payloads/v9/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export type APIApplicationCommandInteractionData =
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<
Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data' | 'app_permissions'>
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, Data>,
'channel' | 'channel_id' | 'data' | 'app_permissions'
>
>;

/**
Expand Down
8 changes: 7 additions & 1 deletion deno/payloads/v9/_interactions/base.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { InteractionType } from './responses.ts';
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIRole, LocaleString } from '../../../v9.ts';
import type { APIAttachment, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel.ts';
import type { APIAttachment, APIChannel, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';

Expand Down Expand Up @@ -81,6 +81,12 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* The channel it was sent from
*/
channel?: Partial<APIChannel> & Pick<APIChannel, 'id' | 'type'>;
/**
* The id of the channel it was sent from
*
* @deprecated Use {@apilink APIBaseInteraction#channel} instead
*/
channel_id?: Snowflake;
/**
* Guild member data for the invoking user, including permissions
Expand Down
6 changes: 3 additions & 3 deletions deno/payloads/v9/_interactions/messageComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type APIMessageComponentInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageComponentInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand All @@ -26,7 +26,7 @@ export type APIMessageComponentButtonInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageButtonInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand All @@ -37,7 +37,7 @@ export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageSelectMenuInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand Down
5 changes: 4 additions & 1 deletion payloads/v10/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export type APIApplicationCommandInteractionData =
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<
Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data' | 'app_permissions'>
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, Data>,
'channel' | 'channel_id' | 'data' | 'app_permissions'
>
>;

/**
Expand Down
8 changes: 7 additions & 1 deletion payloads/v10/_interactions/base.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { InteractionType } from './responses';
import type { Permissions, Snowflake } from '../../../globals';
import type { APIRole, LocaleString } from '../../../v10';
import type { APIAttachment, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel';
import type { APIAttachment, APIChannel, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIUser } from '../user';

Expand Down Expand Up @@ -81,6 +81,12 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* The channel it was sent from
*/
channel?: Partial<APIChannel> & Pick<APIChannel, 'id' | 'type'>;
/**
* The id of the channel it was sent from
*
* @deprecated Use {@apilink APIBaseInteraction#channel} instead
*/
channel_id?: Snowflake;
/**
* Guild member data for the invoking user, including permissions
Expand Down
6 changes: 3 additions & 3 deletions payloads/v10/_interactions/messageComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type APIMessageComponentInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageComponentInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand All @@ -26,7 +26,7 @@ export type APIMessageComponentButtonInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageButtonInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand All @@ -37,7 +37,7 @@ export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageSelectMenuInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand Down
5 changes: 4 additions & 1 deletion payloads/v9/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export type APIApplicationCommandInteractionData =
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<
Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data' | 'app_permissions'>
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, Data>,
'channel' | 'channel_id' | 'data' | 'app_permissions'
>
>;

/**
Expand Down
8 changes: 7 additions & 1 deletion payloads/v9/_interactions/base.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { InteractionType } from './responses';
import type { Permissions, Snowflake } from '../../../globals';
import type { APIRole, LocaleString } from '../../../v9';
import type { APIAttachment, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel';
import type { APIAttachment, APIChannel, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIUser } from '../user';

Expand Down Expand Up @@ -81,6 +81,12 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* The channel it was sent from
*/
channel?: Partial<APIChannel> & Pick<APIChannel, 'id' | 'type'>;
/**
* The id of the channel it was sent from
*
* @deprecated Use {@apilink APIBaseInteraction#channel} instead
*/
channel_id?: Snowflake;
/**
* Guild member data for the invoking user, including permissions
Expand Down
6 changes: 3 additions & 3 deletions payloads/v9/_interactions/messageComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type APIMessageComponentInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageComponentInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand All @@ -26,7 +26,7 @@ export type APIMessageComponentButtonInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageButtonInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand All @@ -37,7 +37,7 @@ export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction<
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageSelectMenuInteractionData>,
'channel_id' | 'data' | 'app_permissions' | 'message'
'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'
>
>;

Expand Down

1 comment on commit 311b7a2

@vercel
Copy link

@vercel vercel bot commented on 311b7a2 Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.