olijeffers0n / rustplus

Rust+ API Wrapper Written in Python for the Game: Rust
https://rplus.ollieee.xyz/
MIT License
102 stars 28 forks source link

On success #51

Closed ITz-Viks closed 1 year ago

ITz-Viks commented 1 year ago

This adds an optional on_success parameter that takes a function or a coroutine, to RustWebSocket, RustRemote and BaseRustSocket.

The provided function or a coroutine will be executed when the connection has been successfully established.

To explain this code:

try:
  self.on_success()
except TypeError:
  pass

The try and except is used to prevent a TypeError NoneType is not callable error. This occurs when the user doesn't provide any on_success function

ITz-Viks commented 1 year ago

I think I did it lol i'm not sure how to use the UI for revisions

olijeffers0n commented 1 year ago

Thanks