KindaIntellectual Posted February 20, 2018 Report Posted February 20, 2018 const SteamUser = require('steam-user'), SteamTotp = require('steam-totp'), SteamCommunity = require('steamcommunity'), steamConfig = require('../steam-bot/config.json'), client = new SteamUser(), community = new SteamCommunity(), steamUserLogin = { accountName: steamConfig.username, password: steamConfig.password, twoFactorCode: SteamTotp.generateAuthCode(steamConfig.sharedSecret) }, steamGroupID = '103582791459977984'; var announcementHeadline = 'testheadline', announcementContent = 'testcontent'; client.logOn(steamUserLogin); client.on('loggedOn', function(){ console.log('Logged into steam'); }); client.on('websession', function(sessionid, cookies){ community.setCookies(cookies); }); community.postGroupAnnouncement(steamGroupID, announcementHeadline, announcementContent, function(err){if (err) {console.log(err.message)} client.logOff()}); It logs into steam, waits a few seconds and then logs off. No error is returned. I checked the permissions, and I can post announcements manually. It seems to run the function as changing the group ID returns an error of invalid. Can you point me in the direction of what I'm doing wrong? Thank you for any and all help Quote
Dr. McKay Posted February 20, 2018 Report Posted February 20, 2018 You're doing async wrong. You need to put your postGroupAnnouncement call into the webSession event (which is also misspelled, you're missing a capital S) after the setCookies call. Quote
KindaIntellectual Posted February 20, 2018 Author Report Posted February 20, 2018 Thanks for the quick reply, the lower case 's' was the culprit. I tried the postGroupAnnouncement there before but when it didn't work I assumed it was wrong. I admit async is a concept I'm still trying to grasp properly/at all. Again, thanks so much. I really appreciate it Quote
Recommended Posts
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.