Python API: disconnect event request


I am currently facing the following issue. One of my scripts gets triggered by the EVENT_TRANSPORT_DIED event of the handle_event(t, data) method.
It seems to me, that the EVENT_TRANSPORT_DIED is also sent, if a character becomes disconnected. So the result is, that my script is calling inject_packet several times until the bot manager closes the phBot. Of cause I would love to try avoiding sending weird packets while being disconnected.

So my first question: Is the bot actually sending packets to the server if the inject_packet method is called while being disconnected?
If it does send packets, is there currently any way to figure out within a plugin, if the bot becomes disconnected? So far I didn´t find an event in the API.
If there is currently no event, could you please add a disconnect event method to the API?


1 Like

Sorry that I bump it, but anyone knows if there is a way to figure out in a plugin, whether I am connected or not?

Like checking any other network connection, using the ping.

GLOBAL_PING = 0x2002

The ping is never sent on clientless mode and using the packet traffic is not a realiable method.

This should be added. :thinking: