Optimize config calls in few places (#3766)

* Just a tiny PR improving config call in a lot of places (Specially events and Help)

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* missed this one

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Draper
2020-04-20 18:29:36 +01:00
committed by GitHub
parent e4018ec677
commit f59e77002b
7 changed files with 153 additions and 116 deletions

View File

@@ -48,15 +48,16 @@ class Bank(commands.Cog):
"""Base command for bank settings."""
if ctx.invoked_subcommand is None:
if await bank.is_global():
bank_name = await bank._config.bank_name()
currency_name = await bank._config.currency()
default_balance = await bank._config.default_balance()
group = bank._config
else:
if not ctx.guild:
return
bank_name = await bank._config.guild(ctx.guild).bank_name()
currency_name = await bank._config.guild(ctx.guild).currency()
default_balance = await bank._config.guild(ctx.guild).default_balance()
group = bank._config.guild(ctx.guild)
group_data = await group.all()
bank_name = group_data["bank_name"]
currency_name = group_data["currency"]
default_balance = group_data["default_balance"]
max_balance = group_data["max_balance"]
settings = _(
"Bank settings:\n\nBank name: {bank_name}\nCurrency: {currency_name}\n"
@@ -65,7 +66,7 @@ class Bank(commands.Cog):
bank_name=bank_name,
currency_name=currency_name,
default_balance=humanize_number(default_balance),
maximum_bal=humanize_number(await bank.get_max_balance(ctx.guild)),
maximum_bal=humanize_number(max_balance),
)
await ctx.send(box(settings))