How to use steamid - 10 common examples

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-steam-user / components / logon.js View on Github external
parental.steamid = sid;
			}

			if (!this.steamID && body.client_supplied_steamid) {
				// This should ordinarily not happen. this.steamID is supposed to be set in messages.js according to
				// the SteamID in the message header. But apparently, sometimes Steam doesn't set that SteamID
				// appropriately in the log on response message. ¯\_(ツ)_/¯
				this.steamID = new SteamID(body.client_supplied_steamid);
			}

			this.emit('loggedOn', body, parental);
			this.emit('contentServersReady');

			this._getChangelistUpdate();

			if (this.steamID.type == SteamID.Type.INDIVIDUAL) {
				this._requestNotifications();

				if (body.webapi_authenticate_user_nonce) {
					this._webAuthenticate(body.webapi_authenticate_user_nonce);
				}
			} else if (this.steamID.type == SteamID.Type.ANON_USER) {
				this._getLicenseInfo();
			}

			this._heartbeatInterval = setInterval(() => {
				this._send(SteamUser.EMsg.ClientHeartBeat, {});
			}, body.out_of_game_heartbeat_seconds * 1000);

			break;

		case EResult.AccountLogonDenied:
github DoctorMcKay / node-steam-user / components / friends.js View on Github external
SteamUser.prototype._handlerManager.add('PlayerClient.NotifyFriendNicknameChanged#1', function(body) {
	let sid = SteamID.fromIndividualAccountID(body.accountid);
	this.emit('nickname', sid, body.nickname || null);
	if (!body.nickname) {
		// removal
		delete this.myNicknames[sid.getSteamID64()];
	} else {
		this.myNicknames[sid.getSteamID64()] = body.nickname;
	}
});
github DoctorMcKay / node-steam-user / components / logon.js View on Github external
if (this._logOnDetails.login_key) {
				// Steam doesn't send a new loginkey all the time if you're using a persistent one (remember password). Let's manually emit it on a timer to handle any edge cases.
				this._loginKeyTimer = setTimeout(() => {
					this.emit('loginKey', this._logOnDetails.login_key);
				}, 5000);
			}

			this._saveFile('cellid-' + Helpers.getInternalMachineID() + '.txt', body.cell_id);

			let parental = body.parental_settings ? Messages.decodeProto(Schema.ParentalSettings, body.parental_settings) : null;
			if (parental && parental.salt && parental.passwordhash) {
				let sid = new SteamID();
				sid.universe = this.steamID.universe;
				sid.type = SteamID.Type.INDIVIDUAL;
				sid.instance = SteamID.Instance.DESKTOP;
				sid.accountid = parental.steamid.low;
				parental.steamid = sid;
			}

			if (!this.steamID && body.client_supplied_steamid) {
				// This should ordinarily not happen. this.steamID is supposed to be set in messages.js according to
				// the SteamID in the message header. But apparently, sometimes Steam doesn't set that SteamID
				// appropriately in the log on response message. ¯\_(ツ)_/¯
				this.steamID = new SteamID(body.client_supplied_steamid);
			}

			this.emit('loggedOn', body, parental);
			this.emit('contentServersReady');

			this._getChangelistUpdate();
github DoctorMcKay / node-steamcommunity / components / groups.js View on Github external
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
			var dateParts = $item.find('.historyDate').text().split('@');
			var date = dateParts[0].trim().replace(/(st|nd|th)$/, '').trim() + ', ' + currentYear;
			var time = dateParts[1].trim().replace(/(am|pm)/, ' $1');

			date = new Date(date + ' ' + time + ' UTC');

			// If this date is in the future, or it's later than the previous one, decrement the year
			if(date.getTime() > lastDate) {
				date.setFullYear(date.getFullYear() - 1);
			}
github DoctorMcKay / node-steamcommunity / components / groups.js View on Github external
SteamCommunity.prototype.getGroupMembers = function(gid, callback, members, link, addresses, addressIdx) {
	members = members || [];

	if (!link) {
		if (typeof gid !== 'string') {
			// It's a SteamID object
			link = "http://steamcommunity.com/gid/" + gid.toString() + "/memberslistxml/?xml=1";
		} else {
			try {
				var sid = new SteamID(gid);
				if (sid.type == SteamID.Type.CLAN && sid.isValid()) {
					link = "http://steamcommunity.com/gid/" + sid.getSteamID64() + "/memberslistxml/?xml=1";
				} else {
					throw new Error("Doesn't particularly matter what this message is");
				}
			} catch (e) {
				link = "http://steamcommunity.com/groups/" + gid + "/memberslistxml/?xml=1";
			}
		}
	}

	addressIdx = addressIdx || 0;

	var options = {};
	options.uri = link;

	if(addresses) {
github scholtzm / punk / src / plugins / personastate / index.js View on Github external
}, (persona) => {
    const id = new SteamID(persona.friendid);

    // they use these for groups too, we will ignore them for now
    // perhaps this information can be used later
    if(id.type === SteamID.Type.CLAN) {
      return;
    }

    // get old data if we have them
    const currentFriend = FriendsStore.getById(persona.friendid) || EMPTY_FRIEND;

    // request new data if we are missing avatar
    const requestNewData = persona.avatar_hash === undefined;

    // fix persona since not all fields are sent by Steam
    persona.persona_state = persona.persona_state === undefined
      ? currentFriend.persona.persona_state || Steam.EPersonaState.Offline
      : persona.persona_state;
    // this is sometimes empty even if the other user is playing a game; no idea why
    persona.game_name = persona.game_name || currentFriend.persona.game_name || '';
    persona.gameid = persona.gameid || currentFriend.persona.gameid || '0';
github DoctorMcKay / node-steam-user / components / chat.js View on Github external
SteamUser.prototype.chatMessage = SteamUser.prototype.chatMsg = function(recipient, message, type) {
	recipient = Helpers.steamID(recipient);

	type = type || SteamUser.EChatEntryType.ChatMsg;

	if ([SteamID.Type.CLAN, SteamID.Type.CHAT].indexOf(recipient.type) != -1) {
		// It's a chat message
		var msg = new ByteBuffer(8 + 8 + 4 + Buffer.byteLength(message) + 1, ByteBuffer.LITTLE_ENDIAN);
		msg.writeUint64(this.steamID.getSteamID64()); // steamIdChatter
		msg.writeUint64(toChatID(recipient).getSteamID64()); // steamIdChatRoom
		msg.writeUint32(type); // chatMsgType
		msg.writeCString(message);
		this._send(SteamUser.EMsg.ClientChatMsg, msg.flip());
	} else {
		// It's a friend message
		var payload = new ByteBuffer(Buffer.byteLength(message) + 1, ByteBuffer.LITTLE_ENDIAN);
		payload.writeCString(message);

		this._send(SteamUser.EMsg.ClientFriendMsg, {
			"steamid": recipient.getSteamID64(),
			"message": payload.flip(),
			"chat_entry_type": type
github DoctorMcKay / node-steam-user / components / logon.js View on Github external
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-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-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

steamid

Exposes a SteamID object class for easy SteamID management

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis