Skip to content

Commit 6c9e624

Browse files
Sebastianapricotbucket28
authored andcommitted
Add message forwarding (disgoorg#350)
* Add message forwarding * support multiple snapshots discord/discord-api-docs@14e1fa7 * fix snapshot structure * remove Guild from MessageSnapshot * add fields to PartialMessage
1 parent 109275f commit 6c9e624

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

discord/message.go

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ type Message struct {
102102
Type MessageType `json:"type"`
103103
Flags MessageFlags `json:"flags"`
104104
MessageReference *MessageReference `json:"message_reference,omitempty"`
105+
MessageSnapshots []MessageSnapshot `json:"message_snapshots,omitempty"`
105106
Interaction *MessageInteraction `json:"interaction,omitempty"`
106107
WebhookID *snowflake.ID `json:"webhook_id,omitempty"`
107108
Activity *MessageActivity `json:"activity,omitempty"`
@@ -407,10 +408,34 @@ type MessageApplication struct {
407408

408409
// MessageReference is a reference to another message
409410
type MessageReference struct {
410-
MessageID *snowflake.ID `json:"message_id"`
411-
ChannelID *snowflake.ID `json:"channel_id,omitempty"`
412-
GuildID *snowflake.ID `json:"guild_id,omitempty"`
413-
FailIfNotExists bool `json:"fail_if_not_exists,omitempty"`
411+
Type MessageReferenceType `json:"type,omitempty"`
412+
MessageID *snowflake.ID `json:"message_id"`
413+
ChannelID *snowflake.ID `json:"channel_id,omitempty"`
414+
GuildID *snowflake.ID `json:"guild_id,omitempty"`
415+
FailIfNotExists bool `json:"fail_if_not_exists,omitempty"`
416+
}
417+
418+
type MessageReferenceType int
419+
420+
const (
421+
MessageReferenceTypeDefault MessageReferenceType = iota
422+
MessageReferenceTypeForward
423+
)
424+
425+
type MessageSnapshot struct {
426+
Message PartialMessage `json:"message"`
427+
}
428+
429+
type PartialMessage struct {
430+
Type MessageType `json:"type"`
431+
Content string `json:"content,omitempty"`
432+
Embeds []Embed `json:"embeds,omitempty"`
433+
Attachments []Attachment `json:"attachments"`
434+
CreatedAt time.Time `json:"timestamp"`
435+
EditedTimestamp *time.Time `json:"edited_timestamp"`
436+
Flags MessageFlags `json:"flags"`
437+
Mentions []User `json:"mentions"`
438+
MentionRoles []snowflake.ID `json:"mention_roles"`
414439
}
415440

416441
// MessageInteraction is sent on the Message object when the message is a response to an interaction

0 commit comments

Comments
 (0)