Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

using System.Collections.Generic;
using System.Drawing;
using JetBrains.Annotations;
using Remora.Discord.API.Abstractions.Objects;
using Remora.Rest.Core;
Expand Down Expand Up @@ -66,4 +68,19 @@ public interface IMessageReactionAdd : IGatewayEvent
/// Gets the ID of the user who authored the message.
/// </summary>
Optional<Snowflake> MessageAuthorID { get; }

/// <summary>
/// Gets a value indicating whether this is a super-reaction.
/// </summary>
bool Burst { get; }

/// <summary>
/// Gets the colors used for super-reaction animation.
/// </summary>
Optional<IReadOnlyList<Color>> BurstColours { get; }

/// <summary>
/// Gets the type of reaction.
/// </summary>
ReactionType Type { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,14 @@ public interface IMessageReactionRemove : IGatewayEvent
/// Gets the emoji.
/// </summary>
IPartialEmoji Emoji { get; }

/// <summary>
/// Gets a value indicating whether this is a super-reaction.
/// </summary>
bool Burst { get; }

/// <summary>
/// Gets the type of reaction.
/// </summary>
ReactionType Type { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// ReactionType.cs
//
// Author:
// Jarl Gullberg <jarl.gullberg@gmail.com>
//
// 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 <http://www.gnu.org/licenses/>.
//

using JetBrains.Annotations;

namespace Remora.Discord.API.Abstractions.Objects;

/// <summary>
/// Enumerates the possible types of reactions.
/// </summary>
[PublicAPI]
public enum ReactionType
{
/// <summary>
/// A regular reaction.
/// </summary>
Normal = 0,

/// <summary>
/// A super-reaction.
/// </summary>
Burst = 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

using System.Collections.Generic;
using System.Drawing;
using JetBrains.Annotations;
using Remora.Discord.API.Abstractions.Gateway.Events;
using Remora.Discord.API.Abstractions.Objects;
Expand All @@ -39,5 +41,8 @@ public record MessageReactionAdd
Optional<Snowflake> GuildID,
Optional<IGuildMember> Member,
IPartialEmoji Emoji,
Optional<Snowflake> MessageAuthorID
Optional<Snowflake> MessageAuthorID,
bool Burst,
Optional<IReadOnlyList<Color>> BurstColours,
ReactionType Type
) : IMessageReactionAdd;
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ public record MessageReactionRemove
Snowflake ChannelID,
Snowflake MessageID,
Optional<Snowflake> GuildID,
IPartialEmoji Emoji
IPartialEmoji Emoji,
bool Burst,
ReactionType Type
) : IMessageReactionRemove;
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ private static JsonSerializerOptions AddGatewayEventConverters(this JsonSerializ
options.AddDataObjectConverter<IMessageDeleteBulk, MessageDeleteBulk>()
.WithPropertyName(d => d.IDs, "ids");

options.AddDataObjectConverter<IMessageReactionAdd, MessageReactionAdd>();
options.AddDataObjectConverter<IMessageReactionAdd, MessageReactionAdd>()
.WithPropertyName(r => r.BurstColours, "burst_colors")
.WithPropertyConverter(r => r.BurstColours, new HexCodeColourConverter());
options.AddDataObjectConverter<IMessageReactionRemove, MessageReactionRemove>();
options.AddDataObjectConverter<IMessageReactionRemoveAll, MessageReactionRemoveAll>();
options.AddDataObjectConverter<IMessageReactionRemoveEmoji, MessageReactionRemoveEmoji>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"flags": 1
},
"emoji": { },
"message_author_id": "999999999999999999"
"message_author_id": "999999999999999999",
"burst": true,
"burst_colors": [
"#ffffff"
],
"type": 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"user_id": "999999999999999999",
"channel_id": "999999999999999999",
"message_id": "999999999999999999",
"emoji": { }
"emoji": { },
"burst": false,
"type": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"channel_id": "999999999999999999",
"message_id": "999999999999999999",
"guild_id": "999999999999999999",
"emoji": { }
"emoji": { },
"burst": false,
"type": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"user_id": "999999999999999999",
"channel_id": "999999999999999999",
"message_id": "999999999999999999",
"emoji": { }
"emoji": { },
"burst": false,
"type": 0
}
}
Loading