Jump to content


Photo
Question

Check if key is valid client.redeemKey

node.js node-steam-user

Best Answer Dr. McKay , 16 March 2019 - 07:57 AM

client.on("friendMessage", function (steamID, message) {
    if (steamID == AdminID && message.indexOf('!key') == 0) {
        var GetKey = message.replace('!key ', '');
        client.redeemKey(GetKey, function (err) {
            if (err) {
                // key not activated
            } else {
                client.chatMessage(steamID, "Key activated: " + GetKey);
            }
        });
    }
});
Go to the full post


  • Please log in to reply
3 replies to this topic

#1 Aswer

Aswer

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 11 March 2019 - 08:04 PM

Hi, im new to this and i don't know how to check if the key is valid or invalid..

 

 

This is the code 

client.on("friendMessage", function (steamID, message) {
    if (steamID == AdminID && message.indexOf('!key') == 0) {
        var GetKey = message.replace('!key ', '');
        client.redeemKey(GetKey);
        client.chatMessage(steamID, "Key activated: " + GetKey);
    }
});

Thanks  :D



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,188 posts

Posted 12 March 2019 - 06:36 AM

Check the callback or promise result to redeemKey.


  • Aswer likes this

#3 Aswer

Aswer

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 16 March 2019 - 07:19 AM

Check the callback or promise result to redeemKey.

 

Thank you but.. i'm new to this stuff and I searched everywhere to find an example...

Can you plase help me with an small example  :D

 

Thank you for your time.



#4 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,188 posts

Posted 16 March 2019 - 07:57 AM   Best Answer

client.on("friendMessage", function (steamID, message) {
    if (steamID == AdminID && message.indexOf('!key') == 0) {
        var GetKey = message.replace('!key ', '');
        client.redeemKey(GetKey, function (err) {
            if (err) {
                // key not activated
            } else {
                client.chatMessage(steamID, "Key activated: " + GetKey);
            }
        });
    }
});

  • Aswer likes this





Also tagged with one or more of these keywords: Question, node.js, node-steam-user

2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users