示例#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_UnsendEvent _parse(Session session, JToken data)
        {
            var thread = FB_UnsendEvent._get_thread(session, data);

            long.TryParse(data?.get("deletionTimestamp")?.Value <string>(), out long at);

            return(new FB_UnsendEvent()
            {
                author = new FB_User(session: session, uid: data?.get("senderID")?.Value <string>()),
                thread = thread,
                message = new FB_Message(session: session, thread_id: thread.uid, uid: data?.get("messageID")?.Value <string>()),
                at = at
            });
        }