steamutils 1.0.11 → 1.0.12
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 +22 -1
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -90,7 +90,8 @@ function SteamClient({
|
|
90
90
|
let gamename = null;
|
91
91
|
|
92
92
|
const events = {
|
93
|
-
loggedOn: []
|
93
|
+
loggedOn: [],
|
94
|
+
friendMessage: [],
|
94
95
|
}
|
95
96
|
|
96
97
|
const personasCache = []
|
@@ -523,6 +524,26 @@ function SteamClient({
|
|
523
524
|
|
524
525
|
events.loggedOn.forEach(e => e?.invoke?.())
|
525
526
|
})
|
527
|
+
|
528
|
+
steamClient.on('friendMessage', async (user, message) => {
|
529
|
+
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
|
+
const sid = user;
|
532
|
+
const personas = await getPersonas([sid]);
|
533
|
+
const player_name = personas[sid]?.player_name || ''
|
534
|
+
events.friendMessage.forEach(e => e?.({
|
535
|
+
player_name,
|
536
|
+
sid64: user.getSteamID64(),
|
537
|
+
}))
|
538
|
+
}
|
539
|
+
} else {
|
540
|
+
console.log('friendMessage', user.getSteamID64(), message);
|
541
|
+
events.friendMessage.forEach(e => e?.({
|
542
|
+
message,
|
543
|
+
sid64: user.getSteamID64(),
|
544
|
+
}))
|
545
|
+
}
|
546
|
+
});
|
526
547
|
}
|
527
548
|
|
528
549
|
function getPlayersProfile(accountid) {
|