Jump to content


Photo
Question

Bot doesnt accept offers

node.js node-steam-tradeoffer-manager

  • Please log in to reply
No replies to this topic

#1 Siezek1

Siezek1

    Member

  • Member
  • PipPip
  • 15 posts
  • LocationPoland

Posted 26 August 2019 - 05:47 AM

Hi my bot doesnt accept offers, i dont know why.

My code:

 

const SteamUser = require('steam-user');

const SteamTotp = require('steam-totp');
const SteamCommunity = require('steamcommunity');
const TradeOfferManager = require('steam-tradeoffer-manager');
const fs = require('fs');
 
 
const config = require('./config.json');
 
const logOnOptions = {
  accountName: config.username,
  password: config.password,
  twoFactorCode: SteamTotp.generateAuthCode(config.sharedSecret),
  rememberPassword: true,
  autoRelogin: true
};
 
const client = new SteamUser();
const community = new SteamCommunity();
const manager = new TradeOfferManager ({
    steam: client,
    community: community,
    language: 'en'
});
 
//Logowanie do Steam
 
client.logOn(logOnOptions);
 
client.on('loggedOn', () => {
  console.log('Zalogowano!');
 
  client.setPersona(SteamUser.EPersonaState.Online);
  client.gamesPlayed(["🤙Siezek To Kozak! - !komendy🤙",440,570]);
});
//Komendy
 
client.on("friendMessage", function(steamID, message) {
if (message == "Siema") {
client.chatMessage(steamID, "Siema Mordo!");
});
 
client.on("friendMessage", function(steamID, message) {
        if (message == "!TwĂłrca") {
                client.chatMessage(steamID, "MĂłj twĂłrca to Siezek --> https://steamcommuni.../id/siezekYT");
        }
});
 
client.on("friendMessage", function(steamID, message) {
        if (message == "!twĂłrca") {
                client.chatMessage(steamID, "MĂłj twĂłrca to Siezek --> https://steamcommuni.../id/siezekYT");
        }
});
 
client.on("friendMessage", function(steamID, message) {
if (message == "!Komendy") {
client.chatMessage(steamID, "Moje komendy to:");
                client.chatMessage(steamID, "1. Siema - Przywitanie siÄ™");
                client.chatMessage(steamID, "2. !TwĂłrca - Pokazuje mojego twĂłrcÄ™");
        client.chatMessage(steamID, "3. !yt - Pokazuje kanaĹ‚ moje twĂłrcy");
                client.chatMessage(steamID, "4. !donate - Donate dla moje twĂłrcy (WyĹ‚Ä…czone)");
                client.chatMessage(steamID, "5. !grupa - Grupa mojego Pana na Steam'ie");
                client.chatMessage(steamID, "6. !rep - Chcesz +rep? ProszÄ™ bardzo!");
        } 
});
 
client.on("friendMessage", function(steamID, message) {
if (message == "siema") {
client.chatMessage(steamID, "Siema Mordo!");
});
 
client.on("friendMessage", function(steamID, message) {
if (message == "!komendy") {
client.chatMessage(steamID, "Moje komendy to:");
                client.chatMessage(steamID, "1. Siema - Przywitanie siÄ™");
                client.chatMessage(steamID, "2. !TwĂłrca - Pokazuje mojego twĂłrcÄ™");
        client.chatMessage(steamID, "3. !yt - Pokazuje kanaĹ‚ moje twĂłrcy");
                client.chatMessage(steamID, "4. !donate - Donate dla moje twĂłrcy (WyĹ‚Ä…czone)");
                client.chatMessage(steamID, "5. !grupa - Grupa mojego Pana na Steam'ie");
                client.chatMessage(steamID, "6. !rep - Chcesz +rep? ProszÄ™ bardzo!");
        } 
});
 
client.on("friendMessage", function(steamID, message) {
if (message == "!yt") {
client.chatMessage(steamID, "Mój kanał na YouTube ->");
        client.chatMessage(steamID, "https://m.youtube.com/c/SiezekGo");
        } 
});
 
client.on("friendMessage", function(steamID, message) {
if (message == "!donate") {
      //client.chatMessage(steamID, "JeĹ›li chcesz wysĹ‚ać donate to masz tutaj tradelink");
        client.chatMessage(steamID, "Narazie wyĹ‚Ä…czone");
        } 
});
 
client.on("friendMessage", function(steamID, message) {
if (message == "!grupa") {
client.chatMessage(steamID, "Grupa mojego stwĂłrcy ->");
                client.chatMessage(steamID, "https://steamcommuni...riatySiezego");
        } 
});
 
client.on("friendMessage", function(steamID, message) {
        if (message == "!rep") {
                 client.chatMessage(steamID, "PoleciaĹ‚ +repik!");
                 community.postUserComment(steamID, "+rep");
        }
});
 
client.on("friendMessage", function(steamID, message) {
        if (message == "!zmien") {
                 client.chatMessage(steamID, "JuĹĽ zmieniam!");
                 community.changeName('siezek');
        } 
});
 
client.on("friendMessage", function(steamID, message) {
        if (message == "!twicth") {
                  client.chatMessage(steamID, "Twitch mojego twórcy --> http://twitch.tv/siezek");
        }
});
 
//Automatyczne akceptowane do znajomych i grup
 
client.on('friendRelationship', function(sid, relationship) {
    if (relationship == SteamUser.EFriendRelationship.RequestRecipient) {
        console.log("We recieved a friend request from "+sid);
        client.addFriend(sid, function (err, name) {
            if (err) {
                console.log(err);
                return;
            }
            console.log("Accepted user with the name of "+name)
        })
    }
 
});
 
client.on('groupRelationship', function(sid, relationship) {
    if (relationship == SteamUser.EClanRelationship.Invited) {
        console.log("We were asked to join steam group #"+sid);
        client.respondToGroupInvite(sid, true);
    }
});
 
client.on('friendsList', function() {
    for (var sid in client.myFriends);
        var relationship = client.myFriends[sid]
        if (relationship == SteamUser.EFriendRelationship.RequestRecipient) {
        console.log("(offline) We recieved a friend request from "+sid);
        client.addFriend(sid, function (err, name) {
            if (err) {
                console.log(err);
                return;
            }
            console.log("(offline) Accepted user with the name of "+name)
        })
    }
});
 
client.on('groupList', function() {
    for (var sid in client.myGroups);
        var relationship = client.myGroups[sid];
        if (relationship == SteamUser.EClanRelationship.Invited) {
        console.log("(offline) We were asked to join steam group #"+sid);
        client.respondToGroupInvite(sid, true);
    }
})
//Akceptowanie i odrzucanie ofert
 
client.on('webSession', (sid, cookies) => {
        manager.setCookies(cookies);
community.setCookies(cookies);
community.startConfirmationChecker(20000, config.identitySecret);
});
 
function acceptOffer(offer) {
    offer.accept((err) => {
        community.checkConfirmations();
        console.log("We Accepted an offer");
        if (err) console.log("There was an error accepting the offer.");
    });
}
 
function declineOffer(offer) {
    offer.decline((err) => {
        console.log("We Declined an offer");
        if (err) console.log("There was an error declining the offer.");
    });
}
 
client.setOption("promptSteamGuardCode", true);
 
manager.on('newOffer', (offer) => {
    if (offer.partner.getSteamID64() === config.ownerID) {
        acceptOffer(offer);
    } else {
    declineOffer(offer);
    }
     
});
 

 







Also tagged with one or more of these keywords: Question, node.js, node-steam-tradeoffer-manager

2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users