steamutils 1.0.13 → 1.0.15
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 +26 -5
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -92,6 +92,7 @@ function SteamClient({
|
|
92
92
|
const events = {
|
93
93
|
loggedOn: [],
|
94
94
|
friendMessage: [],
|
95
|
+
friendTyping: [],
|
95
96
|
}
|
96
97
|
|
97
98
|
const personasCache = []
|
@@ -527,7 +528,7 @@ function SteamClient({
|
|
527
528
|
|
528
529
|
steamClient.on('friendMessage', async (user, message) => {
|
529
530
|
if ([`Invited you to play a game!`, `Đã mời bạn chơi một trò chơi!`].includes(message)) {
|
530
|
-
if(events.friendMessage.length){
|
531
|
+
if (events.friendMessage.length) {
|
531
532
|
const sid = user;
|
532
533
|
const personas = await getPersonas([sid]);
|
533
534
|
const player_name = personas[sid]?.player_name || ''
|
@@ -546,6 +547,14 @@ function SteamClient({
|
|
546
547
|
}))
|
547
548
|
}
|
548
549
|
});
|
550
|
+
|
551
|
+
steamClient.on('friendTyping', async function (steamID, message) {
|
552
|
+
events.friendTyping.forEach(e => e?.(steamID, message))
|
553
|
+
});
|
554
|
+
}
|
555
|
+
|
556
|
+
function sendFriendTyping(steamId, callback) {
|
557
|
+
steamClient.chat.sendFriendTyping(steamId, callback)
|
549
558
|
}
|
550
559
|
|
551
560
|
function getPlayersProfile(accountid) {
|
@@ -612,19 +621,31 @@ function SteamClient({
|
|
612
621
|
}
|
613
622
|
|
614
623
|
return {
|
615
|
-
init,
|
624
|
+
init,
|
625
|
+
partySearch,
|
626
|
+
partyRegister,
|
627
|
+
requestCoPlays,
|
628
|
+
getPersonas,
|
629
|
+
getUsername() {
|
616
630
|
return username
|
617
|
-
},
|
631
|
+
},
|
632
|
+
onEvent(name, cb) {
|
618
633
|
if (!events[name]) {
|
619
634
|
events[name] = []
|
620
635
|
}
|
621
636
|
events[name].push(cb)
|
622
|
-
},
|
637
|
+
},
|
638
|
+
setPersona(state, name) {
|
623
639
|
steamClient.setPersona(state, name)
|
624
|
-
},
|
640
|
+
},
|
641
|
+
setGameName(name) {
|
625
642
|
gamename = name
|
626
643
|
},
|
627
644
|
sendFriendMessage,
|
645
|
+
sendFriendTyping,
|
646
|
+
getSteamClient() {
|
647
|
+
return steamClient
|
648
|
+
}
|
628
649
|
}
|
629
650
|
}
|
630
651
|
|