public void Update(MessageReactionRemoveJsonModel model) { var reactions = Reactions; if (!reactions.HasValue) { return; } var emoji = TransientEmoji.Create(model.Emoji); if (reactions.Value.GetValueOrDefault(emoji) is not TransientMessageReaction reaction) { return; } var newReactions = new Dictionary <IEmoji, IMessageReaction>(reactions.Value); if (reaction.Count == 1) { newReactions.Remove(emoji); } else { var emojiModel = reaction.Model; emojiModel.Count--; if (reaction.HasOwnReaction && model.UserId != Client.CurrentUser.Id) { emojiModel.Me = false; } } Reactions = newReactions; }
public void Update(MessageReactionRemoveJsonModel model) { var reactions = Reactions; if (reactions.HasValue) { var emoji = Emoji.Create(model.Emoji); if (reactions.Value.TryGetValue(emoji, out var reaction)) { var newReactions = new Dictionary <IEmoji, MessageReaction>(reactions.Value); if (reaction.Count == 1) { newReactions.Remove(emoji); } else { newReactions[emoji] = new MessageReaction(emoji, reaction.Count - 1, reaction.HasOwnReaction && model.UserId == Client.CurrentUser.Id ? false : reaction.HasOwnReaction); } Reactions = newReactions; } } }
public void Update(MessageReactionRemoveJsonModel model) { // TODO }