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

feat(ext.bridge): add bridge.Context as a Union class #2106

Merged
merged 11 commits into from
Jun 11, 2023

Conversation

OmLanke
Copy link
Contributor

@OmLanke OmLanke commented Jun 8, 2023

Summary

Adds a shortcut Union class for BridgeExtContext, and BridgeApplicationContext.
Since bridge.BridgeContext is an ABC, using that as a typehint doesn't display the attributes and methods available.

Current Workaround

Using the long form everywhere

@bot.bridge_command()
async def ping(ctx: bridge.BridgeExtContext | bridge.BridgeApplicationContext):
  ...

Desired Solution

Using the Union class

@bot.bridge_command()
async def ping(ctx: bridge.Context):
  ...

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@OmLanke OmLanke requested a review from a team as a code owner June 8, 2023 21:50
Lulalaby
Lulalaby previously approved these changes Jun 9, 2023
docs/ext/bridge/api.rst Outdated Show resolved Hide resolved
@Lulalaby Lulalaby merged commit 50281e6 into Pycord-Development:master Jun 11, 2023
@OmLanke OmLanke deleted the bridge-context-union branch June 23, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants