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

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

                result = new Message.Data
                {
                    Channel  = Channel.Deserialized(cache.GetChannel()),
                    Author   = new User(cache.GetSender()?.GetName() ?? ""),
                    Contents = cache.GetContent()?.GetText()?.GetBody() ?? ""
                };

                return(true);
            }
示例#2
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);
            }