steamutils 1.0.20 → 1.0.21

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.
Files changed (2) hide show
  1. package/SteamClient.js +11 -8
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -101,6 +101,7 @@ function SteamClient({
101
101
  }
102
102
 
103
103
  async function getPersonas(steamIDs) {
104
+ steamIDs = steamIDs.map(steamID => steamID instanceof SteamID ? steamID.getSteamID64() : steamID)
104
105
  const notCachesteamIDs = steamIDs.filter(id => !PersonasCache.some(p => p.id == id))
105
106
  const cachedPersonas = PersonasCache.filter(p => steamIDs.includes(p.id))
106
107
 
@@ -110,19 +111,19 @@ function SteamClient({
110
111
  personas = (await steamClient.getPersonas(steamIDs))?.personas
111
112
  } catch (e) {
112
113
  }
113
- if (!personas) {
114
+ if (!personas || !Object.keys(personas).length) {
114
115
  try {
115
116
  personas = (await steamClient.getPersonas(steamIDs))?.personas
116
117
  } catch (e) {
117
118
  }
118
119
  }
119
- if (!personas) {
120
+ if (!personas || !Object.keys(personas).length) {
120
121
  try {
121
122
  personas = (await steamClient.getPersonas(steamIDs))?.personas
122
123
  } catch (e) {
123
124
  }
124
125
  }
125
- if (personas) {
126
+ if (personas && Object.keys(personas).length) {
126
127
  for (let sid64 in personas) {
127
128
  personas[sid64].id = sid64
128
129
  personas[sid64].avatar_hash = Buffer.from(personas[sid64].avatar_hash).toString("hex")
@@ -238,11 +239,13 @@ function SteamClient({
238
239
  }
239
240
  case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Party_Invite: {
240
241
  const msg = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Party_Invite, payload);
241
- const sid = SteamID.fromIndividualAccountID(msg.accountid);
242
- // console.log(msg)
243
- const personas = await getPersonas([sid]);
244
- const sID64 = sid.getSteamID64();
245
- console.log(getAccountInfoName(), personas.find(p => p.id == sID64)?.player_name, `https://steamcommunity.com/profiles/${sID64}`);
242
+ const sid64 = SteamID.fromIndividualAccountID(msg.accountid).getSteamID64();
243
+ const personas = await getPersonas([sid64]);
244
+ const player_name = personas.find(p => p.id == sid64)?.player_name
245
+ if(player_name === undefined){
246
+ console.log(sid64, personas);
247
+ }
248
+ console.log(getAccountInfoName(), player_name, `https://steamcommunity.com/profiles/${sid64}`);
246
249
  // joinLobby(msg.lobbyid, msg.accountid)
247
250
  break
248
251
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",