-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoinallgroup.js
59 lines (53 loc) · 1.88 KB
/
joinallgroup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// ==UserScript==
// @name Join all groups on a profile
// @namespace http://tampermonkey.net/
// @version 0.1.5
// @description Join all of someone's steam groups quickly
// @author hoocs
// @match *://steamcommunity.com/id/*
// @match *://steamcommunity.com/profiles/*
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @grant none
// @license MIT1
// ==/UserScript==
function JoinProfilesGroups() {
let steamID = g_rgProfileData?.steamid || "";
let sessionID = g_sessionID || "";
if (!steamID || !sessionID) {
console.log("Could not retrieve steamID or sessionID.");
return;
}
$.ajax({
url: 'https://steamcommunity.com/profiles/' + steamID + '/?xml=1',
type: 'GET',
dataType: 'xml'
}).done(function(xml) {
let groupIDs = [];
$(xml).find('groupID64').each(function() {
groupIDs.push($(this).text());
});
let joinRequests = groupIDs.map(groupID => {
return $.ajax({
url: 'https://steamcommunity.com/gid/' + groupID,
type: 'POST',
dataType: 'json',
data: { action: 'join', sessionID: sessionID },
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).done(function(data) {
console.log('Joined Group:', groupID);
}).fail(function() {
console.log('Error joining group:', groupID);
});
});
Promise.all(joinRequests).then(() => {
console.log('All group join requests processed.');
}).catch(() => {
console.log('Some group join requests failed.');
});
}).fail(function() {
console.log('Failed to retrieve group list. Check if the profile is public.');
});
}
JoinProfilesGroups();