mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Change order of config calls in the Economy cog to only execute them when necessary.
* Merge pull request #5002
This commit is contained in:
parent
31cb4c0604
commit
a58ac7cd2e
@ -90,7 +90,7 @@ def guild_only_check():
|
|||||||
async def pred(ctx: commands.Context):
|
async def pred(ctx: commands.Context):
|
||||||
if await bank.is_global():
|
if await bank.is_global():
|
||||||
return True
|
return True
|
||||||
elif not await bank.is_global() and ctx.guild is not None:
|
elif ctx.guild is not None and not await bank.is_global():
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
@ -415,8 +415,7 @@ class Economy(commands.Cog):
|
|||||||
- `<user>` The user to delete the bank of. Takes mentions, names, and user ids.
|
- `<user>` The user to delete the bank of. Takes mentions, names, and user ids.
|
||||||
- `<confirmation>` This will default to false unless specified.
|
- `<confirmation>` This will default to false unless specified.
|
||||||
"""
|
"""
|
||||||
global_bank = await bank.is_global()
|
if ctx.guild is None and not await bank.is_global():
|
||||||
if global_bank is False and ctx.guild is None:
|
|
||||||
return await ctx.send(_("This command cannot be used in DMs with a local bank."))
|
return await ctx.send(_("This command cannot be used in DMs with a local bank."))
|
||||||
try:
|
try:
|
||||||
name = member_or_id.display_name
|
name = member_or_id.display_name
|
||||||
@ -580,7 +579,7 @@ class Economy(commands.Cog):
|
|||||||
top = 10
|
top = 10
|
||||||
|
|
||||||
base_embed = discord.Embed(title=_("Economy Leaderboard"))
|
base_embed = discord.Embed(title=_("Economy Leaderboard"))
|
||||||
if await bank.is_global() and show_global:
|
if show_global and await bank.is_global():
|
||||||
# show_global is only applicable if bank is global
|
# show_global is only applicable if bank is global
|
||||||
bank_sorted = await bank.get_leaderboard(positions=top, guild=None)
|
bank_sorted = await bank.get_leaderboard(positions=top, guild=None)
|
||||||
base_embed.set_author(name=ctx.bot.user.name, icon_url=ctx.bot.user.avatar_url)
|
base_embed.set_author(name=ctx.bot.user.name, icon_url=ctx.bot.user.avatar_url)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user