mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[V3 Economy] Update from config changes (#1084)
This commit is contained in:
parent
89981f46b0
commit
1b6065bb46
@ -224,7 +224,7 @@ class Economy:
|
|||||||
user = ctx.author
|
user = ctx.author
|
||||||
else:
|
else:
|
||||||
user = ctx.guild.owner
|
user = ctx.guild.owner
|
||||||
success = await bank.wipe_bank(user)
|
success = await bank.wipe_bank()
|
||||||
if success:
|
if success:
|
||||||
await ctx.send(_("All bank accounts of this guild have been "
|
await ctx.send(_("All bank accounts of this guild have been "
|
||||||
"deleted."))
|
"deleted."))
|
||||||
@ -287,7 +287,7 @@ class Economy:
|
|||||||
if top < 1:
|
if top < 1:
|
||||||
top = 10
|
top = 10
|
||||||
if await bank.is_global():
|
if await bank.is_global():
|
||||||
bank_sorted = sorted(await bank.get_global_accounts(ctx.author),
|
bank_sorted = sorted(await bank.get_global_accounts(),
|
||||||
key=lambda x: x.balance, reverse=True)
|
key=lambda x: x.balance, reverse=True)
|
||||||
else:
|
else:
|
||||||
bank_sorted = sorted(await bank.get_guild_accounts(guild),
|
bank_sorted = sorted(await bank.get_guild_accounts(guild),
|
||||||
|
|||||||
@ -279,24 +279,12 @@ async def transfer_credits(from_: discord.Member, to: discord.Member, amount: in
|
|||||||
return await deposit_credits(to, amount)
|
return await deposit_credits(to, amount)
|
||||||
|
|
||||||
|
|
||||||
async def wipe_bank(user: Union[discord.User, discord.Member]):
|
async def wipe_bank():
|
||||||
"""Delete all accounts from the bank.
|
"""Delete all accounts from the bank."""
|
||||||
|
|
||||||
.. important::
|
|
||||||
|
|
||||||
A member is required if the bank is currently guild specific.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
user : `discord.User` or `discord.Member`
|
|
||||||
A user to be used in clearing the bank, this is required for technical
|
|
||||||
reasons and it does not matter which user/member is used.
|
|
||||||
|
|
||||||
"""
|
|
||||||
if await is_global():
|
if await is_global():
|
||||||
await _conf.user(user).clear()
|
await _conf.clear_all_users()
|
||||||
else:
|
else:
|
||||||
await _conf.member(user).clear()
|
await _conf.clear_all_members()
|
||||||
|
|
||||||
|
|
||||||
async def get_guild_accounts(guild: discord.Guild) -> List[Account]:
|
async def get_guild_accounts(guild: discord.Guild) -> List[Account]:
|
||||||
@ -330,14 +318,9 @@ async def get_guild_accounts(guild: discord.Guild) -> List[Account]:
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
async def get_global_accounts(user: discord.User) -> List[Account]:
|
async def get_global_accounts() -> List[Account]:
|
||||||
"""Get all global account data.
|
"""Get all global account data.
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
user : discord.User
|
|
||||||
A user to be used for getting accounts.
|
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
`list` of `Account`
|
`list` of `Account`
|
||||||
@ -409,7 +392,7 @@ async def is_global() -> bool:
|
|||||||
return await _conf.is_global()
|
return await _conf.is_global()
|
||||||
|
|
||||||
|
|
||||||
async def set_global(global_: bool, user: Union[discord.User, discord.Member]) -> bool:
|
async def set_global(global_: bool) -> bool:
|
||||||
"""Set global status of the bank.
|
"""Set global status of the bank.
|
||||||
|
|
||||||
.. important::
|
.. important::
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user