steamutils 1.1.9 → 1.1.11
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 +6 -7
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -10,7 +10,6 @@ import {fileURLToPath} from "url";
|
|
10
10
|
import path from "path";
|
11
11
|
import SteamUtils from "./index.js";
|
12
12
|
import {v4 as uuidv4} from 'uuid';
|
13
|
-
import { steamID } from 'steam-user/components/helpers.js'
|
14
13
|
|
15
14
|
const __filename = fileURLToPath(import.meta.url);
|
16
15
|
const __dirname = path.dirname(__filename);
|
@@ -239,7 +238,7 @@ function SteamClient({
|
|
239
238
|
}
|
240
239
|
|
241
240
|
async function getPersonas(steamIDs) {
|
242
|
-
steamIDs = steamIDs.map(
|
241
|
+
steamIDs = steamIDs.map(steamId => steamId instanceof SteamID ? steamId.getSteamID64() : steamId)
|
243
242
|
const notCachesteamIDs = steamIDs.filter(id => !PersonasCache.some(p => p.id == id))
|
244
243
|
const cachedPersonas = PersonasCache.filter(p => steamIDs.includes(p.id))
|
245
244
|
|
@@ -592,8 +591,8 @@ function SteamClient({
|
|
592
591
|
const prime = player.apr === 1 ? 'PRIME' : 'NON-PRIME'
|
593
592
|
const loc = LOCS[player.loc] || player.loc
|
594
593
|
const steamId = SteamID.fromIndividualAccountID(player.id).getSteamID64()
|
595
|
-
const persona = personas.find(p => p.id ==
|
596
|
-
const friendCode = FriendCode.encode(
|
594
|
+
const persona = personas.find(p => p.id == steamId)
|
595
|
+
const friendCode = FriendCode.encode(steamId)
|
597
596
|
|
598
597
|
if ((LOCS[player.loc] == 'VN' || !LOCS[player.loc])) {
|
599
598
|
players.push({
|
@@ -845,7 +844,7 @@ function SteamClient({
|
|
845
844
|
const timestamp = new Date(data.server_timestamp).getTime()
|
846
845
|
const steamId = data.steamid_friend.getSteamID64()
|
847
846
|
const personas = await getPersonas([steamId])
|
848
|
-
const player_name = personas.find(p => p.id ==
|
847
|
+
const player_name = personas.find(p => p.id == steamId)?.player_name || ''
|
849
848
|
log('friendMessage', data)
|
850
849
|
const invite = [`Inited you to play a game!`, `Đã mời bạn chơi một trò chơi!`].includes(data.message_no_bbcode || data.message)
|
851
850
|
|
@@ -859,9 +858,9 @@ function SteamClient({
|
|
859
858
|
|
860
859
|
});
|
861
860
|
|
862
|
-
steamClient.on('friendTyping', async function (
|
861
|
+
steamClient.on('friendTyping', async function (steamId, message) {
|
863
862
|
callEvent(events.friendTyping, {
|
864
|
-
|
863
|
+
steamId, message
|
865
864
|
})
|
866
865
|
});
|
867
866
|
|