Search code examples
javasteamsteam-web-apisteam-condenser

Steam community Friend list and messageing them


i am trying to do small Application to work with my Team in steam and i have use the jave Implementation suggest in steam ,"Steam Condenser" .

So I have try getting Player information like ,

    SteamId id = SteamId.create("XXXXXXXXXX");

    String avatar_url = id.getAvatarMediumUrl();
    String avatar_name = id.getNickname();


    System.out.println(avatar_name);
    System.out.println(avatar_url); 

    SteamId[] friend = id.getFriends();
    for(int i =0 ; i<friend.length;i++)
    {
        fr = friend [i];
        //where null is in
        System.out.println(fr.getNickname());
    }

But when i run it it give me right Avator name,Url,etc but for Friend list I get all "null" (get right count of nulls).So whats the wrong?

and i cant see any other way or even other API or any other examples to send a message to a friend, but we all have face spam bots sending us message every day ,so how can we send a message to a friend .

Many thanks for all your help ......


Solution

  • SteamId#fetchFriends() returns unfetched (i.e. empty) instances of SteamId for every friend. You will have to call #fetchData() on each of them first.

    SteamId[] friends = id.getFriends();
    for (int i = 0; i < friend.length; i++) {
        friend[i].fetchData(); // This will get the profile data of that friend
        System.out.println(friend[i].getNickname());
    }
    

    Please note that this will require an additionall HTTP request for every friend in the list.