steamutils 1.0.20 → 1.0.22
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 +14 -9
- 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
|
242
|
-
|
243
|
-
const
|
244
|
-
|
245
|
-
|
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
|
}
|
@@ -592,11 +595,13 @@ function SteamClient({
|
|
592
595
|
cookie,
|
593
596
|
}
|
594
597
|
}))?.data
|
595
|
-
if (result) {
|
598
|
+
if (result?.logged_in) {
|
596
599
|
Object.assign(result, {
|
597
600
|
steamID: new SteamID(result.steamid), accountName: result.account_name, webLogonToken: result.token
|
598
601
|
})
|
599
602
|
steamClient.logOn(result)
|
603
|
+
} else {
|
604
|
+
console.log('You are not logged in', cookie)
|
600
605
|
}
|
601
606
|
} else if (username && password) {
|
602
607
|
console.log(`login with username ${username}`)
|