Jump to content
McKay Development

Steam bot cant post comments on friends profile.


Recommended Posts

Hello everyone,

i just make my steam trashbot but I try to make it more different from the others bots.

I try to post a comment on the user profile that give me something (items that are not necessary) from his inventory.

The problem is that the bot receives an error when it tries to post.

This is the code: 


// main.js

const SteamUser = require('steam-user');
const TradeOfferManager = require('steam-tradeoffer-manager');
const initFriendsManager = require('./friendsManager');
const acceptTradeOffer = require('./tradeManager'); // Import the acceptTradeOffer function
const comeOnline = require('./comeOnline'); // Import the comeOnline module
const SteamTOTP = require('steam-totp'); // Import SteamTOTP module for generating two-factor authentication code
const SteamCommunity = require('steamcommunity'); // Import SteamCommunity module

const client = new SteamUser();
const manager = new TradeOfferManager({
    steam: client,
    domain: 'example.com',
    language: 'en',
    pollInterval: 10000,
    apiKey: '' // your API key

const logOnOptions = {
    accountName: '', // login credentials
    password: '', // your password 
    twoFactorCode: SteamTOTP.generateAuthCode('') // Add your shared secret here

const community = new SteamCommunity(); // Initialize the SteamCommunity object


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

client.on('webSession', (sessionID, cookies) => {
    manager.setCookies(cookies, (err) => {
        if (err) {
        console.log('TradeOfferManager ready.');


// Add the event handler for new offers here
manager.on('newOffer', (offer) => {
    console.log('New trade offer received.');
    acceptTradeOffer(manager, client, offer, community); // Pass client and community objects

// Add the following lines to integrate the deleteAllFriends function
const ownerSteamID = ''; // Replace with the owner's SteamID
comeOnline.deleteAllFriends(client, ownerSteamID);


and this is the tradeManager.js



function acceptTradeOffer(manager, client, offer, community) {
    console.log('Received trade offer from SteamID:', offer.partner.getSteamID64());

    if (offer.itemsToReceive.length > 0 && offer.itemsToGive.length === 0) {
        setTimeout(() => {
            offer.accept((err, status) => {
                if (err) {
                    console.error('Error accepting offer:', err);
                } else {
                    console.log('Trade offer with items to receive (no items to give) accepted:', status);

                    const partnerId = offer.partner.getSteamID64();
                    console.log('Partner ID:', partnerId);

                    if (client.myFriends && client.myFriends[partnerId]) {
                        console.log('Partner is a friend.');
                        postComment(community, partnerId);
                    } else {
                        console.log('Partner is not a friend.');
        }, 5000);
    } else if (offer.itemsToGive.length > 0) {
        setTimeout(() => {
            offer.decline((err, status) => {
                if (err) {
                    console.error('Error declining offer:', err);
                } else {
                    console.log('Trade offer with items to give declined.');
        }, 5000);

function postComment(community, partnerId) {
    console.log('Attempting to post comment for partner:', partnerId);
    // Simulate a delay before posting a comment
    setTimeout(() => {
        community.postUserComment(partnerId, "Thanks for the gift!", (err) => {
            if (err) {
                console.error('Error posting comment:', err);
                // Retry posting comment or handle the error accordingly
            } else {
                console.log('Comment posted successfully.');
    }, 60000); // Wait for 1 minute before posting a comment

module.exports = acceptTradeOffer;


The bot check if the person that send the gift is in their friend list, if it is the bot post a comment on his profile.

Console log:

Logged into Steam.
TradeOfferManager ready.
New trade offer received.
Received trade offer from SteamID: 76561198023414915
Trade offer with items to receive (no items to give) accepted: accepted
Partner ID: 76561198812293087
Partner is a friend.
Attempting to post comment for partner: 76561198023414915

after the 1 min delay i receive this:

Error posting comment: Error: The settings on this account do not allow you to add comments.


I can post comments manually with the bot but not with the script.

Thank you. every solution is welcome.

Screenshot 2024-02-16 104619.png

Screenshot 2024-02-16 104607.png

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.

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.

  • Create New...