Hi Doc and all other forum members!
I'm currently implementing an feature which changes the steam bot account every 30 minutes.
const SteamUser = require("steam-user");
const SteamCommunity = require("steamcommunity");
const TradeOfferManager = require("steam-tradeoffer-manager");
const SteamTotp = require("steam-totp");
// Setup Steam Tradeoffer Manager
const client = new SteamUser();
const community = new SteamCommunity();
const manager = new TradeOfferManager({
steam: client,
community,
language: "en",
pollInterval: 30000
});
let BOT_CREDENTIALS = {};
// Start the bot switcher
async function startSwitcher() {
BOT_CREDENTIALS = { username: "...1", password: "...1", sharedSecret: "...1", identitySecret: "...2" };
login();
// Main switcher interval
setInterval(() => {
// Set the new bot credentials
BOT_CREDENTIALS = { username: "...2", password: "...2", sharedSecret: "...2", identitySecret: "...2" };
// Logout current bot
client.logOff();
}, 1800000);
}
// Login the bot
async function login() {
// Login to steam
client.logOn({
accountName: BOT_CREDENTIALS.username,
password: BOT_CREDENTIALS.password,
twoFactorCode: SteamTotp.generateAuthCode(BOT_CREDENTIALS.sharedSecret)
});
}
// Listen for logouts
client.on("disconnected", () => {
// If this was intentional (logout call) login with the new bot
community.stopConfirmationChecker();
login();
});
// Client requests session
client.on("webSession", (sessionid, cookies) => {
manager.setCookies(cookies);
community.setCookies(cookies);
community.startConfirmationChecker(10000, BOT_CREDENTIALS.identitySecret); // I know this is deprecated, but couldn't find any documentation on how to do it otherwise :/
});
// Listen for new offers
manager.on("newOffer", async offer => {
console.log("new offer!"); // This fires, while the first bot account is logged on. When switched to the second account, it stops receiving new events.
});
However, with this configuration I can't seem to make it work (the new bot will log on, but the event listeners do not fire). Do you guys have any ideas if this is possible, and if so, how would you approach this?
Thank you in advance!