Jump to content
McKay Development

Recommended Posts

Posted (edited)
 
 
 
After a while, the manager.on('new Offer', function(offer) stops working and the console.log line appears("New offer #" + Offer.id + " from " + Offer.partner.getSteam3RenderedID() + Offer. message) The incoming transaction is not displayed. When I manually restart the code, the streams become visible after using the use AccessToken.
 
 
const FS = require('fs');

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

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

client.on('webSession', (sessionid, cookies) => {
  manager.setCookies(cookies);

  community.setCookies(cookies);
  community.startConfirmationChecker(10000, 'identity_secret');
});


const logOnOptions = {
  accountName: 'accountName',
  password: 'password',
  twoFactorCode: SteamTotp.generateAuthCode('shared_secret')
};




client.logOn(logOnOptions);

client.on('loggedOn', () => {
  console.log('Logged into Steam');

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

client.on('webSession', (sessionid, cookies) => {
  manager.setCookies(cookies);

  community.setCookies(cookies);
  community.startConfirmationChecker(10000, 'identity_secret');
});


manager.on('newOffer', function(offer) {
	console.log("New offer #" + offer.id + " from " + offer.partner.getSteam3RenderedID() + offer.message);
	if (/text/.test(offer.message)){
	offer.accept(function(err, status) {
		if (err) {
			console.log("Unable to accept offer: " + err.message);
		} else {
			console.log("Offer accepted: " + status);
			if (status == "pending") {
				community.acceptConfirmationForObject("identitySecret", offer.id, function(err) {
					if (err) {
						console.log("Can't confirm trade offer: " + err.message);
					} else {
						console.log("Trade offer " + offer.id + " confirmed");
					}
				});
			}
		}
	});}
});


 

 
 
 
 
 
 
334 / 5 000  
 

Результаты перевода

Перевод

Через некоторое время менеджер.on('newOffer', function(offer) перестает работать и появляется строка console.log("Новое предложение #" + Offer.id + " from " + Offer.partner.getSteam3RenderedID() + Offer. message) Когда я вручную перезапускаю код, потоки становятся видимыми после использования useAccessToken.

Steam_accept.js

Edited by keler
  • keler changed the title to manager.on('new Offer', function(offer) not work

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...