diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..cbc09b2
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+node-steamcommunity
\ No newline at end of file
diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
new file mode 100644
index 0000000..7fb8ed0
--- /dev/null
+++ b/.idea/codeStyleSettings.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index 15a15b2..97626ba 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -1,4 +1,6 @@
-
+
+
+
\ No newline at end of file
diff --git a/.idea/node-steamcommunity.iml b/.idea/node-steamcommunity.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/node-steamcommunity.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml
new file mode 100644
index 0000000..9338ba6
--- /dev/null
+++ b/.idea/watcherTasks.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/classes/CSteamGroup.js b/classes/CSteamGroup.js
index c200929..8d55a9a 100644
--- a/classes/CSteamGroup.js
+++ b/classes/CSteamGroup.js
@@ -124,6 +124,10 @@ CSteamGroup.prototype.deleteComment = function(cid, callback) {
this._community.deleteGroupComment(this.steamID, cid, callback);
};
+CSteamGroup.prototype.comment = function(message, callback) {
+ this._community.postGroupComment(this.steamID, message, callback);
+};
+
/**
* Get requests to join this restricted group.
* @param {function} callback - First argument is null/Error, second is array of SteamID objects
diff --git a/components/chat.js b/components/chat.js
index 09750e8..adc476a 100644
--- a/components/chat.js
+++ b/components/chat.js
@@ -6,6 +6,11 @@ SteamCommunity.ChatState = require('../resources/EChatState.js');
SteamCommunity.PersonaState = require('../resources/EPersonaState.js');
SteamCommunity.PersonaStateFlag = require('../resources/EPersonaStateFlag.js');
+/**
+ * @deprecated No support for new Steam chat. Use steam-user instead.
+ * @param {int} interval
+ * @param {string} uiMode
+ */
SteamCommunity.prototype.chatLogon = function(interval, uiMode) {
if(this.chatState == SteamCommunity.ChatState.LoggingOn || this.chatState == SteamCommunity.ChatState.LoggedOn) {
return;
@@ -75,6 +80,13 @@ SteamCommunity.prototype.chatLogon = function(interval, uiMode) {
});
};
+/**
+ * @deprecated No support for new Steam chat. Use steam-user instead.
+ * @param {string|SteamID} recipient
+ * @param {string} text
+ * @param {string} [type]
+ * @param {function} [callback]
+ */
SteamCommunity.prototype.chatMessage = function(recipient, text, type, callback) {
if(this.chatState != SteamCommunity.ChatState.LoggedOn) {
throw new Error("Chat must be logged on before messages can be sent");
@@ -120,6 +132,9 @@ SteamCommunity.prototype.chatMessage = function(recipient, text, type, callback)
}, "steamcommunity");
};
+/**
+ * @deprecated No support for new Steam chat. Use steam-user instead.
+ */
SteamCommunity.prototype.chatLogoff = function() {
var self = this;
this.httpRequestPost({
@@ -142,6 +157,9 @@ SteamCommunity.prototype.chatLogoff = function() {
}, "steamcommunity");
};
+/**
+ * @private
+ */
SteamCommunity.prototype._chatPoll = function() {
this.emit('debug', 'Doing chat poll');
@@ -212,6 +230,9 @@ SteamCommunity.prototype._chatPoll = function() {
}, "steamcommunity");
};
+/**
+ * @private
+ */
SteamCommunity.prototype._relogWebChat = function() {
this.emit('debug', "Relogging web chat");
clearTimeout(this._chat.timer);
@@ -219,6 +240,10 @@ SteamCommunity.prototype._relogWebChat = function() {
this.chatLogon(this._chat.interval, this._chat.uiMode);
};
+/**
+ * @param {SteamID} steamID
+ * @private
+ */
SteamCommunity.prototype._chatUpdatePersona = function(steamID) {
if (!this.chatFriends || this.chatState == SteamCommunity.ChatState.Offline) {
return; // we no longer care
diff --git a/components/groups.js b/components/groups.js
index d9a3ef7..ac12794 100644
--- a/components/groups.js
+++ b/components/groups.js
@@ -593,6 +593,30 @@ SteamCommunity.prototype.deleteGroupComment = function(gid, cid, callback) {
}, "steamcommunity");
};
+SteamCommunity.prototype.postGroupComment = function(gid, message, callback) {
+ if (typeof gid === 'string') {
+ gid = new SteamID(gid);
+ }
+
+ var options = {
+ "uri": "https://steamcommunity.com/comment/Clan/post/" + gid.getSteamID64() + "/-1/",
+ "form": {
+ "comment": message,
+ "count": 6,
+ "sessionid": this.getSessionID()
+ }
+ };
+
+ var self = this;
+ this.httpRequestPost(options, function(err, response, body) {
+ if(!callback) {
+ return;
+ }
+
+ callback(err || null);
+ }, "steamcommunity");
+};
+
/**
* Get requests to join a restricted group.
* @param {SteamID|string} gid - The SteamID of the group you want to manage
diff --git a/components/webapi.js b/components/webapi.js
index ee246c2..640860c 100644
--- a/components/webapi.js
+++ b/components/webapi.js
@@ -44,6 +44,10 @@ SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
}, "steamcommunity");
};
+/**
+ * @deprecated No longer works if not logged in via mobile login. Will be removed in a future release.
+ * @param {function} callback
+ */
SteamCommunity.prototype.getWebApiOauthToken = function(callback) {
var self = this;
diff --git a/index.js b/index.js
index c2a15b5..223c194 100644
--- a/index.js
+++ b/index.js
@@ -7,7 +7,7 @@ const RSA = require('node-bignumber').Key;
const SteamID = require('steamid');
const Util = require('util');
-const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36";
+const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36";
Util.inherits(SteamCommunity, EventEmitter);
@@ -251,6 +251,40 @@ SteamCommunity.prototype.oAuthLogin = function(steamguard, token, callback) {
}, "steamcommunity");
};
+/**
+ * Get a token that can be used to log onto Steam using steam-user.
+ * @param {function} callback
+ */
+SteamCommunity.prototype.getClientLogonToken = function(callback) {
+ this.httpRequestGet({
+ "uri": "https://steamcommunity.com/chat/clientjstoken",
+ "json": true
+ }, (err, res, body) => {
+ if (err || res.statusCode != 200) {
+ callback(err ? err : new Error('HTTP error ' + res.statusCode));
+ return;
+ }
+
+ if (!body.logged_in) {
+ let e = new Error('Not Logged In');
+ callback(e);
+ this._notifySessionExpired(e);
+ return;
+ }
+
+ if (!body.steamid || !body.account_name || !body.token) {
+ callback(new Error('Malformed response'));
+ return;
+ }
+
+ callback(null, {
+ "steamID": new SteamID(body.steamid),
+ "accountName": body.account_name,
+ "webLogonToken": body.token
+ });
+ });
+};
+
SteamCommunity.prototype._setCookie = function(cookie, secure) {
var protocol = secure ? "https" : "http";
cookie.secure = !!secure;