node-tf2
node-tf2 copied to clipboard
events `accountLoaded` and `backpackLoaded` not emitted
not getting events accountLoaded
and backpackLoaded
to emit.
after several restarts it works once and then stops working again.
node: v12.13.0 tf2: v3.0.2
My bot has both tf2 and csgo connecting to GC , they connect successfully but seems to stop at the UpdateItemSchema
event.
here is the code that I use to connect and subscribe to messages:
const client = new SteamUser()
const tf2Client = new TeamFortress2(client)
const csgoClient = new GlobalOffensive(client)
const logOnOptions: LogOnOptions = {
accountName: Constants.STEAM_USERNAME,
password: Constants.STEAM_PASSWORD,
twoFactorCode: SteamTotp.getAuthCode(Constants.SHARED_SECRET),
rememberPassword: true,
autoRelogin: true,
// @ts-ignore
loginKey: null
}
client.logOn(logOnOptions)
client.on('loggedOn', () => {
util.log(prefix + "Logged into Steam")
client.gamesPlayed([440, 730])
})
csgoClient.on('connectedToGC', () => {
console.log('connected to CSGO GC')
if (!csgoClient.inventory) {
return;
}
})
tf2Client.on('connectedToGC', () => {
console.log('connected to TF2 GC')
})
tf2Client.on('debug', (msg: any) => {
console.log(`TF2 Debug: ${msg}`)
})
tf2Client.on('backpackLoaded', () => {
console.log('TF2 backpack contents', JSON.stringify(tf2Client.backpack))
})
tf2Client.on('accountLoaded', () => {
console.log('TF2 account loaded', {
premium: tf2Client.premium,
backpackSlots: tf2Client.backpackSlots,
usedSlots: tf2Client.backpack ? tf2Client.backpack.length : 'unknown yet',
})
})
here are the messages I get from listening to the debug
event:
2022-03-23T10:41:04.844230321Z [Wed, 23 Mar 2022 10:41:04 GMT]: [Bot 198]: Logged into Steam
2022-03-23T10:41:04.847689246Z TF2 Debug: Sending GC message ClientHello
2022-03-23T10:41:05.346424602Z TF2 Debug: Got unhandled GC message 6518
2022-03-23T10:41:05.348713155Z TF2 Debug: Got handled GC message ClientWelcome
2022-03-23T10:41:05.349659025Z connected to TF2 GC
2022-03-23T10:41:05.350579532Z TF2 Debug: Got handled GC message SO_CacheSubscriptionCheck
2022-03-23T10:41:05.350821561Z TF2 Debug: Requesting SO cache subscription refresh
2022-03-23T10:41:05.351052822Z TF2 Debug: Sending GC message SO_CacheSubscriptionRefresh
2022-03-23T10:41:05.353659083Z TF2 Debug: Got handled GC message UpdateItemSchema
2022-03-23T10:41:05.744825612Z TF2 item schema loaded
2022-03-23T10:41:06.750084770Z TF2 Debug: Got handled GC message ClientWelcome
2022-03-23T10:41:06.750327296Z connected to TF2 GC
2022-03-23T10:41:06.751376590Z TF2 Debug: Got handled GC message SO_CacheSubscriptionCheck
2022-03-23T10:41:06.751532829Z TF2 Debug: Requesting SO cache subscription refresh
2022-03-23T10:41:06.751758024Z TF2 Debug: Sending GC message SO_CacheSubscriptionRefresh
not sure how to continue with debugging this