quer/the-steam-awards

steamAwardNominateGame_v2 - not working

pontifezo opened this issue · 9 comments

I get this message after launching:

Connected to Steam.
websession start
you need to setup your api key. or remove this and skip from the GetMostPlayedGame methode
Modules done

And not getting a badge (

quer commented

you need to add a api key, in the top of the steamAwardNominateGame_v2.js file. as the code need to fetch the account games, to ensure it vote for a game the the account owns.

if you do not have a api. and you know a game that all the account have. then replace some of the code whit:
Old:

seeIfHaveAll(_requestStore, sessionID, function () {
		GetMostPlayedGame(_requestCommunity, steamClient.steamID, function (appid) { //OBS the game must have played over 5 min. 
			console.log(appid);
			options.steamUser.gamesPlayed([{ game_id: appid.appid }]);
			vote("52", appid.appid, _requestStore, sessionID, function () {
				//Info wee remove the Review 
				removeMake(_requestCommunity, _requestStore, sessionID, steamClient.steamID, appid.appid, function () {
					Make(_requestCommunity, _requestStore, sessionID, steamClient.steamID, appid.appid, function () {
						setTimeout(async function () {						
							try {
								await EnsureWeAreDone(_requestStore, options);
								callback();
								return;
							} catch (error) {
								module.exports(steamClient, _requestCommunity, _requestStore, sessionID, options, callback);// if not all did go as we expected we rerun. there is build a save ind so we only nomination missing.
							}
							
						}, 60000 * 5);
					});
				})
			})
		})
	});

New:

seeIfHaveAll(_requestStore, sessionID, function () {
		//GetMostPlayedGame(_requestCommunity, steamClient.steamID, function (appid) { //OBS the game must have played over 5 min. 
			var appid = { appid: 730 }; // here place the game all have, ( i have placed the app for CS GO )
			console.log(appid);
			options.steamUser.gamesPlayed([{ game_id: appid.appid }]);
			vote("52", appid.appid, _requestStore, sessionID, function () {
				//Info wee remove the Review 
				removeMake(_requestCommunity, _requestStore, sessionID, steamClient.steamID, appid.appid, function () {
					Make(_requestCommunity, _requestStore, sessionID, steamClient.steamID, appid.appid, function () {
						setTimeout(async function () {						
							try {
								await EnsureWeAreDone(_requestStore, options);
								callback();
								return;
							} catch (error) {
								module.exports(steamClient, _requestCommunity, _requestStore, sessionID, options, callback);// if not all did go as we expected we rerun. there is build a save ind so we only nomination missing.
							}
							
						}, 60000 * 5);
					});
				})
			})
		//})
	});

And remove the if

if(apiKey == "xxxxx"){
		console.log("you need to setup your api key. or remove this and skip from the GetMostPlayedGame methode")
		callback();
		return;
	}

I replaced a code, but only 2 tasks are completed:

  • Nominate at least 1 game
  • Nominate a game in each category

Console log:

Connected to Steam.
websession start
need index 1
397540 1 b
vote - 50 - start
vote - 50 - end
need index 2
546560 0 a
vote - 51 - start
vote - 51 - end
need index 3
need index 4
1086940 1 b
vote - 53 - start
vote - 53 - end
need index 5
261550 1 b
vote - 54 - start
vote - 54 - end
need index 6
1237950 1 b
vote - 55 - start
vote - 55 - end
need index 7
1238810 1 b
vote - 56 - start
vote - 56 - end
need index 8
1158310 2 c
vote - 57 - start
vote - 57 - end
need index 9
976730 2 c
vote - 58 - start
vote - 58 - end
need index 10
1174180 3 d
vote - 59 - start
vote - 59 - end
{ appid: 730 }
vote - 52 - start
vote - 52 - end
fjerenet
created
fjerenet
did not complete the flow. status:
┌─────────┬─────────────────────────────────────┬─────────┐
│ (index) │               massage               │ status  │
├─────────┼─────────────────────────────────────┼─────────┤
│    0    │     'missing nominations rows'      │   ''    │
│    1    │       'have played the game'        │ 'false' │
│    2    │ 'have create a review for the game' │ 'false' │
└─────────┴─────────────────────────────────────┴─────────┘
{ appid: 730 }
vote - 52 - start
vote - 52 - end
fjerenet
created
fjerenet
quer commented

The account that you are using do it have the game id 730 ? ( csgo ). the
fjerenet created fjerenet
means that it have tryed to create a review for the appid, ( 730 ), but somefing on steam side, might have stop it. Like you are only allow to create for games that you own.

just replace the id inside
var appid = { appid: 730 };
to a app id that all the account have en common. else you need to add the api key. to ensure it select at game that each account own, or monify the code to manuel enter a appid base on the account runing.

By the way, the task "have played the game" does not work for me either.
The script starts the game, but the task does not count. If you close the script and start the game, for example, using Archi Steam Farm, then the task is counted.

The game is on all accounts, played for several hours, but this error repeats endlessly, which is why the script does not switch to the next account

76561198****** - undefined: did not complete the flow. status:
┌─────────┬─────────────────────────────────────┬─────────┐
│ (index) │               massage               │ status  │
├─────────┼─────────────────────────────────────┼─────────┤
│    0    │     'missing nominations rows'      │   ''    │
│    1    │       'have played the game'        │ 'false' │
│    2    │ 'have create a review for the game' │ 'true'  │
└─────────┴─────────────────────────────────────┴─────────┘
{ appid: 310560 }
vote - 52 - start
vote - 52 - end
fjerenet
created
fjerenet

UPD. When the error 'have played the game' │ 'false' occurs, then after restarting the script the task is successfully counted. But you have to participate in the process yourself and manually restart the script

quer commented

Thank for the feed back. i will look into it. later.
But i did test the flow whit 5 account when testing, and it did work for me. where it did detect that i did get the task done.

I do not have any account that do not have compleated the event. so i cant test it. But can you tell me if the account look like it is playing the game, when the script is running. The way ASF work is the same way, this script works.

i did also create a other way to do the event, a faster way. Where the script do it all but, play the game, as it run each a count one at the time, it can take a long time.
That is why i create the node AllRunGame.js, what i do is run all account at once, and check if that one task is done.

the only thing in the module you need to chance is

Before:

function EnsureWeAreDone(_requestStore, options) {
	return new Promise(function (resolve, reject) {
		_requestStore.get('https://store.steampowered.com/steamawards/nominations', function (error, response, body) {
			var $ = cheerio.load(body);
			if($(".badge_preview.level_4.current").length <= 0){
				//it did not complete all
				//let see why
				var rowsMissing = [];
				var nomination_rows = $(".nomination_row");
				for (let i = 0; i < nomination_rows.length; i++) {
					const nomination_row = nomination_rows[i];
					var rowjquery = $(nomination_row);
					if(!rowjquery.hasClass('has_nomination')){
						rowsMissing.push(i + 1); // to show human read row number
					}
				}
				var onlyLookAtPlayGameAndReviewTaskStatus = $($(".badge_tasks_right")[0]).find(".badge_task");
				var haveDonePlaygame = onlyLookAtPlayGameAndReviewTaskStatus[0] && $(onlyLookAtPlayGameAndReviewTaskStatus[0]).find(".nominate_check").length > 0 ? "true" : "false";
				var haveDoneReview  = onlyLookAtPlayGameAndReviewTaskStatus[1] && $(onlyLookAtPlayGameAndReviewTaskStatus[1]).find(".nominate_check").length > 0? "true" : "false";
				console.log(options.accountPretty +" did not complete the flow. status: ");
				console.table([
					{massage: "missing nominations rows", status: rowsMissing.join(",")},
					{massage: "have played the game", status: haveDonePlaygame},
					{massage: "have create a review for the game", status: haveDoneReview},
				]);
				reject();
				return;
			}else{
				resolve();
				return;
			}
		});
	});
	
}
function EnsureWeAreDone(_requestStore, options) {
	return new Promise(function (resolve, reject) {
		_requestStore.get('https://store.steampowered.com/steamawards/nominations', function (error, response, body) {
			var $ = cheerio.load(body);
// will allow skip if you have complete 3 of 4 task.
			if($(".badge_preview.level_4.current").length <= 0 && $(".badge_preview.level_3.current").length <= 0){
				//it did not complete all
				//let see why
				var rowsMissing = [];
				var nomination_rows = $(".nomination_row");
				for (let i = 0; i < nomination_rows.length; i++) {
					const nomination_row = nomination_rows[i];
					var rowjquery = $(nomination_row);
					if(!rowjquery.hasClass('has_nomination')){
						rowsMissing.push(i + 1); // to show human read row number
					}
				}
				var onlyLookAtPlayGameAndReviewTaskStatus = $($(".badge_tasks_right")[0]).find(".badge_task");
				var haveDonePlaygame = onlyLookAtPlayGameAndReviewTaskStatus[0] && $(onlyLookAtPlayGameAndReviewTaskStatus[0]).find(".nominate_check").length > 0 ? "true" : "false";
				var haveDoneReview  = onlyLookAtPlayGameAndReviewTaskStatus[1] && $(onlyLookAtPlayGameAndReviewTaskStatus[1]).find(".nominate_check").length > 0? "true" : "false";
				console.log(options.accountPretty +" did not complete the flow. status: ");
				console.table([
					{massage: "missing nominations rows", status: rowsMissing.join(",")},
					{massage: "have played the game", status: haveDonePlaygame},
					{massage: "have create a review for the game", status: haveDoneReview},
				]);
				reject();
				return;
			}else{
				resolve();
				return;
			}
		});
	});
	
}

Then it will go to next if 3 of 4 task are done.

Then just run node AllRunGame.js

I may be wrong, but I will assume that the module launches the specified game before voting for it. Or before the Steam server processes the data. Therefore, the task does not count.

If the module is restarted, then it does not vote (since it voted earlier), but starts the game. And the task is immediately counted.

But can you tell me if the account look like it is playing the game, when the script is running. The way ASF work is the same way, this script works.

when the script votes, the account has the status "Currently Online". When the script is in the game, then the status "Currently In-Game".

I recorded a short video link
If the video quality is poor, then YouTube has not yet processed it

quer commented

@Magellano you might be right. but then when the script whoud give you the badge when it rerun the 2sec time.
When the script show the table, then it will rerun the script. and start the game agirn. and here you shoud have voted for the game that you play. and then you shoud have it.

but as you can see in your video, you do not get the badge. what you can try is to move the
options.steamUser.gamesPlayed([{ game_id: appid.appid }]);
inside the vote callback. then it have made the vote first.
Before

console.log(appid);
			options.steamUser.gamesPlayed([{ game_id: appid.appid }]);
			vote("52", appid.appid, _requestStore, sessionID, function () {
				//Info wee remove the Review

new

console.log(appid);
			
			vote("52", appid.appid, _requestStore, sessionID, function () {
                                 options.steamUser.gamesPlayed([{ game_id: appid.appid }]);
				//Info wee remove the Review

options.steamUser.gamesPlayed([{ game_id: appid.appid }]);
inside the vote callback. then it have made the vote first.

Now everything seems to work! This is great!
I checked 2 options:

  1. When the script independently selects games for voting;
  2. When the script votes for my chosen games
quer commented

Thanks! i have updated the script, whit the chance.