steamutils 1.4.89 → 1.4.91
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +9 -4
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -92,7 +92,6 @@ export const SteamClientEvents = {
|
|
92
92
|
licenses: "licenses",
|
93
93
|
logOff: "logOff",
|
94
94
|
};
|
95
|
-
let isSendingFriendMessages = false;
|
96
95
|
|
97
96
|
function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense = true, isFakeGameScore = true, isPartyRegister = true, isAutoPlay = false, isInvisible = false, autoAcceptTradeRequest = false, autoReconnect = true, games = null }) {
|
98
97
|
let steamClient = null;
|
@@ -2302,6 +2301,7 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
2302
2301
|
}
|
2303
2302
|
}
|
2304
2303
|
|
2304
|
+
let isSendingFriendMessages = false;
|
2305
2305
|
async function _execMessageQueue() {
|
2306
2306
|
if (isLogOff) {
|
2307
2307
|
clearMessageQueue();
|
@@ -2315,6 +2315,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
2315
2315
|
try {
|
2316
2316
|
isSendingFriendMessages = true;
|
2317
2317
|
const item = MessageQueue.shift();
|
2318
|
+
if (!item) {
|
2319
|
+
break;
|
2320
|
+
}
|
2318
2321
|
const result = await _sendFriendMessage(item.steamId, item.message);
|
2319
2322
|
if (typeof item.callback === "function") {
|
2320
2323
|
try {
|
@@ -2324,7 +2327,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
2324
2327
|
if (MessageQueue.length) {
|
2325
2328
|
await sleep(1000);
|
2326
2329
|
}
|
2327
|
-
} catch (e) {
|
2330
|
+
} catch (e) {
|
2331
|
+
console.error("_execMessageQueue", e);
|
2332
|
+
}
|
2328
2333
|
}
|
2329
2334
|
isSendingFriendMessages = false;
|
2330
2335
|
}
|
@@ -2336,8 +2341,8 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
2336
2341
|
return;
|
2337
2342
|
}
|
2338
2343
|
result = await new Promise((resolve) => {
|
2339
|
-
steamClient.chat.sendFriendMessage(steamId, message, undefined, function (...
|
2340
|
-
resolve(
|
2344
|
+
steamClient.chat.sendFriendMessage(steamId, message, undefined, function (...args) {
|
2345
|
+
resolve(args);
|
2341
2346
|
});
|
2342
2347
|
});
|
2343
2348
|
if (result?.[1]?.server_timestamp) {
|