How to use the steamid.Type 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-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-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 dragonbanshee / node-steam-chat-bot / lib / triggers / banTrigger.js View on Github external
BanTrigger.prototype._stripCommand = function(message) {
	if (this.options.command && message && message.toLowerCase().indexOf(this.options.command.toLowerCase() + " ") === 0) {
		var params = message.split(" ");
		var parsed = {};
		for (var i = 0; i
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-tf2 / index.js View on Github external
TeamFortress2.prototype._isServer = function() {
	let serverTypes = [SteamID.Type.ANON_GAMESERVER, SteamID.Type.GAMESERVER];
	return this._steam.steamID && serverTypes.includes(this._steam.steamID.type);
};
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});
		});
	});
github DoctorMcKay / node-steam-user / components / chat.js View on Github external
function fromChatID(steamID) {
	steamID = Helpers.steamID(steamID);

	if (steamID.isGroupChat()) {
		steamID.type = SteamID.Type.CLAN;
		steamID.instance &= ~SteamID.ChatInstanceFlags.Clan;
	}

	return steamID;
}

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