Bots stop getting the chat messages

it’s a weird one. I hacked the coin bot from sticks and the existing dart library. It’s known good because the librarian and scam both run on it and they had no issues for a while now.

At some point, the bot stops getting any messages. It will get various other events:

i.e. it will get model changes pretty reliably. Pings work just fine. But there won’t be any messaging coming through to the bot:

NB: the bot is parked in the park so there’s always some activity in there.

It’s pretty damn weird because there are no reconnects over the websocket, so I expect it’s something on your side, @Accipiter? restarting it clearly helps.

1 Like

I tentatively wonder if it can have anything to do with the player putting it to sleep, waking it up as a PC, sleeping, and re-waking as a bot.

1 Like

Hmmm.
Hmm hmmm…

Yes, either the client isn’t subscribing properly, or the server isn’t eventing (totally a verb) properly.

So, if you’ve called getBot and gotten the bot model back:

Resource ID: core.bot.<CHAR_ID>

{
    char: { ... }, // core.char.<CHAR_ID>.owned
    controlled: { ... }, // core.char.<CHAR_ID>.ctrl
}

… and if that controlled property contains the controlled char model rather than null, and you also get change events on that controlled-model when you eg. change room, or gender, or something, then it is probably the server not eventing properly.

But restarting helps?

If restarting works, what does the script do during restart? Nothing? Just reconnects and calls getBot again? or does it attempt to control/wake up the character again or something?

Since if it just directly calls getBot, and suddenly you get events, then it sounds like your client wasn’t subscribing correctly. Neither reconnecting nor calling getBot changes any state at all on the server. The server isn’t even aware of reconnects. And getBot simply just returns a reference to the bot model using the bot character ID provided in the token.

1 Like

Restarting kills the bot and does a full reconnect loop (set up the wss connection and auth and get the bot).

1 Like

kills the bot

In what way? Do you do a release or sleep prior to shutting down?

The wss disconnect, reconnect, auth request, and getBot call has no effect on the core service sending the chat events.

1 Like

It just abruptly (heh) closes the websocket and does

  • auth.authenticateBot
  • core.getBot
  • subscribe core.chars.awake
  • $botrid.controlChar (if needed)
  • $ctrlrid.wakeup (if needed)

when it starts up the next time.

1 Like

Yeah, that sounds pretty normal.

Is it possible to get some raw WebSocket logs from the client (incoming & outgoing JSON messages) of when the issue occurs? I could look through them and see if I can spot anything unexpected.

1 Like

Derp, the logs rotated over. I’ll see if I can repro it again.

2 Likes