Milan Posted July 3 Report Posted July 3 Hey, I'm trying to implement ClientGetUserStats, however I'm facing an issue that shouldn't happen. Here is my code: const EMsg = require("steam-user").EMsg; const Helpers = require("./node_modules/steam-user/components/helpers"); const StdLib = require("@doctormckay/stdlib"); const SteamUser = require("steam-user"); class SteamUserStats extends SteamUser { async getUserStats(appid, callback) { return StdLib.Promises.timeoutCallbackPromise(10000, ["userStats"], callback, (resolve, reject) => { this._send( { msg: EMsg.ClientGetUserStats, proto: { routing_appid: appid, }, }, { game_id: appid, steam_id_for_user: this.steamID.getSteamID64(), }, (body) => { let err = Helpers.eresultError(body.eresult); if (err) { reject(err); } else { resolve(body); } } ); }); } } SteamUser.prototype._handlerManager.add(EMsg.ClientGetUserStatsResponse, function (body) { console.log("user stats received!"); this.emit("userStats", body); }); module.exports = SteamUserStats; The request worked with the same parameters when I implemented this in SteamKit2, but for some reason I'm getting the following error when using node steam-user: let err = new Error(EResult[eresult] || ('Error ' + eresult)); ^ Error: Fail at exports.eresultError (C:\Users\Milan\Desktop\nép\szolgáltatás\node_modules\steam-user\components\helpers.js:105:12) at SteamUserStats.<anonymous> (C:\Users\Milan\Desktop\nép\szolgáltatás\steamUserStats.js:22:39) at SteamUserStats._handleMessage (C:\Users\Milan\Desktop\nép\szolgáltatás\node_modules\steam-user\components\03-messages.js:648:16) at SteamUserStats._handleNetMessage (C:\Users\Milan\Desktop\nép\szolgáltatás\node_modules\steam-user\components\03-messages.js:570:8) at SteamUserStats._processMulti (C:\Users\Milan\Desktop\nép\szolgáltatás\node_modules\steam-user\components\03-messages.js:702:9) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { eresult: 2 } No matter what I do, I'm getting the same error, which should only occur when not sending a correct steamid. I'd appreciate it, if you could look into this issue. Thanks. Quote
Dr. McKay Posted July 4 Report Posted July 4 Unless you've edited messages.js to define which protobuf should be used for that message, you'll need to handle encoding the request body yourself. Quote
Milan Posted July 4 Author Report Posted July 4 8 hours ago, Dr. McKay said: Unless you've edited messages.js to define which protobuf should be used for that message, you'll need to handle encoding the request body yourself. Oh, I forgot the mention, that I added this line in the messages.js, the request was timing out without this. protobufs[EMsg.ClientGetUserStats] = Schema.CMsgClientGetUserStats; Quote
Dr. McKay Posted July 5 Report Posted July 5 I dunno what to tell you; I've never messed with any user stats messages. Everything looks fine, assuming that what you're passing is what the backend actually expects. Are you in-game for the app? That might be necessary. Quote
Milan Posted July 5 Author Report Posted July 5 3 hours ago, Dr. McKay said: I dunno what to tell you; I've never messed with any user stats messages. Everything looks fine, assuming that what you're passing is what the backend actually expects. Are you in-game for the app? That might be necessary. Yes, I'm in-game for the app I'm trying to request stats for, but I don't think it's necessary. Anyways, thanks for trying to help me, I just wanted to make a simple achievement unlocker, but it looks like I'll have to leave this project for someone else 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.