Jump to content
McKay Development

How to make manager do something when trade succeded


Recommended Posts

This is my current project

https://github.com/xLeeJYx/backpacktf-automatic-pro

 

i plan to increase more functions on the bot

 

My question is this : 

how do i make node-steamcommunity comment on profile's user when the trade succeded

 

is there something like

 

manager.on('succes'){

       postUserComment(offer.partner.toString(), "Thanks for trading with me!")

}

Link to comment
Share on other sites

Umm what should code in there, i want it to comment when incomming trade was accepted

 

i tried this

const SteamCommunity = require('steamcommunity');
const TradeOfferManager = require('steam-tradeoffer-manager');

var community = new SteamCommunity();
var manager = new TradeOfferManager();


manager.on(receivedOfferChanged, (comment) => {
community.postUserComment(offer.partner.toString(), 'Test');
});

it didnt comment on the profile though

Edited by xLeeJYx
Link to comment
Share on other sites

hmm this is the whole code, still couldnt fix it, im new to coding please don't judge. It still wont post the comment

 

it gave this error...

 

C:\Users\JingYong-PC\Desktop\comment\test.js:40
community.postUserComment(manager.offer.partner.toString(), 'Test');
                                       ^


TypeError: Cannot read property 'partner' of undefined
    at TradeOfferManager.manager.on (C:\Users\JingYong-PC\Desktop\comment\test.js:40:40)
    at emitTwo (events.js:106:13)
    at TradeOfferManager.emit (events.js:191:7)
    at received.forEach (C:\Users\JingYong-PC\Desktop\comment\node_modules\steam-tradeoffer-manager\lib\polling.js:237:10)
    at Array.forEach (native)
    at getOffers (C:\Users\JingYong-PC\Desktop\comment\node_modules\steam-tradeoffer-manager\lib\polling.js:219:12)
    at Helpers.checkNeededDescriptions (C:\Users\JingYong-PC\Desktop\comment\node_modules\steam-tradeoffer-manager\lib\index.js:359:4)
    at Object.exports.checkNeededDescriptions (C:\Users\JingYong-PC\Desktop\comment\node_modules\steam-tradeoffer-manager\lib\helpers.js:90:3)
    at _apiCall (C:\Users\JingYong-PC\Desktop\comment\node_modules\steam-tradeoffer-manager\lib\index.js:350:11)
    at SteamCommunity._community.httpRequest (C:\Users\JingYong-PC\Desktop\comment\node_modules\steam-tradeoffer-manager\lib\webapi.js:54:3)
Press any key to continue . . .
 
//Required modules
const SteamCommunity = require('steamcommunity');
const TradeOfferManager = require('steam-tradeoffer-manager');
const SteamTotp = require('steam-totp');
const SteamUser = require('steam-user');


//Config
var config = require('./config.json')


var client = new SteamUser();
var community = new SteamCommunity();
var manager = new TradeOfferManager({
steam: client,
community: community,
language: 'en',
});


client.logOn(
{
    accountName: config.username,
    password: config.password,
    twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret)
});



client.on('loggedOn', () => {
console.log('Logged in to steam !');


client.setPersona(SteamUser.Steam.EPersonaState.Online);
client.gamesPlayed(440);
});

client.on('webSession', (sessionid, cookies) => {
manager.setCookies(cookies);
community.setCookies(cookies);
community.startConfirmationChecker(10000, config.identity_secret);
});

manager.on('receivedOfferChanged', () => {
community.postUserComment(manager.offer.partner.toString(), 'Test'); 
});
Edited by xLeeJYx
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...