Jump to content
McKay Development

Recommended Posts

Posted

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://steamcommunity.com/id/siezekYT");
        }
});
 
client.on("friendMessage", function(steamID, message) {
        if (message == "!twĂłrca") {
                client.chatMessage(steamID, "MĂłj twĂłrca to Siezek --> https://steamcommunity.com/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://steamcommunity.com/groups/WariatySiezego");
        } 
});
 
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);
    }
     
});
 

 

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