How to use the steamid.Universe function in steamid

To help you get started, we’ve selected a few steamid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DoctorMcKay / node-steamcommunity / components / groups.js View on Github external
Array.prototype.forEach.call($('.historyItem, .historyItemb'), function(item) {
			var data = {};

			var $item = $(item);
			data.type = $item.find('.historyShort').text().replace(/ /g, '');

			var users = $item.find('.whiteLink[data-miniprofile]');
			var sid;
			if(users[0]) {
				sid = new SteamID();
				sid.universe = SteamID.Universe.PUBLIC;
				sid.type = SteamID.Type.INDIVIDUAL;
				sid.instance = SteamID.Instance.DESKTOP;
				sid.accountid = $(users[0]).data('miniprofile');
				data.user = sid;
			}

			if(users[1]) {
				sid = new SteamID();
				sid.universe = SteamID.Universe.PUBLIC;
				sid.type = SteamID.Type.INDIVIDUAL;
				sid.instance = SteamID.Instance.DESKTOP;
				sid.accountid = $(users[1]).data('miniprofile');
				data.actor = sid;
			}

			// Figure out the date. Of course there's no year, because Valve
github DoctorMcKay / node-steam-user / components / chatroom.js View on Github external
return StdLib.Promises.callbackPromise(null, callback, (resolve, reject) => {
		clanSteamID = Helpers.steamID(clanSteamID);
		if (clanSteamID.type != SteamID.Type.CLAN) {
			return reject(new Error("SteamID is not for a clan"));
		}

		// just set these to what they should be
		clanSteamID.universe = SteamID.Universe.PUBLIC;
		clanSteamID.instance = SteamID.Instance.ALL;

		this.user._sendUnified("ClanChatRooms.GetClanChatRoomInfo#1", {
			"steamid": clanSteamID.toString(),
			"autocreate": true
		}, (body, hdr) => {
			if (hdr.proto.eresult == EResult.Busy) {
				// Why "Busy"? Because Valve.
				let err = new Error("Invalid clan ID");
				err.eresult = hdr.proto.eresult;
				return reject(err);
			}

			let err = Helpers.eresultError(hdr.proto);
			if (err) {
				return reject(err);
github DoctorMcKay / node-steam-user / components / logon.js View on Github external
// Machine ID
		if (!anonLogin && !this._logOnDetails.machine_id) {
			this._logOnDetails.machine_id = this._getMachineID(machineID);
		}

		// Do the login
		if (this._logOnDetails._steamid) {
			let sid = this._logOnDetails._steamid;
			if (typeof sid == 'string') {
				sid = new SteamID(sid);
			}

			this._tempSteamID = sid;
		} else {
			let sid = new SteamID();
			sid.universe = SteamID.Universe.PUBLIC;
			sid.type = anonLogin ? SteamID.Type.ANON_USER : SteamID.Type.INDIVIDUAL;
			sid.instance = anonLogin ? SteamID.Instance.ALL : SteamID.Instance.DESKTOP;
			sid.accountid = 0;
			this._tempSteamID = sid;
		}

		if (anonLogin && this._logOnDetails.password) {
			process.stderr.write("[steam-user] Warning: Logging into anonymous Steam account but a password was specified... did you specify your accountName improperly?\n");
		}

		this._doConnection();
	});
};
github DoctorMcKay / node-steamcommunity / components / chat.js View on Github external
(body.messages || []).forEach(function(message) {
			var sender = new SteamID();
			sender.universe = SteamID.Universe.PUBLIC;
			sender.type = SteamID.Type.INDIVIDUAL;
			sender.instance = SteamID.Instance.DESKTOP;
			sender.accountid = message.accountid_from;

			switch(message.type) {
				case 'personastate':
					self._chatUpdatePersona(sender);
					break;

				case 'saytext':
					self.emit('chatMessage', sender, message.text);
					break;

				case 'typing':
					self.emit('chatTyping', sender);
					break;
github DoctorMcKay / node-globaloffensive / index.js View on Github external
GlobalOffensive.prototype.requestLiveGameForUser = function(steamid) {
	if (typeof steamid === 'string') {
		steamid = new SteamID(steamid);
	}

	if (!steamid.isValid() || steamid.universe != SteamID.Universe.PUBLIC || steamid.type != SteamID.Type.INDIVIDUAL || steamid.instance != SteamID.Instance.DESKTOP) {
		return false;
	}

	this._send(Language.MatchListRequestLiveGameForUser, Protos.CMsgGCCStrike15_v2_MatchListRequestLiveGameForUser, {
		accountid: steamid.accountid
	});
};
github DoctorMcKay / node-steamcommunity / classes / CSteamUser.js View on Github external
SteamCommunity.prototype.getSteamUser = function(id, callback) {
	if(typeof id !== 'string' && !Helpers.isSteamID(id)) {
		throw new Error("id parameter should be a user URL string or a SteamID object");
	}

	if(typeof id === 'object' && (id.universe != SteamID.Universe.PUBLIC || id.type != SteamID.Type.INDIVIDUAL)) {
		throw new Error("SteamID must stand for an individual account in the public universe");
	}

	var self = this;
	this.httpRequest("http://steamcommunity.com/" + (typeof id === 'string' ? "id/" + id : "profiles/" + id.toString()) + "/?xml=1", function(err, response, body) {
		if (err) {
			callback(err);
			return;
		}

		xml2js.parseString(body, function(err, result) {
			if(err || (!result.response && !result.profile)) {
				callback(err || new Error("No valid response"));
				return;
			}
github DoctorMcKay / node-steamcommunity / classes / CSteamGroup.js View on Github external
SteamCommunity.prototype.getSteamGroup = function(id, callback) {
	if(typeof id !== 'string' && !Helpers.isSteamID(id)) {
		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.httpRequest("https://steamcommunity.com/" + (typeof id === 'string' ? "groups/" + id : "gid/" + id.toString()) + "/memberslistxml/?xml=1", function(err, response, body) {
		if (err) {
			callback(err);
			return;
		}

		xml2js.parseString(body, function(err, result) {
			if(err) {
				callback(err);
				return;
			}
github DoctorMcKay / node-steam-user / components / friends.js View on Github external
this._send(SteamUser.EMsg.ClientFSGetFriendsSteamLevels, {"accountids": accountids}, (body) => {
			let output = {};

			let sid = new SteamID();
			sid.universe = SteamID.Universe.PUBLIC;
			sid.type = SteamID.Type.INDIVIDUAL;
			sid.instance = SteamID.Instance.DESKTOP;

			(body.friends || []).forEach((user) => {
				sid.accountid = user.accountid;
				output[sid.getSteamID64()] = user.level;
			});

			accept({"users": output});
		});
	});

steamid

Exposes a SteamID object class for easy SteamID management

MIT
Latest version published 4 months ago

Package Health Score

69 / 100
Full package analysis