steamutils 1.0.56 → 1.0.57
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 -4
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -639,8 +639,28 @@ function SteamClient({
|
|
639
639
|
}
|
640
640
|
})
|
641
641
|
|
642
|
-
steamClient.on('friendMessage', async (
|
643
|
-
const
|
642
|
+
steamClient.chat.on('friendMessage', async (data) => {
|
643
|
+
const example = {
|
644
|
+
"steamid_friend": {
|
645
|
+
"universe": 1,
|
646
|
+
"type": 1,
|
647
|
+
"instance": 1,
|
648
|
+
"accountid": 1080136620
|
649
|
+
},
|
650
|
+
"chat_entry_type": 1,
|
651
|
+
"from_limited_account": false,
|
652
|
+
"message": "xxx",
|
653
|
+
"ordinal": 0,
|
654
|
+
"local_echo": false,
|
655
|
+
"message_no_bbcode": "xxx",
|
656
|
+
"low_priority": false,
|
657
|
+
"server_timestamp": "2023-05-14T09:26:25.000Z",
|
658
|
+
"message_bbcode_parsed": [
|
659
|
+
"xxx"
|
660
|
+
]
|
661
|
+
}
|
662
|
+
const timestamp = new Date(data.server_timestamp).getTime()
|
663
|
+
const sid64 = data.steamid_friend.getSteamID64();
|
644
664
|
const personas = await getPersonas([sid64]);
|
645
665
|
const player_name = personas[sid64]?.player_name || ''
|
646
666
|
log('friendMessage', sid64, message);
|
@@ -648,15 +668,17 @@ function SteamClient({
|
|
648
668
|
if ([`Inited you to play a game!`, `Đã mời bạn chơi một trò chơi!`].includes(message)) {
|
649
669
|
callEvent(events.friendMessage, {
|
650
670
|
player_name,
|
651
|
-
message,
|
671
|
+
message: data.message_no_bbcode,
|
652
672
|
invite: true,
|
653
673
|
sid64,
|
674
|
+
timestamp,
|
654
675
|
})
|
655
676
|
} else {
|
656
677
|
callEvent(events.friendMessage, {
|
657
|
-
message,
|
678
|
+
message: data.message_no_bbcode,
|
658
679
|
player_name,
|
659
680
|
sid64,
|
681
|
+
timestamp,
|
660
682
|
})
|
661
683
|
}
|
662
684
|
});
|