gpt4 book ai didi

java - Steam 社区好友列表并向他们发送消息

转载 作者:行者123 更新时间:2023-12-01 11:49:58 25 4
gpt4 key购买 nike

我正在尝试做一个小型应用程序来与我的团队在 steam 中合作,并且我已经在 steam 中使用了 jave 实现建议,“Steam Condenser”。

所以我尝试获取玩家信息,例如,

    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());
}

但是当我运行它时,它给了我正确的 Avator 名称、Url 等,但是对于 friend 列表,我得到了所有“null”(获得正确的 null 计数)。那么出了什么问题呢?

我看不到任何其他方式,甚至其他 API 或任何其他示例来向 friend 发送消息,但我们都有面部垃圾邮件机器人每天向我们发送消息,那么我们如何向 friend 发送消息。

非常感谢您的帮助......

最佳答案

SteamId#fetchFriends() 为每个好友返回未获取的(即空)SteamId 实例。您必须首先对每个数据调用 #fetchData()

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());
}

请注意,这将需要为列表中的每个 friend 发出额外的 HTTP 请求。

关于java - Steam 社区好友列表并向他们发送消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28870798/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com