Skip to content

Commit

Permalink
add Follow Games, Follow Curators
Browse files Browse the repository at this point in the history
 * Follow Games
 * Unfollow Games
 * Follow Curators
 * UnFollow Curators
  • Loading branch information
quer committed Dec 17, 2021
1 parent 801fdf2 commit 608555a
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Just add more account in the config.
* remove all game from wishlist
* Give Awared/Rewards ( GiveSteamAward.js )
* Create badge (createBadge.js)
* Follow Games
* Unfollow Games
* Follow Curators
* UnFollow Curators

# Events
Events modules are stored in `modules/events`
Expand Down
51 changes: 51 additions & 0 deletions modules/FollowCurators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
var CuratorIds = [
33075774,
40954427
]
var timeBetweenEachRequest = 2000; //2sec
module.exports = async function(steamClient, RequestCommunity, RequestStore, SessionID, options, callback){
for (let i = 0; i < CuratorIds.length; i++) {
const clanid = CuratorIds[i];
try {
await FollowCurator(RequestStore, SessionID, clanid);
} catch (error) {
console.log(options.accountPretty+" error Following Curator, and will be skipped, CuratorId: "+clanid);
console.log(error)
}
await Wait(timeBetweenEachRequest);
}
callback();
}

function FollowCurator(RequestStore, SessionID, clanid) {
return new Promise(function (resolve, reject) {
RequestStore.post({
url: "https://store.steampowered.com/curators/ajaxfollow",
form:{
clanid: clanid,
sessionid: SessionID,
follow: 1
}
}, function (error, response, body) {
if(error){
reject(error)
return;
}
try {
var response = JSON.parse(body)
if(response.success.success == 1){
resolve();
return;
}
} catch (error) {

}
reject();
});
})
}
function Wait(time) {
return new Promise((resolve) => {
setTimeout(() => resolve(), time)
});
}
45 changes: 45 additions & 0 deletions modules/FollowGame.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var appsToFollow = [
730,
440
]
var timeBetweenEachRequest = 2000; //2sec
module.exports = async function(steamClient, RequestCommunity, RequestStore, SessionID, options, callback){
for (let i = 0; i < appsToFollow.length; i++) {
const appId = appsToFollow[i];
try {
await FollowGame(RequestStore, SessionID, appId);
} catch (error) {
console.log(options.accountPretty+" error Following Game, and will be skipped, appid: "+appId);
console.log(error)
}
await Wait(timeBetweenEachRequest);
}
callback();
}

function FollowGame(RequestStore, SessionID, appId) {
return new Promise(function (resolve, reject) {
RequestStore.post({
url: "https://store.steampowered.com/explore/followgame/",
form:{
appid: appId,
sessionid: SessionID
}
}, function (error, response, body) {
if(error){
reject(error)
return;
}
if(body == "true"){
resolve();
return;
}
reject();
});
})
}
function Wait(time) {
return new Promise((resolve) => {
setTimeout(() => resolve(), time)
});
}
52 changes: 52 additions & 0 deletions modules/UnFollowCurators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//this file look the same as "FollowCurators.js", but the request have a "follow: 0".
var CuratorIds = [
33075774,
40954427
]
var timeBetweenEachRequest = 2000; //2sec
module.exports = async function(steamClient, RequestCommunity, RequestStore, SessionID, options, callback){
for (let i = 0; i < CuratorIds.length; i++) {
const clanid = CuratorIds[i];
try {
await UnFollowCurator(RequestStore, SessionID, clanid);
} catch (error) {
console.log(options.accountPretty+" error Following Curator, and will be skipped, CuratorId: "+clanid);
console.log(error)
}
await Wait(timeBetweenEachRequest);
}
callback();
}

function UnFollowCurator(RequestStore, SessionID, clanid) {
return new Promise(function (resolve, reject) {
RequestStore.post({
url: "https://store.steampowered.com/curators/ajaxfollow",
form:{
clanid: clanid,
sessionid: SessionID,
follow: 0
}
}, function (error, response, body) {
if(error){
reject(error)
return;
}
try {
var response = JSON.parse(body)
if(response.success.success == 1){
resolve();
return;
}
} catch (error) {

}
reject();
});
})
}
function Wait(time) {
return new Promise((resolve) => {
setTimeout(() => resolve(), time)
});
}
47 changes: 47 additions & 0 deletions modules/UnFollowGame.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//this file look the same as "FollowGame.js", but the request have a "unfollow: 1".
var appsToUnFollow = [
730,
440
]
var timeBetweenEachRequest = 2000; //2sec
module.exports = async function(steamClient, RequestCommunity, RequestStore, SessionID, options, callback){
for (let i = 0; i < appsToUnFollow.length; i++) {
const appId = appsToUnFollow[i];
try {
await FollowGame(RequestStore, SessionID, appId);
} catch (error) {
console.log(options.accountPretty+" error Following Game, and will be skipped, appid: "+appId);
console.log(error)
}
await Wait(timeBetweenEachRequest);
}
callback();
}

function FollowGame(RequestStore, SessionID, appId) {
return new Promise(function (resolve, reject) {
RequestStore.post({
url: "https://store.steampowered.com/explore/followgame/",
form:{
appid: appId,
sessionid: SessionID,
unfollow: 1
}
}, function (error, response, body) {
if(error){
reject(error)
return;
}
if(body == "true"){
resolve();
return;
}
reject();
});
})
}
function Wait(time) {
return new Promise((resolve) => {
setTimeout(() => resolve(), time)
});
}

0 comments on commit 608555a

Please sign in to comment.