예제 #1
0
        public async Task Ping(PingNotificationBody body)
        {
            await _client.OnPingAsync(body);

            var parties = await _client.Client.PartyService.GetPingsAsync(body.PingerId);

            var party = parties.Data.FirstOrDefault();

            if (party == null)
            {
                throw new FortniteException($"Couldn't find invite from {body.PingerId}");
            }

            var invite = party.Invites.FirstOrDefault(x => x.SentBy.Equals(body.PingerId) && x.Status.Equals("SENT")) ?? new PartyInvitation
            {
                PartyId   = party.Id,
                SentBy    = body.PingerId,
                Meta      = party.Meta,
                SentTo    = _client.Client.CurrentLogin.AccountId,
                SentAt    = body.Sent,
                UpdatedAt = body.Sent,
                ExpiresAt = body.Expires,
                Status    = "SENT"
            };

            invite.Client = _client;

            await _client.OnPartyInvitationAsync(invite);
        }
예제 #2
0
 /// <summary>
 /// Fired when a ping was received
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 public async Task OnPingAsync(PingNotificationBody e)
 {
     if (Ping != null)
     {
         await Ping.Invoke(e);
     }
 }