Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.82k stars 2.3k forks source link

Bank API should support discord.Object when getting Balance #4391

Open TrustyJAID opened 4 years ago

TrustyJAID commented 4 years ago

Feature request

Select the type of feature you are requesting:

Describe your requested feature

Cores Bank API should accept discord.Object since we cannot always ensure that it's safe to acquire a full user/member object when accessing things as trivial as an economy balance.

Stonedestroyer commented 4 years ago

I will be doing this in the upcoming days.

goettner commented 3 years ago

I'd like to take a look at this issue, but I'm not totally sure how to go about accepting a discord.Object as a parameter for balance() in economy.py instead of a Member. Would it be a decent solution to extract User.id, and pass this along to bank.get_balance() instead (which could possible be used in other calls, like transfer()), or am I missing something there? Thanks!

Drapersniper commented 3 years ago

The ideas is you'd accept either a member object, user object or discord object, which all 3 have the .id attribute.

Essentially extracting that attribute in the method it self when the id is needed (for config calls)

goettner commented 3 years ago

Okay, I understand, I'll take a crack at it. Thanks for the clarification