mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-24 06:00:07 +08:00
Adding the whitespace back (blame atom.io!)
Converting spaces to tabs.
This commit is contained in:
parent
4152865f5e
commit
d84601e256
@ -6,27 +6,27 @@ SteamCommunity.prototype.getSteamGroup = function(id, callback) {
|
||||
if(typeof id !== 'string' && !(typeof id === 'object' && id.__proto__ === SteamID.prototype)) {
|
||||
throw new Error("id parameter should be a group URL string or a SteamID object");
|
||||
}
|
||||
|
||||
|
||||
if(typeof id === 'object' && (id.universe != SteamID.Universe.PUBLIC || id.type != SteamID.Type.CLAN)) {
|
||||
throw new Error("SteamID must stand for a clan account in the public universe");
|
||||
}
|
||||
|
||||
|
||||
var self = this;
|
||||
this.request("https://steamcommunity.com/" + (typeof id === 'string' ? "groups/" + id : "gid/" + id.toString()) + "/memberslistxml/?xml=1", function(err, response, body) {
|
||||
if(self._checkHttpError(err, response, callback)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(self._checkCommunityError(body, callback)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
xml2js.parseString(body, function(err, result) {
|
||||
if(err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
callback(null, new CSteamGroup(self, result.memberList));
|
||||
});
|
||||
});
|
||||
@ -34,7 +34,7 @@ SteamCommunity.prototype.getSteamGroup = function(id, callback) {
|
||||
|
||||
function CSteamGroup(community, groupData) {
|
||||
this._community = community;
|
||||
|
||||
|
||||
this.steamID = new SteamID(groupData.groupID64[0]);
|
||||
this.name = groupData.groupDetails[0].groupName[0];
|
||||
this.url = groupData.groupDetails[0].groupURL[0];
|
||||
@ -50,7 +50,7 @@ function CSteamGroup(community, groupData) {
|
||||
CSteamGroup.prototype.getAvatarURL = function(size, protocol) {
|
||||
size = size || '';
|
||||
protocol = protocol || 'http://';
|
||||
|
||||
|
||||
var url = protocol + "steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/" + this.avatarHash.substring(0, 2) + "/" + this.avatarHash;
|
||||
if(size == 'full' || size == 'medium') {
|
||||
return url + "_" + size + ".jpg";
|
||||
@ -64,7 +64,7 @@ CSteamGroup.prototype.getMembers = function(addresses, callback) {
|
||||
callback = addresses;
|
||||
addresses = null;
|
||||
}
|
||||
|
||||
|
||||
this._community.getGroupMembers(this.steamID, callback, null, null, addresses, 0);
|
||||
};
|
||||
|
||||
|
@ -19,15 +19,15 @@ function doLogin(accountName, password, authCode, twoFactorCode) {
|
||||
"accountName": accountName,
|
||||
"password": password,
|
||||
"authCode": authCode,
|
||||
"twoFactorCode": twoFactorCode
|
||||
"twoFactorCode": twoFactorCode
|
||||
}, function(err, sessionID, cookies, steamguard) {
|
||||
if(err) {
|
||||
if(err.message == 'SteamGuardMobile') {
|
||||
rl.question("Steam Authenticator Code: ", function(code) {
|
||||
doLogin(accountName, password, null, code);
|
||||
rl.question("Steam Authenticator Code: ", function(code) {
|
||||
doLogin(accountName, password, null, code);
|
||||
});
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if(err.message == 'SteamGuard') {
|
||||
@ -46,34 +46,34 @@ function doLogin(accountName, password, authCode, twoFactorCode) {
|
||||
|
||||
console.log("Logged on!");
|
||||
|
||||
rl.question("Group ID: ", function(gid) {
|
||||
community.getSteamGroup(gid, function(err, group) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
rl.question("Group ID: ", function(gid) {
|
||||
community.getSteamGroup(gid, function(err, group) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
rl.question("Annoucement ID: ", function(aid) {
|
||||
rl.question("New title: ", function(header) {
|
||||
rl.question("New body: ", function(content) {
|
||||
// EW THE PYRAMID!
|
||||
editAnnouncement(group, aid, header, content);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
rl.question("Annoucement ID: ", function(aid) {
|
||||
rl.question("New title: ", function(header) {
|
||||
rl.question("New body: ", function(content) {
|
||||
// EW THE PYRAMID!
|
||||
editAnnouncement(group, aid, header, content);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function editAnnouncement(group, aid, header, content) {
|
||||
// Actual community method.
|
||||
group.editAnnouncement(aid, header, content, function(error) {
|
||||
if(!error) {
|
||||
console.log("Annoucement edited!");
|
||||
} else {
|
||||
console.log("Unable to edit annoucement! %j", error);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
// Actual community method.
|
||||
group.editAnnouncement(aid, header, content, function(error) {
|
||||
if(!error) {
|
||||
console.log("Annoucement edited!");
|
||||
} else {
|
||||
console.log("Unable to edit annoucement! %j", error);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user