quer/the-steam-awards

[REQUEST] Sending comments on Sharedfiles from a .txt

SENPAY98K opened this issue · 14 comments

Hi,
I could not find any script for commenting on steam sharedfiles such as artworks, screenshots and guide from a .txt file.
Something that randomly choose a line from a txt file and send it in comments of a steam sharedfile. 😃
Is it possible to make a module for it ? Thanks so much. ❤️

quer commented

did a guick look for commenting on a guide. For some reason, to add a comment, you must post to a url like:
https://steamcommunity.com/comment/PublishedFile_Public/post/76561197990233572/923012519/
where the last is the guide id. and the second last is the steamID of the account that created the guide. whit is wierd.

and from what i can tell, it there no easy way to get the owner of the guides steamid.
eks see this guide:
https://steamcommunity.com/sharedfiles/filedetails/?id=923012519
here the owner id is '76561197990233572', be there is no consisting way to get the value.

and the the request need to look like:
image
and all that data is also store in the source code on the page. and there is not consisting to get that also.

so i dont think i will create a module for it. at least not at the moment.

quer commented

you can allway create it your self, i have made a guide in the wiki, where i try to explain how it is done

you said there is no easy way to get owner id? i we can get manually and put it in a config for at the top of the file var id = 76xxxx + var guideid = 92....

I will try to follow you instruction to make the module, then i i will post it here for you to revise it when you have time.
Thanks so much

I followed your guide and copied some of the modules, here's what i made so far:

module.exports = function(steamClient, RequestCommunity, RequestStore, SessionID, options, callback){

	var ss = "testing";
	var steamid= "76561198097242611";
	var shareFileID = 2385237451;
	var url = "https://steamcommunity.com/comment/PublishedFile_Public/post/"+steamid+"/"+shareFileID+"/";
	
		RequestCommunity.post({
			url: url,
			form:{
				comment: ss,
				count: 10,
				sessionid: SessionID,
				feature2: -1
			}
		}, function (error, response, body) {
			console.log(body);
			var i = 0;
			++i;
			setTimeout(function () {
				callback();
			}, 500);
		});
};

It worked fine but all accounts comments are the same as defined in ss

image

Is there anything to make each account use a line from a text file ?
Also we need to delay between comments because steam have rate limits.

quer commented

Nice to see, you followed the guide.

you can create a Variable outside the function. that will act like a static. as it do not get reset between each account. then you can just create a list, or import one. and then just increase the index for each account, like the module
https://github.com/quer/the-steam-awards/blob/master/modules/profileComment.js
where each account will take the next index, and comment on a profile.

you can make so it load from a file, or create array.

When you call the callback, just add a timeout on it before you call it. like in module:
https://github.com/quer/the-steam-awards/blob/master/modules/guideVoteLikeShare.js

Nice to see, you followed the guide.

you can create a Variable outside the function. that will act like a static. as it do not get reset between each account. then you can just create a list, or import one. and then just increase the index for each account, like the module
https://github.com/quer/the-steam-awards/blob/master/modules/profileComment.js
where each account will take the next index, and comment on a profile.

you can make so it load from a file, or create array.

When you call the callback, just add a timeout on it before you call it. like in module:
https://github.com/quer/the-steam-awards/blob/master/modules/guideVoteLikeShare.js

Thats really advanced thing to do for someone with know nothing in js 🙃

quer commented

okay, let me help you a bit.
Use this code,

const fs = require('fs');
const dataFromFile = fs.readFileSync('./textFile.txt', {encoding:'utf8', flag:'r'});
var text = dataFromFile .split("\n"); // will make a array, whit each row from the file
var i = 0; // to store what index to take next
module.exports = function(steamClient, RequestCommunity, RequestStore, SessionID, options, callback){

	
	var steamid= "76561198097242611";
	var shareFileID = 2385237451;
	var url = "https://steamcommunity.com/comment/PublishedFile_Public/post/"+steamid+"/"+shareFileID+"/";
	
		RequestCommunity.post({
			url: url,
			form:{
				comment: text[i] ,
				count: 10,
				sessionid: SessionID,
				feature2: -1
			}
		}, function (error, response, body) {
			console.log(body);

			++i; // will make sure the next account use the next index
			setTimeout(function () {
				callback();
			}, 500);
		});
};

the only thing here, it will die, if there is more account then text line

i did not test this, but is shoud more or less work

quer commented

Thank to @TioTiago for the example, i have added that one to the list.
d75466c

Thanks a lot for the help, its work very smooth.
I just want to add that the line feed \n does not work

Example:

image

Should be look like this if it reads that line feed \n

image

I even tried \r and \r\n and \n\r but none of them would work

image

Any idea about multilines comments ?

use this: https://github.com/quer/the-steam-awards/blob/master/modules/CommentGuide.js worked fine here, example:

var list = [
    `♥ l、 
    (゚、 。 7 ♥ 
     l、 ~ヽ 
     じしf_, )ノ`,
    "Have a nice week!",
    "Rep+",
    "Nice work",
];

image

I would like to, but i have made a lot of different ascii quotes in .txt files
It really help me managing comments correctly..
Anyway i will try adding

var list = [ `

];

in the .txt file and see

quer commented

Hey, a easy way, to do this is eks like this:

const fs = require('fs');
const dataFromFile = fs.readFileSync('./textFile.txt', {encoding:'utf8', flag:'r'});
eval(dataFromFile )

where in content of the file is like:

var list = [
    `♥ l、 
    (゚、 。 7 ♥ 
     l、 ~ヽ 
     じしf_, )ノ`,
    "Have a nice week!",
    "Rep+",
    "Nice work",
];

then what is happing here, is the fs.readFileSync will load the file in to as text into dataFromFile and then the eval will run the text as if it was js code.

eks, where is a simple 2 line code, where the eval is given a string that is js code. then it will run and create the propperty x, whit value 10. and then it can be used in the code it self

eval("var x = 10")
console.log(x);

that way, you can create the hole var list = [
xxxx,
xxxx,
xxx
]
in a file and just inject it into code

Did not work for me (i could not set idk), so i referd back the list in same module using \n to for multilines.. guess what? it worked.
Now i will just create many of the module with names of my comments packs and paste them inside each one.
Thanks a lot guys for the help