diff --git a/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessage.cs b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessage.cs index d919ab4118..8bc3ff40be 100644 --- a/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessage.cs +++ b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessage.cs @@ -154,6 +154,11 @@ public interface IMessage : IPartialMessage /// new Optional MessageReference { get; } + /// + /// Gets the message associated with . Sent with forwarded messages. + /// + new Optional> MessageSnapshots { get; } + /// /// Gets a set of bitwise flags describing extra features of the message. /// @@ -270,6 +275,9 @@ public interface IMessage : IPartialMessage /// Optional IPartialMessage.MessageReference => this.MessageReference; + /// + Optional> IPartialMessage.MessageSnapshots => this.MessageSnapshots; + /// Optional IPartialMessage.Flags => this.Flags; diff --git a/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessageReference.cs b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessageReference.cs index 45fac77c0c..aa3b7229aa 100644 --- a/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessageReference.cs +++ b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessageReference.cs @@ -31,6 +31,11 @@ namespace Remora.Discord.API.Abstractions.Objects; [PublicAPI] public interface IMessageReference { + /// + /// Gets the type of message reference provided. + /// + Optional Type { get; } + /// /// Gets the ID of the originating message. /// diff --git a/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessageSnapshot.cs b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessageSnapshot.cs new file mode 100644 index 0000000000..d92dd45ba5 --- /dev/null +++ b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IMessageSnapshot.cs @@ -0,0 +1,37 @@ +// +// IMessageSnapshot.cs +// +// Author: +// Jarl Gullberg +// +// Copyright (c) Jarl Gullberg +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// + +using JetBrains.Annotations; + +namespace Remora.Discord.API.Abstractions.Objects; + +/// +/// Represents a message at a specific point in time. +/// +[PublicAPI] +public interface IMessageSnapshot +{ + /// + /// Gets the message that has been referenced. + /// + IPartialMessage Message { get; } +} diff --git a/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IPartialMessage.cs b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IPartialMessage.cs index 958f5e075c..2ff4c8ac2c 100644 --- a/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IPartialMessage.cs +++ b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/IPartialMessage.cs @@ -100,6 +100,9 @@ public interface IPartialMessage /// Optional MessageReference { get; } + /// + Optional> MessageSnapshots { get; } + /// Optional Flags { get; } diff --git a/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/MessageReferenceType.cs b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/MessageReferenceType.cs new file mode 100644 index 0000000000..69f90ee0ce --- /dev/null +++ b/Backend/Remora.Discord.API.Abstractions/API/Objects/Messages/MessageReferenceType.cs @@ -0,0 +1,42 @@ +// +// MessageReferenceType.cs +// +// Author: +// Jarl Gullberg +// +// Copyright (c) Jarl Gullberg +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// + +using JetBrains.Annotations; + +namespace Remora.Discord.API.Abstractions.Objects; + +/// +/// Enumerates the message reference types provided by Discord. +/// +[PublicAPI] +public enum MessageReferenceType +{ + /// + /// A reference used by replies. + /// + Default = 0, + + /// + /// A reference used to point to a message at a point in time. + /// + Forward = 1, +} diff --git a/Backend/Remora.Discord.API/API/Gateway/Events/Messages/MessageCreate.cs b/Backend/Remora.Discord.API/API/Gateway/Events/Messages/MessageCreate.cs index 378f413efc..000339080e 100644 --- a/Backend/Remora.Discord.API/API/Gateway/Events/Messages/MessageCreate.cs +++ b/Backend/Remora.Discord.API/API/Gateway/Events/Messages/MessageCreate.cs @@ -60,6 +60,7 @@ public record MessageCreate Optional MessageReference = default, Optional Flags = default, Optional ReferencedMessage = default, + Optional> MessageSnapshots = default, Optional Interaction = default, Optional Thread = default, Optional> Components = default, diff --git a/Backend/Remora.Discord.API/API/Gateway/Events/Messages/MessageUpdate.cs b/Backend/Remora.Discord.API/API/Gateway/Events/Messages/MessageUpdate.cs index 9f6da096f5..c2cadc2749 100644 --- a/Backend/Remora.Discord.API/API/Gateway/Events/Messages/MessageUpdate.cs +++ b/Backend/Remora.Discord.API/API/Gateway/Events/Messages/MessageUpdate.cs @@ -58,6 +58,7 @@ public record MessageUpdate Optional Application = default, Optional ApplicationID = default, Optional MessageReference = default, + Optional> MessageSnapshots = default, Optional Flags = default, Optional ReferencedMessage = default, Optional Interaction = default, diff --git a/Backend/Remora.Discord.API/API/Objects/Messages/Message.cs b/Backend/Remora.Discord.API/API/Objects/Messages/Message.cs index 0e6a8db1e2..f1a4ec647b 100644 --- a/Backend/Remora.Discord.API/API/Objects/Messages/Message.cs +++ b/Backend/Remora.Discord.API/API/Objects/Messages/Message.cs @@ -59,6 +59,7 @@ public record Message Optional MessageReference = default, Optional Flags = default, Optional ReferencedMessage = default, + Optional> MessageSnapshots = default, Optional Interaction = default, Optional Thread = default, Optional> Components = default, diff --git a/Backend/Remora.Discord.API/API/Objects/Messages/MessageReference.cs b/Backend/Remora.Discord.API/API/Objects/Messages/MessageReference.cs index a0451625cc..1dd0501c7b 100644 --- a/Backend/Remora.Discord.API/API/Objects/Messages/MessageReference.cs +++ b/Backend/Remora.Discord.API/API/Objects/Messages/MessageReference.cs @@ -32,6 +32,7 @@ namespace Remora.Discord.API.Objects; [PublicAPI] public record MessageReference ( + Optional Type = default, Optional MessageID = default, Optional ChannelID = default, Optional GuildID = default, diff --git a/Backend/Remora.Discord.API/API/Objects/Messages/PartialMessage.cs b/Backend/Remora.Discord.API/API/Objects/Messages/PartialMessage.cs index 1767b55a67..f237dd6859 100644 --- a/Backend/Remora.Discord.API/API/Objects/Messages/PartialMessage.cs +++ b/Backend/Remora.Discord.API/API/Objects/Messages/PartialMessage.cs @@ -57,6 +57,7 @@ public record PartialMessage Optional Application = default, Optional ApplicationID = default, Optional MessageReference = default, + Optional> MessageSnapshots = default, Optional Flags = default, Optional ReferencedMessage = default, Optional Interaction = default, diff --git a/Tests/Remora.Discord.Tests/Samples/Gateway/Events/MESSAGE_CREATE/MESSAGE_CREATE.json b/Tests/Remora.Discord.Tests/Samples/Gateway/Events/MESSAGE_CREATE/MESSAGE_CREATE.json index ead02d07ee..57afd6baf3 100644 --- a/Tests/Remora.Discord.Tests/Samples/Gateway/Events/MESSAGE_CREATE/MESSAGE_CREATE.json +++ b/Tests/Remora.Discord.Tests/Samples/Gateway/Events/MESSAGE_CREATE/MESSAGE_CREATE.json @@ -87,6 +87,7 @@ "pinned": true, "type": 1 }, + "message_snapshots": [], "interaction": { "id": "999999999999999999", "type": 1, diff --git a/Tests/Remora.Discord.Tests/Samples/Gateway/Events/MESSAGE_CREATE/MESSAGE_CREATE.nulls.json b/Tests/Remora.Discord.Tests/Samples/Gateway/Events/MESSAGE_CREATE/MESSAGE_CREATE.nulls.json index bfc29fc47c..885b3f26b7 100644 --- a/Tests/Remora.Discord.Tests/Samples/Gateway/Events/MESSAGE_CREATE/MESSAGE_CREATE.nulls.json +++ b/Tests/Remora.Discord.Tests/Samples/Gateway/Events/MESSAGE_CREATE/MESSAGE_CREATE.nulls.json @@ -67,6 +67,7 @@ "message_reference": {}, "flags": 1, "referenced_message": null, + "message_snapshots": null, "interaction": { "id": "999999999999999999", "type": 1, diff --git a/Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE/MESSAGE.json b/Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE/MESSAGE.json index 984bc4b197..95d0a885b4 100644 --- a/Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE/MESSAGE.json +++ b/Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE/MESSAGE.json @@ -91,6 +91,7 @@ "pinned": true, "type": 1 }, + "message_snapshots": [], "interaction": { "id": "999999999999999999", "type": 1, diff --git a/Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE/MESSAGE.nulls.json b/Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE/MESSAGE.nulls.json index 6216198287..d6b9001678 100644 --- a/Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE/MESSAGE.nulls.json +++ b/Tests/Remora.Discord.Tests/Samples/Objects/MESSAGE/MESSAGE.nulls.json @@ -71,6 +71,7 @@ "message_reference": {}, "flags": 1, "referenced_message": null, + "message_snapshots": null, "interaction": { "id": "999999999999999999", "type": 1,