コード例 #1
0
 public Task AttachSocial()
 => Task.Run(() =>
 {
     var handler         = new SocialHandler(this);
     var usersSubscribed =
         Singleton <SpotifySession> .Instance.Mercury()
         .SendSync(new ProtobuffedMercuryRequest <Spotify.Social.UserListReply>(
                       RawMercuryRequest.Get(
                           $"hm://socialgraph/subscriptions/user/{Username}?count=200&last_result="),
                       Spotify.Social.UserListReply.Parser));
     foreach (var user in usersSubscribed.Users)
     {
         var response = Singleton <SpotifySession> .Instance.Mercury()
                        .SendSync(new JsonMercuryRequest <UserPresence>(
                                      RawMercuryRequest.Get($"hm://presence2/user/{user.Username}")));
         UserPresenceUpdated?.Invoke(this, response);
         Singleton <SpotifySession> .Instance.Mercury()
         .Subscribe($"hm://presence2/user/{user.Username}",
                    handler);
     }
 }, closedToken);
コード例 #2
0
 internal void IncomingPresence(UserPresence e) => UserPresenceUpdated?.Invoke(this, e);