Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Steam = require("steam");
- var SteamUser = require('steam-user'); // Replace this with `require('steam-user');` if used outside of the module directory
- var client = new SteamUser();
- var friends = new Steam.SteamFriends(client.client);
- client.logOn({
- "accountName": "Username",
- "password": "password"
- });
- client.on('loggedOn', function(details) {
- console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
- client.setPersona(SteamUser.Steam.EPersonaState.Online);
- client.gamesPlayed(440);
- });
- client.on('error', function(e) {
- // Some error occurred during logon
- console.log("WARNING: Error found in the Code");
- });
- client.on('webSession', function(sessionID, cookies) {
- console.log("Got web session");
- // Do something with these cookies if you wish
- });
- client.on('newItems', function(count) {
- console.log(count + " new items in our inventory");
- });
- client.on('emailInfo', function(address, validated) {
- console.log("Our email address is " + address + " and it's " + (validated ? "validated" : "not validated"));
- });
- client.on('wallet', function(hasWallet, currency, balance) {
- console.log("Our wallet balance is " + SteamUser.formatCurrency(balance, currency));
- });
- client.on('accountLimitations', function(limited, communityBanned, locked, canInviteFriends) {
- var limitations = [];
- if(limited) {
- limitations.push('LIMITED');
- }
- if(communityBanned) {
- limitations.push('COMMUNITY BANNED');
- }
- if(locked) {
- limitations.push('LOCKED');
- }
- if(limitations.length === 0) {
- console.log("Our account has no limitations.");
- } else {
- console.log("Our account is " + limitations.join(', ') + ".");
- }
- if(canInviteFriends) {
- console.log("Our account can invite friends.");
- }
- });
- client.on('vacBans', function(numBans, appids) {
- console.log("We have " + numBans + " VAC ban" + (numBans == 1 ? '' : 's') + ".");
- if(appids.length > 0) {
- console.log("We are VAC banned from apps: " + appids.join(', '));
- }
- });
- client.on('licenses', function(licenses) {
- console.log("Our account owns " + licenses.length + " license" + (licenses.length == 1 ? '' : 's') + ".");
- });
- // Messages:
- friends.on("friendMsg", function(user, msg, type){
- if(type == Steam.EChatEntryType.ChatMsg){
- if(msg == "ping"){
- friends.sendMessage(user, "Pong!");
- }
- if(msg == "hello"){
- friends.sendMessage(user, "Hello!");
- }
- if(msg == "how are you"){
- friends.sendMessage(user, "Im doing great!");
- }
- if(msg == "would you like to trade?"){
- friends.sendMessage(user, "Yes, No low ball offers I will decline! What are you looking at trading?");
- }
- if(msg == "check your trade offers"){
- friends.sendMessage(user, "I already have!");
- }
- if(msg == "Would you like to trade?"){
- friends.sendMessage(user, "Yes, No low ball offers I will decline! What are you looking at trading?");
- }
- if(msg == "would you like to trade"){
- friends.sendMessage(user, "Yes, No low ball offers I will decline! What are you looking at trading?");
- }
- else(msg == ""){
- friends.sendMessage(user, "My responses are limited please ask the right questions. :)");
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement