Exemple #1
0
            private static bool FindReaction(Message.ID id, out Reaction.Data result, bool pop)
            {
                Incoming.Message cache = s_Messages.Find(m => id == m.GetID(), pop: pop);

                if (null == cache)
                {
                    result = default;
                    return(false);
                }

                Incoming.Reaction reaction = cache.GetContent()?.GetReaction();

                result = new Reaction.Data
                {
                    Channel  = Channel.Deserialized(cache.GetChannel()),
                    Author   = new User(cache.GetSender()?.GetName() ?? ""),
                    Target   = cache.GetReactionTargetID(),
                    Contents = reaction?.GetBody() ?? ""
                };

                return(true);
            }
Exemple #2
0
 /// <summary>
 /// Remove the reaction from the log, returning whether it was found, passing its data via out if so
 /// </summary>
 public static bool TryRemoveFromLog(Message.ID id, out Reaction.Data result) => FindReaction(id, out result, pop: true);