Alright so the title says it all, i'm fairly new to Steam bots. I'm trying to make it so it only accepts CSGO keys i know the code below is horrible, but if someone could point me in the right direction it would help a lot.
offers.on('newOffer', function (offer) {
console.log("New offer #"+ offer.id +" from "+ offer.partner.getSteam3RenderedID());
// Accept any trade offer from Admin.
if (offer.partner.getSteamID64() === config.admin && appid === appid.CSGO){
console.log("ADMIN offered a trade. Trying to accept offer.");
offer.accept(function (err) {
if (err) {
console.log("Unable to accept offer "+ offer.id +": " + err.message);
} else {
console.log("Offer accepted because ADMIN sent the offer");
}
});
}
else { //Otherwise deny it and message the user
console.log("User "+ offer.partner.getSteam3RenderedID() +" offered an invalid trade. Declining offer.");
offer.decline(function (err) {
if (err) {
console.log("Unable to decline offer "+ offer.id +": " + err.message);
} else {
console.log("Offer declined");
// Message the user
client.chatMessage(offer.partner.getSteamID64(), "Invalid offer.");
}
});
}
});
I know it also only accepts if its the admin, that's just for testing.