Lekuruu / osu.py

A python library that emulates the osu! stable client
MIT License
10 stars 1 forks source link

Events seems to not fire after a few reconnects #2

Closed kanaarima closed 1 year ago

kanaarima commented 1 year ago

I'm not sure if this only applies to send message packets (so maybe its not joining channels), after a few disconnects (due to server crashing, no "bancho is restarting" messages), once it succeeds to connect it won't fire send messages event anymore. Server is akatsuki.gg using a bot account (which is just a regular one basically), osu.py (version 1.1.2) is running under debian 11 and python 3.9.2 (from debian repo)

Lekuruu commented 1 year ago

Seems like I messed something up with re-initializing the client. The easiest thing would of course be to just exit, if the server connection failed.

Do you still have logs of that happening?

Lekuruu commented 1 year ago

Oh nvm. I maybe already know whats going on here...

As you may know, the game.run() function has a retry argument, which re-initializes the client:

    def run(self, retry=False) -> None:
        if retry:
            # Reinitialize game
            self.__init__(
                self.username,
                self.password,
                self.server,
                self.stream,
                self.version_number,
                self.tourney,
            )

The only problem is that the events get re-initialized as well, meaning that they will just be cleared if you restart. Thank you for reporting this issue!

Lekuruu commented 1 year ago

Let's hope this works :D