steamutils 1.0.56 → 1.0.58
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 +139 -6
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -88,6 +88,7 @@ function SteamClient({
|
|
88
88
|
let prime = null
|
89
89
|
|
90
90
|
const events = {
|
91
|
+
user: [],
|
91
92
|
loggedOn: [],
|
92
93
|
csgoOnline: [],
|
93
94
|
webSession: [],
|
@@ -639,24 +640,156 @@ function SteamClient({
|
|
639
640
|
}
|
640
641
|
})
|
641
642
|
|
642
|
-
|
643
|
-
|
643
|
+
|
644
|
+
steamClient.on('user', async (steamId, data) => {
|
645
|
+
callEvent(events.user, data)
|
646
|
+
const dataExample = {
|
647
|
+
"rich_presence": [
|
648
|
+
{
|
649
|
+
"key": "status",
|
650
|
+
"value": "Competitive Mirage [ 3 : 6 ]"
|
651
|
+
},
|
652
|
+
{
|
653
|
+
"key": "version",
|
654
|
+
"value": "13875"
|
655
|
+
},
|
656
|
+
{
|
657
|
+
"key": "game:state",
|
658
|
+
"value": "game"
|
659
|
+
},
|
660
|
+
{
|
661
|
+
"key": "steam_display",
|
662
|
+
"value": "#display_GameKnownMapScore"
|
663
|
+
},
|
664
|
+
{
|
665
|
+
"key": "game:mode",
|
666
|
+
"value": "competitive"
|
667
|
+
},
|
668
|
+
{
|
669
|
+
"key": "game:mapgroupname",
|
670
|
+
"value": "mg_de_mirage"
|
671
|
+
},
|
672
|
+
{
|
673
|
+
"key": "game:map",
|
674
|
+
"value": "de_mirage"
|
675
|
+
},
|
676
|
+
{
|
677
|
+
"key": "game:server",
|
678
|
+
"value": "kv"
|
679
|
+
},
|
680
|
+
{
|
681
|
+
"key": "watch",
|
682
|
+
"value": "1"
|
683
|
+
},
|
684
|
+
{
|
685
|
+
"key": "steam_player_group",
|
686
|
+
"value": "2134948645"
|
687
|
+
},
|
688
|
+
{
|
689
|
+
"key": "game:score",
|
690
|
+
"value": "[ 3 : 6 ]"
|
691
|
+
}
|
692
|
+
],
|
693
|
+
"friendid": "76561199405834425",
|
694
|
+
"persona_state": 1,
|
695
|
+
"game_played_app_id": 730,
|
696
|
+
"game_server_ip": null,
|
697
|
+
"game_server_port": null,
|
698
|
+
"persona_state_flags": 1,
|
699
|
+
"online_session_instances": 1,
|
700
|
+
"persona_set_by_user": null,
|
701
|
+
"player_name": "quỷ súng",
|
702
|
+
"query_port": null,
|
703
|
+
"steamid_source": "0",
|
704
|
+
"avatar_hash": {
|
705
|
+
"type": "Buffer",
|
706
|
+
"data": [
|
707
|
+
23,
|
708
|
+
163,
|
709
|
+
216,
|
710
|
+
209,
|
711
|
+
236,
|
712
|
+
179,
|
713
|
+
73,
|
714
|
+
228,
|
715
|
+
225,
|
716
|
+
30,
|
717
|
+
48,
|
718
|
+
190,
|
719
|
+
192,
|
720
|
+
170,
|
721
|
+
177,
|
722
|
+
246,
|
723
|
+
139,
|
724
|
+
71,
|
725
|
+
122,
|
726
|
+
205
|
727
|
+
]
|
728
|
+
},
|
729
|
+
"last_logoff": 1683950268,
|
730
|
+
"last_logon": 1683950281,
|
731
|
+
"last_seen_online": 1683950268,
|
732
|
+
"clan_rank": null,
|
733
|
+
"game_name": "",
|
734
|
+
"gameid": "730",
|
735
|
+
"game_data_blob": {
|
736
|
+
"type": "Buffer",
|
737
|
+
"data": []
|
738
|
+
},
|
739
|
+
"clan_data": null,
|
740
|
+
"clan_tag": null,
|
741
|
+
"broadcast_id": "0",
|
742
|
+
"game_lobby_id": "0",
|
743
|
+
"watching_broadcast_accountid": null,
|
744
|
+
"watching_broadcast_appid": null,
|
745
|
+
"watching_broadcast_viewers": null,
|
746
|
+
"watching_broadcast_title": null,
|
747
|
+
"is_community_banned": null,
|
748
|
+
"player_name_pending_review": null,
|
749
|
+
"avatar_pending_review": null
|
750
|
+
}
|
751
|
+
})
|
752
|
+
|
753
|
+
steamClient.chat.on('friendMessage', async (data) => {
|
754
|
+
const example = {
|
755
|
+
"steamid_friend": {
|
756
|
+
"universe": 1,
|
757
|
+
"type": 1,
|
758
|
+
"instance": 1,
|
759
|
+
"accountid": 1080136620
|
760
|
+
},
|
761
|
+
"chat_entry_type": 1,
|
762
|
+
"from_limited_account": false,
|
763
|
+
"message": "xxx",
|
764
|
+
"ordinal": 0,
|
765
|
+
"local_echo": false,
|
766
|
+
"message_no_bbcode": "xxx",
|
767
|
+
"low_priority": false,
|
768
|
+
"server_timestamp": "2023-05-14T09:26:25.000Z",
|
769
|
+
"message_bbcode_parsed": [
|
770
|
+
"xxx"
|
771
|
+
]
|
772
|
+
}
|
773
|
+
const timestamp = new Date(data.server_timestamp).getTime()
|
774
|
+
const sid64 = data.steamid_friend.getSteamID64();
|
644
775
|
const personas = await getPersonas([sid64]);
|
645
776
|
const player_name = personas[sid64]?.player_name || ''
|
646
|
-
log('friendMessage',
|
777
|
+
log('friendMessage', data);
|
647
778
|
|
648
|
-
if ([`Inited you to play a game!`, `Đã mời bạn chơi một trò chơi!`].includes(message)) {
|
779
|
+
if ([`Inited you to play a game!`, `Đã mời bạn chơi một trò chơi!`].includes(data.message)) {
|
649
780
|
callEvent(events.friendMessage, {
|
650
781
|
player_name,
|
651
|
-
message,
|
782
|
+
message: data.message_no_bbcode,
|
652
783
|
invite: true,
|
653
784
|
sid64,
|
785
|
+
timestamp,
|
654
786
|
})
|
655
787
|
} else {
|
656
788
|
callEvent(events.friendMessage, {
|
657
|
-
message,
|
789
|
+
message: data.message_no_bbcode,
|
658
790
|
player_name,
|
659
791
|
sid64,
|
792
|
+
timestamp,
|
660
793
|
})
|
661
794
|
}
|
662
795
|
});
|