Arcana / node-dota2

A node-steam plugin for Dota 2.
MIT License
546 stars 191 forks source link

TypeError: Dota2.schema is not a constructor on every bot action #677

Closed lemeshovich closed 2 years ago

lemeshovich commented 5 years ago

getting that errors after recent Dota2 update caught error: TypeError: Dota2.schema.CMsgPracticeLobbyLeave is not a constructor any ideas how to fix this?

2019-11-27 20:30:49.244 INFO dota2-daemon-service [-, -, -] [Bot #bot2] Node-dota2 ready
2019-11-27 20:30:49.245 INFO dota2-daemon-service [-, -, -] [Bot #bot2] Started
2019-11-27 20:30:49.246 INFO dota2-daemon-service [-, -, -] Sending match CMsgPracticeLobbyLeave request
2019-11-27 20:30:49.247 INFO dota2-daemon-service [-, -, -] [Bot #bot2] caught error: TypeError: Dota2.schema.CMsgPracticeLobbyLeave is not a constructor
    at Dota2Client.Dota2.Dota2Client.leavePracticeLobby (C:\Lems\dota2-daemon-develop\node_modules\dota2\handlers\lobbies.js:350:19)
    at Dota2Client.<anonymous> (C:\Lems\dota2-daemon-develop\bot.js:153:73)
    at Dota2Client.emit (events.js:210:5)
    at Dota2Client.EventEmitter.emit (domain.js:475:20)
    at Dota2Client.clientWelcomeHandler (C:\Lems\dota2-daemon-develop\node_modules\dota2\index.js:323:10)
    at SteamGameCoordinator.fromGC (C:\Lems\dota2-daemon-develop\node_modules\dota2\index.js:172:38)
    at SteamGameCoordinator.emit (events.js:210:5)
    at SteamGameCoordinator.EventEmitter.emit (domain.js:475:20)
    at SteamGameCoordinator.handlers.<computed> (C:\Lems\dota2-daemon-develop\node_modules\steam\lib\handlers\game_coordinator\index.js:107:10)
    at SteamGameCoordinator.<anonymous> (C:\Lems\dota2-daemon-develop\node_modules\steam\lib\handlers\game_coordinator\index.js:19:28)
    at SteamClient.emit (events.js:215:7)
    at SteamClient.EventEmitter.emit (domain.js:475:20)
    at SteamClient._netMsgReceived (C:\Lems\dota2-daemon-develop\node_modules\steam\lib\steam_client.js:175:10)
    at SteamClient.handlers.<computed> (C:\Lems\dota2-daemon-develop\node_modules\steam\lib\steam_client.js:262:10)
    at SteamClient._netMsgReceived (C:\Lems\dota2-daemon-develop\node_modules\steam\lib\steam_client.js:160:26)
    at Connection.emit (events.js:210:5)
    at Connection.EventEmitter.emit (domain.js:475:20)
    at Connection._readPacket (C:\Lems\dota2-daemon-develop\node_modules\steam\lib\connection.js:50:8)
    at Connection.emit (events.js:210:5)
    at Connection.EventEmitter.emit (domain.js:475:20)
    at emitReadable_ (_stream_readable.js:575:12)
    at processTicksAndRejections (internal/process/task_queues.js:79:21) at lobby TNM6666
2019-11-27 20:30:49.390 INFO dota2-daemon-service [-, -, -] Cache(s) subscribed, type(s): 7
27 Nov 22:30:49 - Unhandled cache ID: 7
crnbarr93 commented 4 years ago

Any updates on this? Can't use any of the bot's functions.

lemeshovich commented 4 years ago

cant understand where the problems is, tried to delete node_modules then npm install yesterday everything was good after that today i made the same and getting "is not a constructor" again.. i think there is some problems in dependencies if anyone has any information about that share it please

crnbarr93 commented 4 years ago

Generating the protobuf yourself and sending it to the Steam coordinator seems to work fine. You can import the protobuf constructors from node-steam-resources.

I can't see anything immediately wrong with the handler functions for this library. For example:

const payload = new this.dota2Proto.CMsgDOTAGetPlayerMatchHistory({
            account_id: accountId,
            request_id: accountId,
            matches_requested: options.matches_requested || 10,
});

This does not cause an error in my own code, but is almost identical to what is causing the error in the handler function.