- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试弄清楚如何自动接受 friend 请求,因为我真的很无聊我一直在我开始使用的机器人上到处做一些事情。
这里有两个有用的链接:
https://github.com/seishun/node-steam/blob/master/README.md#relationships
https://github.com/seishun/node-steam/blob/master/README.md#friends
所以我一直在尝试弄清楚如何通过使用它们来让它自动接受好友请求。
目前有一个待处理的好友请求,我很好奇如何让它自动接受它,甚至打印出当前的好友请求。
这是我的“ friend ”事件,您可以阅读@node-steam 的自述文件,它看起来像。
在“ friend ”事件下,它表示以下内容:
The friends and groups properties now contain data (unless your friend/group list is empty). Listen for this if you want to accept/decline friend requests that came while you were offline, for example.
我很好奇如何访问这两个属性?对不起,如果这是一个愚蠢的问题。在此先感谢,我还在学习。 :3
我已经确定我做错了,但我已经在这里坐了很长时间,并试图弄清楚,但我做不到。如果有多个好友请求,我的“好友”事件将无法运行,因为它需要遍历所有现有的请求,但我仍然不确定我会怎么做。编辑;我刚试过这个:
它目前至少有一个 friend 请求,但它没有对此使用react,所以我认为“ friend ”事件是错误的?
编辑2;我需要使用“关系”事件,而不是“ friend ”。现在我只需要弄清楚如何查看所有当前的好友请求。
我还发现了这个枚举:
Steam.EFriendRelationship = {
None: 0,
Blocked: 1,
PendingInvitee: 2, // obsolete - renamed to RequestRecipient
RequestRecipient: 2,
Friend: 3,
RequestInitiator: 4,
PendingInviter: 4, // obsolete - renamed to RequestInitiator
Ignored: 5,
IgnoredFriend: 6,
SuggestedFriend: 7,
Max: 8,
};
我不确定我将如何处理所有现有的好友邀请。使用:
console.log(Steam.EFriendRelationship.PendingInvitee);
返回“2”,因为这是枚举的值。我如何列出所有待处理的邀请?
最佳答案
回答你的第一个问题......
实际上,我今天一直在用它编写一个机器人,但遇到了这个问题。这是我的做法:
var Steam = require("steam");
var steam = new Steam.SteamClient()
steam.on("friend", function(steamID, relationship) {
if (relationship == Steam.EFriendRelationship.PendingInvitee) {
console.log("friend request received");
steam.addFriend(steamID);
console.log("friend request accepted");
}
});
这是不言自明的,但它会在收到好友请求后打印“收到好友请求”,添加好友,然后打印好友已添加。
编辑:
以下是添加在机器人离线时发送的好友请求的方法;
var _ = require("underscore");
var addPendingFriends = function() {
console.log("searching for pending friend requests...");
_.each(steam.friends, function(relationship, steamID) {
if (relationship == Steam.EFriendRelationship.RequestRecipient) {
steam.addFriend(steamID);
console.log(steamID+" was added as a friend");
}
});
console.log("finished searching");
};
如果我是对的,这就是您要找的东西? :)
重要提示:调用 addPendingFriends();在 webLogOn() 之后,似乎 steam.friends 没有在登录时启动。
关于javascript - NodeJS - Steam API - 自动接受好友请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21804774/
我一直在查看 Steam API 文档,并且有许多服务提供 Steam 网上商店中游戏的信息,但它们似乎都需要游戏的 Steam ID 作为参数。这可以通过用户 ID 来完成,如果给定用户名,API
我正在尝试获取用户游戏统计数据。首先,我正在尝试这样做: http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?
我正在尝试在 Steam 上找到该项目的名称。 这是我目前从 json 数组中得到的 [appid] => 730 [contextid] => 2 [assetid] => 4981322842 [
我正在开发一个使用公共(public) Steam API 来收集一些信息的应用程序。 目前我通过调用GetPlayerAchievements (v0001)检索成就和通话总时长 GetOwnedG
是否可以使用 Steam API 获取 Steam(753) 或 CsGo(730) 完整背包/库存? 我找到了一个 API,我可以在其中获取 Dota2(570) TF2(440) 的完整背包/元素
我正在尝试获取 JSON 格式的买卖订单,例如价格历史记录,但找不到任何信息。有没有办法做到这一点? Buy and Sell orders screenshot 我尝试过: https://stea
我搜索了论坛,找到了获取所有用户游戏的示例模式: http://steamcommunity.com/id//games?tab=all&xml=1 返回所有游戏。但是,如果用户尚未设置 Steam
我一直在阅读论坛并尝试 Steam API,我正在寻找提供所有 Steam 游戏的 API。 我找到了提供所有 SteamApps 的 API,以及提供应用程序信息的 Steam 商店 API(我正在
Steam 为我们提供了交易相关的API,但没有具体的地址示例:https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#
Steam 为我们提供了交易相关的API,但没有具体的地址示例:https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#
我正在尝试使用 Google 日历跟踪我的游戏时间/历史记录。 这是 Steam Web API在其中我找不到一种方法来获取关于我究竟在什么时候玩什么的详细信息,除了 GetRecentlyPlaye
如何使用 Steam API(已启动并运行)获取我的应用程序中当前使用(登录)帐户的 Steam 用户名。 Steam ID 可以(例如)通过以下方式获得: CSteamID id = SteamUs
有很多网站,例如www.tf2outpost.com和 www.bazaar.tf用户可以通过单击按钮添加其他 Steam 用户。你到底是如何做到这一点的? Web API 中没有任何内容向您展示如何
我使用此 URL 在 CS:GO 容器中一次获取 100 个结果。我用 {currency} 代替 3,用 {start} 代替 100 的倍数,我的问题是 currency=3 code> 似乎不是
我在 Steam API 中搜索发送 Steam 报价的方法,但找不到。可以使用 API 或者您知道其他方法吗?我想在 PHP/Symfony 中使用它。 最佳答案 您目前无法通过 API 创建交易报
我想知道有没有办法让用户输入他们的“Steam 用户名”,然后您就可以找到他们的“SteamID”。我一直在查看“Steam API”,但没有找到任何相关信息。 我的想法是让用户将他们的“Steam
是否有 API 可以获取用户的 Steam 集换式卡牌? 我对steam不太熟悉,但这个页面上好像没有。 https://developer.valvesoftware.com/wiki/Steam_
steam 桌面快捷方式 steam:// 实际如何工作? 它们的 URL/目标类似于:“steam://rungameid/717”我知道类似的东西,比如“ftp://mynetworkadress
是否有 API 可以获取用户的 Steam 集换式卡牌? 我对steam不是很熟悉,但是这个页面好像没有。 https://developer.valvesoftware.com/wiki/Steam
steam 桌面快捷方式 steam:// 实际如何工作? 它们的 URL/目标类似于:“steam://rungameid/717”我知道类似的东西,比如“ftp://mynetworkadress
我是一名优秀的程序员,十分优秀!