Jump to content
McKay Development

Recommended Posts

Posted

I might be doing this wrong. This is my code:

client.on("chatUserLeft", function(chatID, userID) {
    if (userID.getSteamID64() !== owner) {
        client.chatMessage(userID, "I hope your issue has been resolved! Whenever you have another question feel free to open another chat :)");
    }
    client.leaveChat(chatID);
});

owner = my steamid64.

 

The error I'm getting:

C:\Users\Tim\Desktop\Steam Bots\Assistant\node_modules\steam-user\components\chat.js:512
                        delete this.chats[sid64].members[target64];
                                                ^

TypeError: Cannot read property 'members' of undefined
    at SteamUser._handlers.(anonymous function) (C:\Users\Tim\Desktop\Steam Bots\Assistant\node_modules\steam-user\components\chat.js:512:28)
    at SteamUser._handleMessage (C:\Users\Tim\Desktop\Steam Bots\Assistant\node_modules\steam-user\components\messages.js:198:29)
    at emitThree (events.js:116:13)
    at CMClient.emit (events.js:194:7)
    at CMClient._netMsgReceived (C:\Users\Tim\Desktop\Steam Bots\Assistant\node_modules\steam-client\lib\cm_client.js:278:8)
    at CMClient.handlers.(anonymous function) (C:\Users\Tim\Desktop\Steam Bots\Assistant\node_modules\steam-client\lib\cm_client.js:386:8)
    at CMClient._netMsgReceived (C:\Users\Tim\Desktop\Steam Bots\Assistant\node_modules\steam-client\lib\cm_client.js:260:24)
    at emitOne (events.js:96:13)
    at TCPConnection.emit (events.js:188:7)
    at TCPConnection._readPacket (C:\Users\Tim\Desktop\Steam Bots\Assistant\node_modules\steam-client\lib\tcp_connection.js:73:7)
 [nodemon] app crashed - waiting for file changes before starting...

Help is appreciated.

Posted (edited)

This is a bug in the module. How frequently does this happen? Is there a reproducible test case?

It happens every time. What I did was use a timeout to delay it by 3 seconds, which worked at first, but still often gives this error:

 

https://i.gyazo.com/132dd4ff83f1fa01f762aaa6c0deaa24.png.

 

It doesnt always happen everytime, it does like every 30 minutes.

 

Is there a way of fixing this? And what causes this?

Edited by timgfxx
Posted

Well the error in that screenshot you just provided is caused by you attempting to leave a chat when you aren't connected to Steam.

 

When you say it happens "every time", it happens every time what happens? Every time someone leaves a chat?

Posted

Well the error in that screenshot you just provided is caused by you attempting to leave a chat when you aren't connected to Steam.

 

When you say it happens "every time", it happens every time what happens? Every time someone leaves a chat?

In the code I posted in the original post it would crash every time a user left a chat.

 

So that means my session expired?

Posted

No, the original post code is crashing due to some bug that I need to track down.

 

What kind of chat is this? Group chat or multi-user? Also, is the chatEnter event being emitted for it? Can you also listen for chatLeft and see in what order stuff is being emitted?

Posted (edited)

No, the original post code is crashing due to some bug that I need to track down.

 

What kind of chat is this? Group chat or multi-user? Also, is the chatEnter event being emitted for it? Can you also listen for chatLeft and see in what order stuff is being emitted?

Multi user I think, the bot invites a user and me. Currently the bot doesn't listen for chatEnter and chatLeft. Only chatUserJoined and charUserLeft, they are both emitted and leaveChat() causes an error in chatUserLeft. I can test chatEnter and chatLeft later today, does steam-user have a debug mode? Edited by timgfx
Posted

There isn't any debug mode that would be terribly useful for this, I'm afraid.

Another question,

Why is this called twice? (Line 103 and 105)

msg.writeUint64(this.steamID.getSteamID64());

 Maybe you have to change this.steamID to steamID, because:

SteamUser.prototype.leaveChat = function(steamID) {

Testing it out right now!

Posted

There isn't any debug mode that would be terribly useful for this, I'm afraid.

Wait a minute, nevermind my last reply. steamID == null if you're not connected to steam, that must be the problem.... I am confused.. how

Posted

Can I see the code that creates the chat and invites the users?

            client.createChatRoom(null, senderID, function(result, chatID) {
                client.inviteToChat(chatID.getSteamID64(), owner);
                client.chatMessage(owner, "\nA user needs support: steam://friends/joinchat/" + chatID.getSteamID64());
                client.chatMessage(senderID, "\nA new chat has been created.\nClick here to join the chat: steam://friends/joinchat/" + chatID.getSteamID64());
            });

Thats called when the bot receives "support" as a message

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...