steamutils 1.1.87 → 1.1.89
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +22 -2
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -85,7 +85,8 @@ function SteamClient({
|
|
85
85
|
cookie,
|
86
86
|
isAutoRequestFreeLicense = true,
|
87
87
|
isPartyRegister = true,
|
88
|
-
autoPlay = false
|
88
|
+
autoPlay = false,
|
89
|
+
autoAcceptTradeRequest = false,
|
89
90
|
}) {
|
90
91
|
const steamClient = new SteamUser()
|
91
92
|
let prime = null
|
@@ -105,6 +106,7 @@ function SteamClient({
|
|
105
106
|
friendRelationship: [],
|
106
107
|
tradeOffers: [],
|
107
108
|
offlineMessages: [],
|
109
|
+
friendsList: [],
|
108
110
|
}
|
109
111
|
|
110
112
|
const gcCallback = {}
|
@@ -912,6 +914,23 @@ function SteamClient({
|
|
912
914
|
steamClient.on('offlineMessages', async function (count , friends) {
|
913
915
|
callEvent(events.offlineMessages, {count , steamIdList: friends})
|
914
916
|
});
|
917
|
+
|
918
|
+
steamClient.on('tradeRequest', async function (steamID , respond ) {
|
919
|
+
if (autoAcceptTradeRequest) {
|
920
|
+
log(`Incoming trade request from ${steamID.getSteam3RenderedID()}, accepting`);
|
921
|
+
respond(true);
|
922
|
+
} else {
|
923
|
+
log(`Incoming trade request from ${steamID.getSteam3RenderedID()}, wating`);
|
924
|
+
}
|
925
|
+
});
|
926
|
+
|
927
|
+
steamClient.on('friendsList', async function () {
|
928
|
+
callEvent(events.friendsList, getFriendList())
|
929
|
+
});
|
930
|
+
}
|
931
|
+
|
932
|
+
function getFriendList() {
|
933
|
+
return Object.keys(steamClient.myFriends).filter(steamId => steamClient.myFriends[steamId] === SteamUser.EFriendRelationship.Friend)
|
915
934
|
}
|
916
935
|
|
917
936
|
function sendFriendTyping(steamId, callback) {
|
@@ -1266,7 +1285,8 @@ function SteamClient({
|
|
1266
1285
|
log,
|
1267
1286
|
isPrime(){
|
1268
1287
|
return prime === true
|
1269
|
-
}
|
1288
|
+
},
|
1289
|
+
getFriendList
|
1270
1290
|
}
|
1271
1291
|
}
|
1272
1292
|
|