Skip to content

Commit

Permalink
feat: add support for message forwarding (#971)
Browse files Browse the repository at this point in the history
  • Loading branch information
suneettipirneni committed Jul 20, 2024
1 parent 5f22a6b commit 2c1ff0e
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 0 deletions.
49 changes: 49 additions & 0 deletions deno/payloads/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,10 @@ export interface APIMessage {
* See https://support-dev.discord.com/hc/articles/4404772028055
*/
poll?: APIPoll;
/**
* The message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.)
*/
message_snapshots?: APIMessageSnapshot[];
/**
* The call associated with the message
*/
Expand Down Expand Up @@ -810,6 +814,10 @@ export interface APIMessageActivity {
* https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure
*/
export interface APIMessageReference {
/**
* Type of reference
*/
type?: MessageReferenceType;
/**
* ID of the originating message
*/
Expand All @@ -834,6 +842,20 @@ export enum MessageActivityType {
JoinRequest = 5,
}

/**
* https://discord.com/developers/docs/resources/channel#message-reference-types
*/
export enum MessageReferenceType {
/**
* A standard reference used by replies
*/
Default = 0,
/**
* Reference used to point to a message at a point in time
*/
Forward = 1,
}

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
*/
Expand Down Expand Up @@ -1884,6 +1906,20 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
required?: boolean;
}

/**
* https://discord.com/developers/docs/resources/channel#message-snapshot-object
*/
export interface APIMessageSnapshot {
/**
* Subset of the message object fields
*/
message: APIMessageSnapshotFields;
/**
* Id of the origin message's guild
*/
guild_id?: Snowflake;
}

/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
*/
Expand Down Expand Up @@ -1942,3 +1978,16 @@ export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuCom

// Modal components
export type APIModalActionRowComponent = APITextInputComponent;

export type APIMessageSnapshotFields = Pick<
APIMessage,
| 'attachments'
| 'content'
| 'edited_timestamp'
| 'embeds'
| 'flags'
| 'mention_roles'
| 'mentions'
| 'timestamp'
| 'type'
>;
49 changes: 49 additions & 0 deletions deno/payloads/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ export interface APIMessage {
* See https://support-dev.discord.com/hc/articles/4404772028055
*/
poll?: APIPoll;
/**
* The message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.)
*/
message_snapshots?: APIMessageSnapshot[];
/**
* The call associated with the message
*/
Expand Down Expand Up @@ -795,6 +799,10 @@ export interface APIMessageActivity {
* https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure
*/
export interface APIMessageReference {
/**
* Type of reference
*/
type?: MessageReferenceType;
/**
* ID of the originating message
*/
Expand All @@ -819,6 +827,20 @@ export enum MessageActivityType {
JoinRequest = 5,
}

/**
* https://discord.com/developers/docs/resources/channel#message-reference-types
*/
export enum MessageReferenceType {
/**
* A standard reference used by replies
*/
Default = 0,
/**
* Reference used to point to a message at a point in time
*/
Forward = 1,
}

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
*/
Expand Down Expand Up @@ -1851,6 +1873,20 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
required?: boolean;
}

/**
* https://discord.com/developers/docs/resources/channel#message-snapshot-object
*/
export interface APIMessageSnapshot {
/**
* Subset of the message object fields
*/
message: APIMessageSnapshotFields;
/**
* Id of the origin message's guild
*/
guild_id?: Snowflake;
}

/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
*/
Expand Down Expand Up @@ -1909,3 +1945,16 @@ export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuCom

// Modal components
export type APIModalActionRowComponent = APITextInputComponent;

export type APIMessageSnapshotFields = Pick<
APIMessage,
| 'attachments'
| 'content'
| 'edited_timestamp'
| 'embeds'
| 'flags'
| 'mention_roles'
| 'mentions'
| 'timestamp'
| 'type'
>;
49 changes: 49 additions & 0 deletions payloads/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,10 @@ export interface APIMessage {
* See https://support-dev.discord.com/hc/articles/4404772028055
*/
poll?: APIPoll;
/**
* The message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.)
*/
message_snapshots?: APIMessageSnapshot[];
/**
* The call associated with the message
*/
Expand Down Expand Up @@ -810,6 +814,10 @@ export interface APIMessageActivity {
* https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure
*/
export interface APIMessageReference {
/**
* Type of reference
*/
type?: MessageReferenceType;
/**
* ID of the originating message
*/
Expand All @@ -834,6 +842,20 @@ export enum MessageActivityType {
JoinRequest = 5,
}

/**
* https://discord.com/developers/docs/resources/channel#message-reference-types
*/
export enum MessageReferenceType {
/**
* A standard reference used by replies
*/
Default = 0,
/**
* Reference used to point to a message at a point in time
*/
Forward = 1,
}

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
*/
Expand Down Expand Up @@ -1884,6 +1906,20 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
required?: boolean;
}

/**
* https://discord.com/developers/docs/resources/channel#message-snapshot-object
*/
export interface APIMessageSnapshot {
/**
* Subset of the message object fields
*/
message: APIMessageSnapshotFields;
/**
* Id of the origin message's guild
*/
guild_id?: Snowflake;
}

/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
*/
Expand Down Expand Up @@ -1942,3 +1978,16 @@ export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuCom

// Modal components
export type APIModalActionRowComponent = APITextInputComponent;

export type APIMessageSnapshotFields = Pick<
APIMessage,
| 'attachments'
| 'content'
| 'edited_timestamp'
| 'embeds'
| 'flags'
| 'mention_roles'
| 'mentions'
| 'timestamp'
| 'type'
>;
49 changes: 49 additions & 0 deletions payloads/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ export interface APIMessage {
* See https://support-dev.discord.com/hc/articles/4404772028055
*/
poll?: APIPoll;
/**
* The message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.)
*/
message_snapshots?: APIMessageSnapshot[];
/**
* The call associated with the message
*/
Expand Down Expand Up @@ -795,6 +799,10 @@ export interface APIMessageActivity {
* https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure
*/
export interface APIMessageReference {
/**
* Type of reference
*/
type?: MessageReferenceType;
/**
* ID of the originating message
*/
Expand All @@ -819,6 +827,20 @@ export enum MessageActivityType {
JoinRequest = 5,
}

/**
* https://discord.com/developers/docs/resources/channel#message-reference-types
*/
export enum MessageReferenceType {
/**
* A standard reference used by replies
*/
Default = 0,
/**
* Reference used to point to a message at a point in time
*/
Forward = 1,
}

/**
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
*/
Expand Down Expand Up @@ -1851,6 +1873,20 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
required?: boolean;
}

/**
* https://discord.com/developers/docs/resources/channel#message-snapshot-object
*/
export interface APIMessageSnapshot {
/**
* Subset of the message object fields
*/
message: APIMessageSnapshotFields;
/**
* Id of the origin message's guild
*/
guild_id?: Snowflake;
}

/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
*/
Expand Down Expand Up @@ -1909,3 +1945,16 @@ export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuCom

// Modal components
export type APIModalActionRowComponent = APITextInputComponent;

export type APIMessageSnapshotFields = Pick<
APIMessage,
| 'attachments'
| 'content'
| 'edited_timestamp'
| 'embeds'
| 'flags'
| 'mention_roles'
| 'mentions'
| 'timestamp'
| 'type'
>;

0 comments on commit 2c1ff0e

Please sign in to comment.