[V3 Bank] Add confirmation prompt on [p]bankset toggleglobal (#1402)

This commit is contained in:
palmtree5 2018-03-12 15:05:21 -08:00 committed by Will
parent 5bdb455bc0
commit 4fcf32b5e9

View File

@ -58,15 +58,22 @@ class Bank:
@bankset.command(name="toggleglobal")
@checks.is_owner()
async def bankset_toggleglobal(self, ctx: commands.Context):
async def bankset_toggleglobal(self, ctx: commands.Context, confirm: bool=False):
"""Toggles whether the bank is global or not
If the bank is global, it will become per-guild
If the bank is per-guild, it will become global"""
cur_setting = await bank.is_global()
await bank.set_global(not cur_setting)
word = _("per-guild") if cur_setting else _("global")
if confirm is False:
await ctx.send(
_("This will toggle the bank to be {}, deleting all accounts "
"in the process! If you're sure, type `{}`").format(
word, "{}bankset toggleglobal yes".format(ctx.prefix)
)
)
else:
await bank.set_global(not cur_setting)
await ctx.send(_("The bank is now {}.").format(word))
@bankset.command(name="bankname")