Jump to content
McKay Development

Recommended Posts

Posted

Hello!

In the last 2-3 days there is an (Steam) error when the user does not receive messages from the bot.

Messages are successfully sent and will be found in the user's chat after the client reboots.

I noticed a pattern: this applies only to messages that are sent instantly (usually such as !help / !prices). The user may not receive such messages.

The user will always receive messages with any delay (usually such as !check / !buy) when the bot needs time to make a calculation (However, the user may still not receive messages such as "I'm fulfilling your request, please wait").

I don't want to wait for Steam to fix this. Can I set the minimum delay (at least 1 sec) globally?

Test:

    if (MSG == "QQQ") {
        client.chatMessage(SENDER, "Ok, QQQ");

    } else if (MSG == "WWW") {
        client.chatTyping(SENDER);
        client.chatMessage(SENDER, "Ok, WWW");

    } else if (MSG == "EEE") {
        setTimeout(function() {
            client.chatMessage(SENDER, "Ok, EEE");
        }, 1000);
    }


Results, User client:
u: QQQ
b: <nothing>
u: QQQ
b: <nothing>
u: QQQ
b: Ok, QQQ
u: QQQ
b: <nothing>
u: QQQ
b: <nothing>

u: WWW
b: <nothing>
u: WWW
b: <nothing>
u: WWW
b: Ok, WWW
u: WWW
b: <nothing>
u: WWW
b: <nothing>

u: EEE
b: Ok, EEE
u: EEE
b: Ok, EEE
u: EEE
b: Ok, EEE
u: EEE
b: Ok, EEE
u: EEE
b: Ok, EEE

PS: I would not want to change ALL client.chatMessage(); to setTimeout(function() { client.chatMessage(); }, 1000);

I want to know how can I do this globally in a module file.

Posted

You'd need to either call setTimeout everywhere you call client.chatMessage, or create your own function that calls client.chatMessage after a delay and replace all calls to client.chatMessage with your new function.

Posted

Thanks.

If anyone wants to solve this problem for their bot, here is a temporary solution:

const client = new SteamUser({
          "language": "english"
      });

client.delayMessage = function(sid, msg, type) {
    setTimeout(function() {
        client.chatMessage(sid, msg, type);
    }, 1000);
};

// Replace all "client.chatMessage" to "client.delayMessage"

 

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...