Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On success #51

Merged
merged 5 commits into from
Jun 7, 2023
Merged

On success #51

merged 5 commits into from
Jun 7, 2023

Conversation

ITz-Viks
Copy link
Contributor

@ITz-Viks ITz-Viks commented Jun 6, 2023

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

Copy link
Owner

@olijeffers0n olijeffers0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good other than one gripe

rustplus/api/remote/rustws.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@ITz-Viks ITz-Viks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added requested changes.

@ITz-Viks
Copy link
Contributor Author

ITz-Viks commented Jun 6, 2023

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

@olijeffers0n olijeffers0n self-assigned this Jun 7, 2023
@olijeffers0n olijeffers0n added the enhancement New feature or request label Jun 7, 2023
@olijeffers0n olijeffers0n merged commit 850d73d into olijeffers0n:master Jun 7, 2023
@olijeffers0n
Copy link
Owner

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants