-
-
Notifications
You must be signed in to change notification settings - Fork 481
feat: Implement better get_or_fetch #2776
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
feat from #1856 |
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
still not ready have some bug like : NameError: name 'VoiceChannel' is not defined |
@Lumabots You can import it inside of the function where you use it directly instead of importing it at the top |
Well ig the issue come from the definition for the typevar, so will that resolve it ? |
… get_or_fetch shortcut Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
should be ready for review |
just need to specify that this is breaking inside the changelog cos of modification of get_or_fetch and removal of get_or_fetch_user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little nitpicks and consistency issues with the docs. LGTM code-wise.
Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a better version of the get_or_fetch
utility function with improved type safety and error handling. The update introduces new convenience methods on Guild
and Client
classes while maintaining backward compatibility through deprecation warnings.
- Replaces string-based object type specification with type class parameters for better type safety
- Adds new
get_or_fetch
methods toGuild
andClient
classes for easier access - Maintains backward compatibility by deprecating the old string-based approach
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
discord/utils.py | Rewrites the get_or_fetch function with type-safe overloads and helper functions |
discord/guild.py | Adds get_or_fetch method and get_emoji helper method to Guild class |
discord/client.py | Adds get_or_fetch method and deprecates get_or_fetch_user |
CHANGELOG.md | Documents the new features and deprecations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See copilot comment, wtf
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Summary
Information
examples, ...).
Checklist
type: ignore
comments were used, a comment is also left explaining why.