steamutils 1.4.48 → 1.4.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SteamClient.js CHANGED
@@ -1,12 +1,10 @@
1
1
  import NodeSteamUser from "steam-user";
2
2
  import _ from "lodash";
3
3
  import SteamID from "steamid";
4
- import FriendCode from "csgo-friendcode";
5
4
  import axios from "axios";
6
5
  import SteamUser from "./index.js";
7
6
  import { v4 as uuidv4 } from "uuid";
8
7
  import EFriendRelationship from "steam-user/enums/EFriendRelationship.js";
9
- import SteamCommunity from "steamcommunity";
10
8
  import moment from "moment-timezone";
11
9
  import { encode, encodeUids } from "./bufferHelpers.js";
12
10
  import { ESteamProto, SteamProto, SteamProtoType } from "./steamproto.js";
@@ -1154,23 +1152,26 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1154
1152
  // }
1155
1153
 
1156
1154
  const players = [];
1157
- for (const player of entries) {
1158
- try {
1159
- const prime = player.apr === 1 ? "PRIME" : "NON-PRIME";
1160
- const loc = LOCS[player.loc] || player.loc;
1161
- const steamId = SteamID.fromIndividualAccountID(player.id).getSteamID64();
1162
- const friendCode = FriendCode.encode(steamId);
1163
-
1164
- // if ((LOCS[player.loc] == 'VN' || !LOCS[player.loc])) {
1165
- players.push({
1166
- prime,
1167
- rank: RANKS[player.ark] !== undefined ? RANKS[player.ark] : player.ark,
1168
- loc,
1169
- steamId,
1170
- friendCode,
1171
- });
1172
- // }
1173
- } catch (e) {}
1155
+ if (entries.length) {
1156
+ const FriendCode = (await import("csgo-friendcode")).default;
1157
+ for (const player of entries) {
1158
+ try {
1159
+ const prime = player.apr === 1 ? "PRIME" : "NON-PRIME";
1160
+ const loc = LOCS[player.loc] || player.loc;
1161
+ const steamId = SteamID.fromIndividualAccountID(player.id).getSteamID64();
1162
+ const friendCode = FriendCode.encode(steamId);
1163
+
1164
+ // if ((LOCS[player.loc] == 'VN' || !LOCS[player.loc])) {
1165
+ players.push({
1166
+ prime,
1167
+ rank: RANKS[player.ark] !== undefined ? RANKS[player.ark] : player.ark,
1168
+ loc,
1169
+ steamId,
1170
+ friendCode,
1171
+ });
1172
+ // }
1173
+ } catch (e) {}
1174
+ }
1174
1175
  }
1175
1176
 
1176
1177
  callGCCallback("partySearch", players);
@@ -1401,9 +1402,10 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1401
1402
  }
1402
1403
  if (playing_blocked) {
1403
1404
  //true, false
1404
- log("Playing else where");
1405
+ log(`Playing else where ${playing_app ?? ""}`);
1406
+ } else {
1407
+ log(`playingState not blocked ${playing_app ?? ""}`);
1405
1408
  }
1406
- log("playingState", playing_blocked, playing_app);
1407
1409
  callEvent(events.playingState, { playing_blocked, playing_app });
1408
1410
  },
1409
1411
  async friendRelationship(sid, relationship, previousRelationship) {
@@ -2440,6 +2442,7 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
2440
2442
  onAnyEvent,
2441
2443
  async redeemGift(gid) {
2442
2444
  try {
2445
+ const SteamCommunity = (await import("steamcommunity")).default;
2443
2446
  const community = new SteamCommunity();
2444
2447
  let cookies = await getCookiesWait();
2445
2448
  community.setCookies(typeof cookies === "string" ? cookies.split(";") : cookies);
package/_steamproto.js CHANGED
@@ -22,6 +22,10 @@ export class SteamProto {
22
22
  return protobuf.encode(protobuf.create(obj)).finish();
23
23
  }
24
24
 
25
+ protoEncodeBase64(obj) {
26
+ return this.protoEncode(obj);
27
+ }
28
+
25
29
  protoDecode(obj) {
26
30
  const protobuf = this.toProto();
27
31
  return protobuf.toObject(protobuf.decode(obj), { defaults: true });