steamutils 1.3.40 → 1.3.41
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +9 -9
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import NodeSteamUser from "steam-user";
|
2
2
|
import _ from "lodash";
|
3
3
|
import fs from "fs";
|
4
4
|
import {protoDecode, protoEncode} from "./helpers/util.js";
|
@@ -8,7 +8,7 @@ import axios from "axios";
|
|
8
8
|
import helpers, {loadProfos} from "./helpers/protos.js";
|
9
9
|
import {fileURLToPath} from "url";
|
10
10
|
import path from "path";
|
11
|
-
import
|
11
|
+
import SteamUser from "./index.js";
|
12
12
|
import {v4 as uuidv4} from 'uuid';
|
13
13
|
import EFriendRelationship from "steam-user/enums/EFriendRelationship.js";
|
14
14
|
import SteamCommunity from "steamcommunity";
|
@@ -78,7 +78,7 @@ const AppID = 730
|
|
78
78
|
export let CSGO_VER = 13960
|
79
79
|
export const FreeAppList = JSON.parse(fs.readFileSync(path.join(__dirname, 'free_packages.json'))).packages
|
80
80
|
|
81
|
-
|
81
|
+
SteamUser.getAppVersion(AppID).then(function (ver) {
|
82
82
|
CSGO_VER = ver
|
83
83
|
})
|
84
84
|
|
@@ -99,7 +99,7 @@ function SteamClient({
|
|
99
99
|
autoReconnect = true,
|
100
100
|
MAX_GAME_PLAY = 10
|
101
101
|
}) {
|
102
|
-
const steamClient = new
|
102
|
+
const steamClient = new NodeSteamUser()
|
103
103
|
let prime = null
|
104
104
|
let state = 'Offline'//InGame, Online, Invisible
|
105
105
|
let isLogOff = false
|
@@ -1560,7 +1560,7 @@ function SteamClient({
|
|
1560
1560
|
}
|
1561
1561
|
|
1562
1562
|
function getFriendList() {
|
1563
|
-
return Object.keys(steamClient.myFriends).filter(steamId => steamClient.myFriends[steamId] ===
|
1563
|
+
return Object.keys(steamClient.myFriends).filter(steamId => steamClient.myFriends[steamId] === NodeSteamUser.EFriendRelationship.Friend)
|
1564
1564
|
}
|
1565
1565
|
|
1566
1566
|
function sendFriendTyping(steamId, callback) {
|
@@ -1691,7 +1691,7 @@ function SteamClient({
|
|
1691
1691
|
return true
|
1692
1692
|
} else if (cookie) {
|
1693
1693
|
log(reconnect ? 'reconnect with cookie' : 'login with cookie')
|
1694
|
-
const _clientJsToken = await new
|
1694
|
+
const _clientJsToken = await new SteamUser(typeof cookie === "function" ? await cookie() : cookie).getClientJsToken()
|
1695
1695
|
if (_clientJsToken?.logged_in === true) {
|
1696
1696
|
try {
|
1697
1697
|
await steamClient.logOn(_clientJsToken)
|
@@ -1940,10 +1940,10 @@ function SteamClient({
|
|
1940
1940
|
|
1941
1941
|
function updateInvisible() {
|
1942
1942
|
if (isInvisible) {
|
1943
|
-
steamClient.setPersona(
|
1943
|
+
steamClient.setPersona(NodeSteamUser.EPersonaState.Invisible)
|
1944
1944
|
state = 'Invisible'
|
1945
1945
|
} else {
|
1946
|
-
steamClient.setPersona(
|
1946
|
+
steamClient.setPersona(NodeSteamUser.EPersonaState.Online)
|
1947
1947
|
state = 'Online'
|
1948
1948
|
}
|
1949
1949
|
}
|
@@ -1955,7 +1955,7 @@ function SteamClient({
|
|
1955
1955
|
|
1956
1956
|
steamClient.gamesPlayed(apps);
|
1957
1957
|
await sleep(2000)
|
1958
|
-
// steamClient.setPersona(
|
1958
|
+
// steamClient.setPersona(NodeSteamUser.EPersonaState.Online)
|
1959
1959
|
await sendHello()
|
1960
1960
|
updateFakeGameScore()
|
1961
1961
|
|