Steam Tradeoffer Manager事件未触发

时间:2018-11-09 19:01:21

标签: node.js steam steambot

我正在尝试使用Steam Trade Offer Manager节点模块设置交易机器人。

这是我的代码:

    const SteamUser = require('steam-user');
    const TradeOfferManager = require('steam-tradeoffer-manager');
    const SteamTotp = require('steam-totp')
    const fs = require('fs');

    const bot = new SteamUser();

    const manager = new TradeOfferManager({
        steam: bot,
        language: 'en',
    });

    if (fs.existsSync('polldata.json')) {
        manager.pollData = 
        JSON.parse(fs.readFileSync('polldata.json').toString('utf8'));
    }

    bot.logOn({
        accountName: 'username',
        password: 'password',
        twoFactorCode: 
        SteamTotp.generateAuthCode('secret key')
    });

    bot.on('webSession', (sessionid, cookies) => {
        manager.setCookies(cookies);
        sendRandomItem();
    });

    manager.on('pollData', function(pollData) {
        fs.writeFileSync('polldata.json', JSON.stringify(pollData));
    });

    function sendRandomItem() {
        console.log('Sending the offer')
        const partner ='https://steamcommunity.com/tradeoffer/new/partner=92022019&token=PKIsI3np';
        const offer = manager.createOffer(partner);
        offer.addTheirItem({
            assetid: "14927752826",
            appid: 730,
            contextid: 2
        });

        offer.send((err, status) => {
             if (err) {
                 console.log(err);
             } else {
                 console.log(`Sent offer. Status: ${status}.`);
             }
        });
    };
已发送

交易请求,但是当我接受或拒绝报价sentOfferChanged时,则无法启动。 我也尝试了debug事件,那里也没有运气。

唯一触发的事件是pollData

0 个答案:

没有答案