Jump to content
McKay Development

Vanilla

Member
  • Posts

    73
  • Joined

  • Last visited

Posts posted by Vanilla

  1. How can i get my summary profile?

    var id = ""; //either SteamID Object or customURL after /id/
    community.getSteamUser(id, function (err, user){
    	if (err){
    		console.log(err); //some error
    	}
    	else {
    		console.log(user.summary);
    	}
    });
    
  2.  

    one more question, can I erase the friendship after a while? for example, my bot accepts the friendship today at 1:00 p.m. and erases the friendship tomorrow at 1:00 p.m.?
     
    What is the code for this to work?

     

     

    You might need a database for that (like Oracle, MySQL, MonggoDB).

    I'm not sure how to do that though

  3.  

    I do not think you understood my objective.
    I want that when the person adds me to appear in the chat of the person
    Hello (here the name of the person who added me)! Thanks for add me, if you need help write! Help

     

     

    Like I said above, variable "name" is now availabe to use in above code

    Just add this code above console.log

    client.chatMessage(steamid, 'Hello ' +name+ ', thanks for add me, if you need help write !help'); 
    
  4. client.on('friendRelationship', (steamid, relationship) => {
        if (relationship === 2) {
            client.addFriend(steamid);
            client.chatMessage(steamid, 'Hello! Thanks for add me, if you need help write !help');
            
            //getting name using getPersonas
            client.getPersonas([steamid], function(personas) {
                 var persona = personas[steamid.getSteamID64()];
                 var name = persona ? persona.player_name : ("[" + steamid.getSteamID64() + "]");
    
                 //You can use 'name' to show their name
                 console.log("You add: " + name + " - " +steamid);
            });
        }
    });
    

    Pretty much like this

  5. Hello, I was wondering if it's possible to know if friend-request has been accepted after sending an invite.

    I looked through the module docs and couldn't find anything, but perhaps I've missed something?

     

    Thanks in advance.

     

    https://github.com/DoctorMcKay/node-steam-user#friendrelationship

     

    client.on('friendRelationship', function(steamID, relationship) {
        if (relationship == SteamUser.Steam.EFriendRelationship.Friend) { //this user became our friend on Steam
            //do something
        }
    }); 

     Check enum here: https://github.com/DoctorMcKay/node-steam-user/blob/master/enums/EFriendRelationship.js

     

    Just a heads up, if someone send you friend request, event will be called and "relationship" is: 2 (RequestRecipient).

    And if you accepted the friend request, the "friendrelationship" event will be called again and "relationship" is: 3 (Friend).

  6. No, that's wrong. Don't call counter() more than once. Call it once and store the result in a variable.

     

    Lol, so that's why I'm unable to add new item.  :D

     

    Now works like a charm, thanks.

     

    manager.on('newOffer', function(offer) {
       if (offer.partner.getSteamID64() == admin){
    
          //Counter an offer by adding new item
          var counteroffer = offer.counter();
          counteroffer.addMyItem({"appid": 753, "contextid": 6, "assetid": "5222324266"}); 
          counteroffer.send(function(err, status){
             if (err){
                console.log("Error: "+err);
             }
             console.log("Status: "+status)
          });
          //confirmation
       }
    }
    
  7. Correct.

     

    Thanks, just successfully make a counter offer.

    I only need to add "counter()" everytime I want to counter an offer.

     

    This is the working counter offer code (for those who got same problem)

     

    manager.on('newOffer', function(offer) {
       if (offer.partner.getSteamID64() == admin){
    
          //Counter an offer
          offer.counter().addMyItem({"appid": 753, "contextid": 6, "assetid": "5222324266"}); 
          offer.counter().send(function(err, status){
             if (err){
                console.log("Error: "+err);
             }
             console.log("Status: "+status)
          });
          //confirmation
       }
    }
    
  8. Hello, how did I counter an incoming trade offer?
    I know that I need to use "offer.counter()", but I don't know how to use it.

     

    I got this following code to counter an offer, but it will show an error "Cannot add item to an already-sent offer".

    manager.on('newOffer', function(offer) {
       if (offer.partner.getSteamID64() == admin){
    
          //Counter an offer by adding new item
          offer.counter();
          offer.addMyItem({"appid": 753, "contextid": 6, "assetid": "5222324266"}); //error here
          offer.send(function(err, status){
             if (err){
                console.log("Error: "+err);
             }
             console.log("Status: "+status)
          });
       }
    }
    

    Can anyone show the correct code please? I would really appreciate it.

    Thanks :)

  9. I didn't think on that xD. But will it show me as connected on steam? I need to handle chat messages too :ph34r:

    Nope, you will show up as "Offline" and still idling the game.

    If you decided to do that, you can't use chat messages.

     

    There's other way. You can 'Offline' in client, but Online chat via web browser, it will show up as 'Online via web browser' and still idling the game

     

    Use steamcommunity 'chatLogon();'

    https://github.com/DoctorMcKay/node-steamcommunity/wiki/Steam-Chat#chatlogoninterval-uimode

  10. Hi all!

    Is there any way to idle a game without showing it and just appear as connected in steam?

     

    Put your "client.setPersona" as offline (0), and play whatever game you're idling

     

    client.setPersona(0);      //"0": "Offline", "1": "Online", "2": "Busy", "3": "Away", "4": "Snooze", "5": "LookingToTrade", "6": "LookingToPlay"
    client.gamesPlayed(753);   //playing app 753 
  11. Anything  wrong with this code ? it seems to return everything as false

     

    Are you sure it's not this for the last line?

     

    if (mkable === false && ts === false && cable === false) { // && means [AND], || means [OR]
        return false
    }
    return true 
    PS: I'm sorry if I got this wrong, I don't play TF2
  12. With the code below, how do i make it return false if Not Usable In Crafting is found ? i couldnt make it to return true and false for this. Please help :c

     

    Those function should works

    This is how you call function craftable(item) 

    offer.itemsToReceive.forEach(function(item) {
       if (craftable(item) == false){
          //item is Not Usable in Crafting
       }
       else {
          //item is Usable in Crafting
       }
    });
    
    //do same with itemToGive
    
    
×
×
  • Create New...