Skip to content

Commit 2c1ff0e

Browse files
feat: add support for message forwarding (#971)
1 parent 5f22a6b commit 2c1ff0e

File tree

4 files changed

+196
-0
lines changed

4 files changed

+196
-0
lines changed

deno/payloads/v10/channel.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,10 @@ export interface APIMessage {
735735
* See https://support-dev.discord.com/hc/articles/4404772028055
736736
*/
737737
poll?: APIPoll;
738+
/**
739+
* The message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.)
740+
*/
741+
message_snapshots?: APIMessageSnapshot[];
738742
/**
739743
* The call associated with the message
740744
*/
@@ -810,6 +814,10 @@ export interface APIMessageActivity {
810814
* https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure
811815
*/
812816
export interface APIMessageReference {
817+
/**
818+
* Type of reference
819+
*/
820+
type?: MessageReferenceType;
813821
/**
814822
* ID of the originating message
815823
*/
@@ -834,6 +842,20 @@ export enum MessageActivityType {
834842
JoinRequest = 5,
835843
}
836844

845+
/**
846+
* https://discord.com/developers/docs/resources/channel#message-reference-types
847+
*/
848+
export enum MessageReferenceType {
849+
/**
850+
* A standard reference used by replies
851+
*/
852+
Default = 0,
853+
/**
854+
* Reference used to point to a message at a point in time
855+
*/
856+
Forward = 1,
857+
}
858+
837859
/**
838860
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
839861
*/
@@ -1884,6 +1906,20 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
18841906
required?: boolean;
18851907
}
18861908

1909+
/**
1910+
* https://discord.com/developers/docs/resources/channel#message-snapshot-object
1911+
*/
1912+
export interface APIMessageSnapshot {
1913+
/**
1914+
* Subset of the message object fields
1915+
*/
1916+
message: APIMessageSnapshotFields;
1917+
/**
1918+
* Id of the origin message's guild
1919+
*/
1920+
guild_id?: Snowflake;
1921+
}
1922+
18871923
/**
18881924
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
18891925
*/
@@ -1942,3 +1978,16 @@ export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuCom
19421978

19431979
// Modal components
19441980
export type APIModalActionRowComponent = APITextInputComponent;
1981+
1982+
export type APIMessageSnapshotFields = Pick<
1983+
APIMessage,
1984+
| 'attachments'
1985+
| 'content'
1986+
| 'edited_timestamp'
1987+
| 'embeds'
1988+
| 'flags'
1989+
| 'mention_roles'
1990+
| 'mentions'
1991+
| 'timestamp'
1992+
| 'type'
1993+
>;

deno/payloads/v9/channel.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,10 @@ export interface APIMessage {
720720
* See https://support-dev.discord.com/hc/articles/4404772028055
721721
*/
722722
poll?: APIPoll;
723+
/**
724+
* The message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.)
725+
*/
726+
message_snapshots?: APIMessageSnapshot[];
723727
/**
724728
* The call associated with the message
725729
*/
@@ -795,6 +799,10 @@ export interface APIMessageActivity {
795799
* https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure
796800
*/
797801
export interface APIMessageReference {
802+
/**
803+
* Type of reference
804+
*/
805+
type?: MessageReferenceType;
798806
/**
799807
* ID of the originating message
800808
*/
@@ -819,6 +827,20 @@ export enum MessageActivityType {
819827
JoinRequest = 5,
820828
}
821829

830+
/**
831+
* https://discord.com/developers/docs/resources/channel#message-reference-types
832+
*/
833+
export enum MessageReferenceType {
834+
/**
835+
* A standard reference used by replies
836+
*/
837+
Default = 0,
838+
/**
839+
* Reference used to point to a message at a point in time
840+
*/
841+
Forward = 1,
842+
}
843+
822844
/**
823845
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
824846
*/
@@ -1851,6 +1873,20 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
18511873
required?: boolean;
18521874
}
18531875

1876+
/**
1877+
* https://discord.com/developers/docs/resources/channel#message-snapshot-object
1878+
*/
1879+
export interface APIMessageSnapshot {
1880+
/**
1881+
* Subset of the message object fields
1882+
*/
1883+
message: APIMessageSnapshotFields;
1884+
/**
1885+
* Id of the origin message's guild
1886+
*/
1887+
guild_id?: Snowflake;
1888+
}
1889+
18541890
/**
18551891
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
18561892
*/
@@ -1909,3 +1945,16 @@ export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuCom
19091945

19101946
// Modal components
19111947
export type APIModalActionRowComponent = APITextInputComponent;
1948+
1949+
export type APIMessageSnapshotFields = Pick<
1950+
APIMessage,
1951+
| 'attachments'
1952+
| 'content'
1953+
| 'edited_timestamp'
1954+
| 'embeds'
1955+
| 'flags'
1956+
| 'mention_roles'
1957+
| 'mentions'
1958+
| 'timestamp'
1959+
| 'type'
1960+
>;

payloads/v10/channel.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,10 @@ export interface APIMessage {
735735
* See https://support-dev.discord.com/hc/articles/4404772028055
736736
*/
737737
poll?: APIPoll;
738+
/**
739+
* The message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.)
740+
*/
741+
message_snapshots?: APIMessageSnapshot[];
738742
/**
739743
* The call associated with the message
740744
*/
@@ -810,6 +814,10 @@ export interface APIMessageActivity {
810814
* https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure
811815
*/
812816
export interface APIMessageReference {
817+
/**
818+
* Type of reference
819+
*/
820+
type?: MessageReferenceType;
813821
/**
814822
* ID of the originating message
815823
*/
@@ -834,6 +842,20 @@ export enum MessageActivityType {
834842
JoinRequest = 5,
835843
}
836844

845+
/**
846+
* https://discord.com/developers/docs/resources/channel#message-reference-types
847+
*/
848+
export enum MessageReferenceType {
849+
/**
850+
* A standard reference used by replies
851+
*/
852+
Default = 0,
853+
/**
854+
* Reference used to point to a message at a point in time
855+
*/
856+
Forward = 1,
857+
}
858+
837859
/**
838860
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
839861
*/
@@ -1884,6 +1906,20 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
18841906
required?: boolean;
18851907
}
18861908

1909+
/**
1910+
* https://discord.com/developers/docs/resources/channel#message-snapshot-object
1911+
*/
1912+
export interface APIMessageSnapshot {
1913+
/**
1914+
* Subset of the message object fields
1915+
*/
1916+
message: APIMessageSnapshotFields;
1917+
/**
1918+
* Id of the origin message's guild
1919+
*/
1920+
guild_id?: Snowflake;
1921+
}
1922+
18871923
/**
18881924
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
18891925
*/
@@ -1942,3 +1978,16 @@ export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuCom
19421978

19431979
// Modal components
19441980
export type APIModalActionRowComponent = APITextInputComponent;
1981+
1982+
export type APIMessageSnapshotFields = Pick<
1983+
APIMessage,
1984+
| 'attachments'
1985+
| 'content'
1986+
| 'edited_timestamp'
1987+
| 'embeds'
1988+
| 'flags'
1989+
| 'mention_roles'
1990+
| 'mentions'
1991+
| 'timestamp'
1992+
| 'type'
1993+
>;

payloads/v9/channel.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,10 @@ export interface APIMessage {
720720
* See https://support-dev.discord.com/hc/articles/4404772028055
721721
*/
722722
poll?: APIPoll;
723+
/**
724+
* The message associated with the message_reference. This is a minimal subset of fields in a message (e.g. author is excluded.)
725+
*/
726+
message_snapshots?: APIMessageSnapshot[];
723727
/**
724728
* The call associated with the message
725729
*/
@@ -795,6 +799,10 @@ export interface APIMessageActivity {
795799
* https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure
796800
*/
797801
export interface APIMessageReference {
802+
/**
803+
* Type of reference
804+
*/
805+
type?: MessageReferenceType;
798806
/**
799807
* ID of the originating message
800808
*/
@@ -819,6 +827,20 @@ export enum MessageActivityType {
819827
JoinRequest = 5,
820828
}
821829

830+
/**
831+
* https://discord.com/developers/docs/resources/channel#message-reference-types
832+
*/
833+
export enum MessageReferenceType {
834+
/**
835+
* A standard reference used by replies
836+
*/
837+
Default = 0,
838+
/**
839+
* Reference used to point to a message at a point in time
840+
*/
841+
Forward = 1,
842+
}
843+
822844
/**
823845
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
824846
*/
@@ -1851,6 +1873,20 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
18511873
required?: boolean;
18521874
}
18531875

1876+
/**
1877+
* https://discord.com/developers/docs/resources/channel#message-snapshot-object
1878+
*/
1879+
export interface APIMessageSnapshot {
1880+
/**
1881+
* Subset of the message object fields
1882+
*/
1883+
message: APIMessageSnapshotFields;
1884+
/**
1885+
* Id of the origin message's guild
1886+
*/
1887+
guild_id?: Snowflake;
1888+
}
1889+
18541890
/**
18551891
* https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
18561892
*/
@@ -1909,3 +1945,16 @@ export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuCom
19091945

19101946
// Modal components
19111947
export type APIModalActionRowComponent = APITextInputComponent;
1948+
1949+
export type APIMessageSnapshotFields = Pick<
1950+
APIMessage,
1951+
| 'attachments'
1952+
| 'content'
1953+
| 'edited_timestamp'
1954+
| 'embeds'
1955+
| 'flags'
1956+
| 'mention_roles'
1957+
| 'mentions'
1958+
| 'timestamp'
1959+
| 'type'
1960+
>;

0 commit comments

Comments
 (0)