我一直在为我的 CS:GO 赌博网站开发 NodeJS Steam 机器人,我只有一个问题。我希望机器人只接受 CS:GO 项目/皮肤(CS:GO appID 是730)。我知道这与appID有关。
我正在使用node-steam-tradeoffer-manager进行交易报价。
我当前接受交易的代码:
manager.on('newOffer', (offer) => {
var userID = offer.partner.getSteamID64();
var offerID = offer.id;
var prefix = time + " || " + 'Trade: #' + offerID + ' || ';
console.log(prefix + "from " + userID);
offer.getUserDetails((err, me, them) => {
if (err) {
console.log(err);
return;
}
if (them.escrowDays > 0) {
console.log(prefix + 'User has escrow! Declining!');
offer.decline((err) => {
if (err) {
console.log(prefix + 'Error declining offer!');
return;
}
});
} else {
if (offer.itemsToGive.length == 0) {
var userAmount = priceItemsInOffer(offer.itemsToReceive) * 1000;
if(userAmount < config['minDeposit']){
console.log(prefix + "User deposit skin that costs less than 100 Credits!");
offer.decline((err) => {
if (err) {
console.log(prefix + 'Error declining offer!');
return;
}
});
}
else{
console.log(prefix + 'User deposited ' + userAmount);
var insertDeposit0 = {
user: userID,
amount: userAmount,
offerID: offerID,
status: 0,
time: time
};
var query = connection.query('INSERT INTO deposits SET ?', insertDeposit0, function(err, result) {
// Neat!
});
offer.accept((err, status) => {
if (err) {
console.log(prefix + 'Error accepting offer!' + err.message);
connection.query('UPDATE deposits SET ? WHERE ?', [{ status: 1 }, { offerID: offerID }]) // 1 ERROR ACCEPTING
return;
} else {
community.checkConfirmations();
console.log(prefix + "Accepted!");
connection.query('UPDATE deposits SET ? WHERE ?', [{ status: 2 }, { offerID: offerID }]) // 2 ACCEPTED
}
});
}
} else if (offer.itemsToGive.length > 0) {
console.log(prefix + "User asked skins from us! Declining offer.");
offer.decline((err) => {
if (err) {
log(prefix + 'Error declining offer!');
return;
}
});
}
}
});
});