-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Bank] Add discord.Object support to bank.get_balance #4654
base: V3/develop
Are you sure you want to change the base?
[Bank] Add discord.Object support to bank.get_balance #4654
Conversation
You've misunderstood my last statement I think, discord objects only have the The remaining bank apis should also accept the discord.Object input. |
… member variables
Pushed some changes based on your feedback, let me know what you think. |
@@ -620,12 +630,12 @@ async def get_account(member: Union[discord.Member, discord.User, discord.Object | |||
else: | |||
all_accounts = await _config.all_members(member.guild) |
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.
This line will and should fail error with discord.Object
. Even if it were to succeed with Object
, get_default_balance
below would throw a runtime error
Type
Description of the changes
As detailed in #4391, much of the Core Bank API functions only accepted discord.Member or discord.User input types for routine functions such as get_balance(). This is problematic, given the unnecessary and possibly sensitive information that is included with a Member or User object. This can be improved by changing the calls' input types to enable passing it a discord.Object instead, in order to prevent sensitive information being unnecessarily acquired.
I also added test cases to tests/cogs/test_economy.py, in order to test the ability of these API calls to function correctly with a discord.Object as input, and the necessary infrastructure in pytest/core.py