mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-24 06:00:07 +08:00
Added CSteamUser#inviteToGroup and SteamCommunity#inviteUserToGroup
This commit is contained in:
parent
3db3d47e92
commit
3d0522a560
@ -130,3 +130,7 @@ CSteamUser.prototype.unblockCommunication = function(callback) {
|
||||
CSteamUser.prototype.comment = function(message, callback) {
|
||||
this._community.postUserComment(this.steamID, message, callback);
|
||||
};
|
||||
|
||||
CSteamUser.prototype.inviteToGroup = function(groupID, callback) {
|
||||
this._community.inviteUserToGroup(this.steamID, groupID, callback);
|
||||
};
|
||||
|
@ -1,6 +1,11 @@
|
||||
var SteamCommunity = require('../index.js');
|
||||
var SteamID = require('steamid');
|
||||
|
||||
SteamCommunity.prototype.addFriend = function(userID, callback) {
|
||||
if(typeof userID === 'string') {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.request.post({
|
||||
"uri": "https://steamcommunity.com/actions/AddFriendAjax",
|
||||
@ -28,6 +33,10 @@ SteamCommunity.prototype.addFriend = function(userID, callback) {
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.acceptFriendRequest = function(userID, callback) {
|
||||
if(typeof userID === 'string') {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.request.post({
|
||||
"uri": "https://steamcommunity.com/actions/AddFriendAjax",
|
||||
@ -50,6 +59,10 @@ SteamCommunity.prototype.acceptFriendRequest = function(userID, callback) {
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.removeFriend = function(userID, callback) {
|
||||
if(typeof userID === 'string') {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.request.post({
|
||||
"uri": "https://steamcommunity.com/actions/RemoveFriendAjax",
|
||||
@ -71,6 +84,10 @@ SteamCommunity.prototype.removeFriend = function(userID, callback) {
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.blockCommunication = function(userID, callback) {
|
||||
if(typeof userID === 'string') {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.request.post({
|
||||
"uri": "https://steamcommunity.com/actions/BlockUserAjax",
|
||||
@ -92,6 +109,10 @@ SteamCommunity.prototype.blockCommunication = function(userID, callback) {
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.unblockCommunication = function(userID, callback) {
|
||||
if(typeof userID === 'string') {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
var form = {"action": "unignore"};
|
||||
form['friends[' + userID.toString() + ']'] = 1;
|
||||
|
||||
@ -110,6 +131,10 @@ SteamCommunity.prototype.unblockCommunication = function(userID, callback) {
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.postUserComment = function(userID, message, callback) {
|
||||
if(typeof userID === 'string') {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.request.post({
|
||||
"uri": "https://steamcommunity.com/comment/Profile/post/" + userID.toString() + "/-1",
|
||||
@ -136,4 +161,39 @@ SteamCommunity.prototype.postUserComment = function(userID, message, callback) {
|
||||
callback(new Error("Unknown error"));
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.inviteUserToGroup = function(userID, groupID, callback) {
|
||||
if(typeof userID === 'string') {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.request.post({
|
||||
"uri": "https://steamcommunity.com/actions/GroupInvite",
|
||||
"form": {
|
||||
"group": groupID.toString(),
|
||||
"invitee": userID.toString(),
|
||||
"json": 1,
|
||||
"sessionID": this.getSessionID(),
|
||||
"type": "groupInvite"
|
||||
},
|
||||
"json": true
|
||||
}, function(err, response, body) {
|
||||
if(!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(self._checkHttpError(err, response, callback)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(body.results == 'OK') {
|
||||
callback(null);
|
||||
} else if(body.results) {
|
||||
callback(new Error(body.results));
|
||||
} else {
|
||||
callback(new Error("Unknown error"));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user