mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Add a way to reset rolepayday amounts (#4758)
* Add a way to reset rolepayday amounts * Totally not fixing a typo... * Jack found a Typo Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> * Max line length Compliancy Thanks Jack (again lol) Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> * Including rolepaydayamount changes in docs Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
parent
e24379973c
commit
d6de9c1b94
@ -352,7 +352,7 @@ economyset rolepaydayamount
|
||||
|
||||
**Description**
|
||||
|
||||
Set the amount earned each payday for a role.
|
||||
Set the amount earned each payday for a role. Setting to 0 will remove the custom payday for that role instead.
|
||||
|
||||
Only available when not using a global bank.
|
||||
|
||||
|
||||
@ -976,6 +976,7 @@ class Economy(commands.Cog):
|
||||
@economyset.command()
|
||||
async def rolepaydayamount(self, ctx: commands.Context, role: discord.Role, creds: int):
|
||||
"""Set the amount earned each payday for a role.
|
||||
Set to `0` to remove the payday amount you set for that role.
|
||||
|
||||
Only available when not using a global bank.
|
||||
|
||||
@ -989,22 +990,36 @@ class Economy(commands.Cog):
|
||||
"""
|
||||
guild = ctx.guild
|
||||
max_balance = await bank.get_max_balance(ctx.guild)
|
||||
if creds <= 0 or creds > max_balance:
|
||||
if creds >= max_balance:
|
||||
return await ctx.send(
|
||||
_("Amount must be greater than zero and less than {maxbal}.").format(
|
||||
maxbal=humanize_number(max_balance)
|
||||
)
|
||||
_(
|
||||
"The bank requires that you set the payday to be less than"
|
||||
" its maximum balance of {maxbal}."
|
||||
).format(maxbal=humanize_number(max_balance))
|
||||
)
|
||||
credits_name = await bank.get_currency_name(guild)
|
||||
if await bank.is_global():
|
||||
await ctx.send(_("The bank must be per-server for per-role paydays to work."))
|
||||
else:
|
||||
if creds <= 0: # Because I may as well...
|
||||
default_creds = await self.config.guild(guild).PAYDAY_CREDITS()
|
||||
await self.config.role(role).clear()
|
||||
await ctx.send(
|
||||
_(
|
||||
"The payday value attached to role has been removed. "
|
||||
"Users with this role will now receive the default pay "
|
||||
"of {num} {currency}."
|
||||
).format(num=humanize_number(default_creds), currency=credits_name)
|
||||
)
|
||||
else:
|
||||
await self.config.role(role).PAYDAY_CREDITS.set(creds)
|
||||
await ctx.send(
|
||||
_(
|
||||
"Every payday will now give {num} {currency} "
|
||||
"to people with the role {role_name}."
|
||||
).format(num=humanize_number(creds), currency=credits_name, role_name=role.name)
|
||||
).format(
|
||||
num=humanize_number(creds), currency=credits_name, role_name=role.name
|
||||
)
|
||||
)
|
||||
|
||||
@economyset.command()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user