示例#1
0
 private static FB_Event parse_client_delta(Session session, JToken data)
 {
     if (data?.get("deltaMessageReaction") != null)
     {
         return(FB_ReactionEvent._parse(session, data["deltaMessageReaction"]));
     }
     else if (data?.get("deltaChangeViewerStatus") != null)
     {
         // TODO: Parse all `reason`
         if (data?.get("deltaChangeViewerStatus")?.get("reason")?.Value <int>() == 2)
         {
             return(FB_UserStatusEvent._parse(session, data["deltaChangeViewerStatus"]));
         }
     }
     else if (data?.get("liveLocationData") != null)
     {
         return(FB_LiveLocationEvent._parse(session, data["liveLocationData"]));
     }
     else if (data?.get("deltaRecallMessageData") != null)
     {
         return(FB_UnsendEvent._parse(session, data["deltaRecallMessageData"]));
     }
     else if (data?.get("deltaMessageReply") != null)
     {
         return(FB_MessageReplyEvent._parse(session, data["deltaMessageReply"]));
     }
     return(new FB_UnknownEvent()
     {
         source = "client payload", data = data
     });
 }
示例#2
0
        internal static FB_ReactionEvent _parse(Session session, JToken data)
        {
            var thread = FB_ReactionEvent._get_thread(session, data);

            return(new FB_ReactionEvent()
            {
                author = new FB_User(session: session, uid: data?.get("userId")?.Value <string>()),
                thread = thread,
                message = new FB_Message(session: session, thread_id: thread.uid, uid: data?.get("messageId")?.Value <string>()),
                reaction = data?.get("action")?.Value <int>() == 0 ? data?.get("reaction")?.Value <string>() : null
            });
        }