added number formatting
This commit is contained in:
parent
6dd986ea38
commit
972406ad97
1 changed files with 18 additions and 12 deletions
|
@ -23,10 +23,11 @@ class SugonCredit(commands.Cog):
|
||||||
else:
|
else:
|
||||||
bal = await bank.get_balance(user)
|
bal = await bank.get_balance(user)
|
||||||
target = user
|
target = user
|
||||||
|
output_bal = (f'{bal:,}')
|
||||||
if bal == 1 or bal == -1:
|
if bal == 1 or bal == -1:
|
||||||
embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {bal} {currency_name}.")
|
embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {output_bal} {currency_name}.")
|
||||||
else:
|
else:
|
||||||
embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {bal} {currency_name}s.")
|
embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {output_bal} {currency_name}s.")
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@credit.command()
|
@credit.command()
|
||||||
|
@ -44,8 +45,11 @@ class SugonCredit(commands.Cog):
|
||||||
current_bal = await bank.get_balance(target)
|
current_bal = await bank.get_balance(target)
|
||||||
max_bal = await bank.get_max_balance(ctx.guild)
|
max_bal = await bank.get_max_balance(ctx.guild)
|
||||||
new_bal = current_bal + amount
|
new_bal = current_bal + amount
|
||||||
|
output_amount = (f'{val:,}')
|
||||||
|
output_new_bal = (f'{new_bal:,}')
|
||||||
|
output_max_bal = (f'{max_bal:,}')
|
||||||
if new_bal > max_bal:
|
if new_bal > max_bal:
|
||||||
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to above {max_bal}. Please try again!")
|
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to above {output_max_bal}. Please try again!")
|
||||||
return
|
return
|
||||||
elif new_bal < 0:
|
elif new_bal < 0:
|
||||||
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 0. Please try again!")
|
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 0. Please try again!")
|
||||||
|
@ -53,16 +57,16 @@ class SugonCredit(commands.Cog):
|
||||||
elif ctx.guild.id == 204965774618656769:
|
elif ctx.guild.id == 204965774618656769:
|
||||||
logging_channel = self.bot.get_channel(1082495815878189076)
|
logging_channel = self.bot.get_channel(1082495815878189076)
|
||||||
await bank.deposit_credits(target, amount=amount)
|
await bank.deposit_credits(target, amount=amount)
|
||||||
await ctx.send(content=f"{target.mention} now has {amount} more SugonCredit, with a total of {new_bal}!")
|
await ctx.send(content=f"{target.mention} now has {output_amount} more SugonCredit, with a total of {output_new_bal}!")
|
||||||
if amount == 1 or amount == -1:
|
if amount == 1 or amount == -1:
|
||||||
await target.send(content=f"You gained {amount} SugonCredit! Good work community member! You now have {new_bal} SugonCredits.")
|
await target.send(content=f"You gained {output_amount} SugonCredit! Good work community member! You now have {output_new_bal} SugonCredits.")
|
||||||
else:
|
else:
|
||||||
await target.send(content=f"You gained {amount} SugonCredits! Good work community member! You now have {new_bal} SugonCredits.")
|
await target.send(content=f"You gained {output_amount} SugonCredits! Good work community member! You now have {output_new_bal} SugonCredits.")
|
||||||
await target.send(content="https://cdn.discordapp.com/attachments/932790367043063818/1016032836576362556/social-credit-positive.png")
|
await target.send(content="https://cdn.discordapp.com/attachments/932790367043063818/1016032836576362556/social-credit-positive.png")
|
||||||
logging_embed=discord.Embed(title="SugonCredit Added", color=await self.bot.get_embed_color(None), description=f"{ctx.author.name}#{ctx.author.discriminator} ({ctx.author.id}) added {amount} SugonCredit to {target.name}#{target.discriminator} ({target.id})! They now have {new_bal} SugonCredit.")
|
logging_embed=discord.Embed(title="SugonCredit Added", color=await self.bot.get_embed_color(None), description=f"{ctx.author.name}#{ctx.author.discriminator} ({ctx.author.id}) added {amount} SugonCredit to {target.name}#{target.discriminator} ({target.id})! They now have {new_bal} SugonCredit.")
|
||||||
await logging_channel.send(embed=logging_embed)
|
await logging_channel.send(embed=logging_embed)
|
||||||
elif ctx.guild.id != 204965774618656769:
|
elif ctx.guild.id != 204965774618656769:
|
||||||
embed=discord.Embed(title=f"{bank_name} - Add", color=await self.bot.get_embed_color(None), description=f"{target.mention}'s {currency_name} balance has been increased by {amount}.\nCurrent balance is {new_bal}.")
|
embed=discord.Embed(title=f"{bank_name} - Add", color=await self.bot.get_embed_color(None), description=f"{target.mention}'s {currency_name} balance has been increased by {output_amount}.\nCurrent balance is {output_new_bal}.")
|
||||||
await bank.deposit_credits(target, amount=amount)
|
await bank.deposit_credits(target, amount=amount)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
@ -80,21 +84,23 @@ class SugonCredit(commands.Cog):
|
||||||
currency_name = await bank.get_currency_name(ctx.guild)
|
currency_name = await bank.get_currency_name(ctx.guild)
|
||||||
current_bal = await bank.get_balance(target)
|
current_bal = await bank.get_balance(target)
|
||||||
new_bal = current_bal - amount
|
new_bal = current_bal - amount
|
||||||
|
output_amount = (f'{val:,}')
|
||||||
|
output_new_bal = (f'{new_bal:,}')
|
||||||
if new_bal < 0:
|
if new_bal < 0:
|
||||||
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 0. Please try again!")
|
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 0. Please try again!")
|
||||||
return
|
return
|
||||||
elif ctx.guild.id == 204965774618656769:
|
elif ctx.guild.id == 204965774618656769:
|
||||||
await bank.withdraw_credits(target, amount=amount)
|
await bank.withdraw_credits(target, amount=amount)
|
||||||
logging_channel = self.bot.get_channel(1082495815878189076)
|
logging_channel = self.bot.get_channel(1082495815878189076)
|
||||||
await ctx.send(content=f"{target.mention} now has {amount} less SugonCredit, with a total of {new_bal}!\nIf this is a punishment, do better Galaxy Player! Re-education mods will be sent to your DM's if your SugonCredit drops to a substantially low amount!")
|
await ctx.send(content=f"{target.mention} now has {output_amount} less SugonCredit, with a total of {output_new_bal}!\nIf this is a punishment, do better Galaxy Player! Re-education mods will be sent to your DM's if your SugonCredit drops to a substantially low amount!")
|
||||||
if amount == 1 or amount == -1:
|
if amount == 1 or amount == -1:
|
||||||
await target.send(content=f"__MESSAGE FROM THE MINISTRY OF THE MEGA BASE__\n\n(我们的) {amount} SugonCredit has been taken from your account. Citizen, do not continue to preform bad actions! Glory to the Galaxy Communist Party!")
|
await target.send(content=f"__MESSAGE FROM THE MINISTRY OF THE MEGA BASE__\n\n(我们的) {output_amount} SugonCredit has been taken from your account. Citizen, do not continue to preform bad actions! Glory to the Galaxy Communist Party!")
|
||||||
else:
|
else:
|
||||||
await target.send(content=f"__MESSAGE FROM THE MINISTRY OF THE MEGA BASE__\n\n(我们的) {amount} SugonCredits have been taken from your account. Citizen, do not continue to preform bad actions! Glory to the Galaxy Communist Party!")
|
await target.send(content=f"__MESSAGE FROM THE MINISTRY OF THE MEGA BASE__\n\n(我们的) {output_amount} SugonCredits have been taken from your account. Citizen, do not continue to preform bad actions! Glory to the Galaxy Communist Party!")
|
||||||
await target.send(content="https://cdn.discordapp.com/attachments/408777890222571530/909534123004133497/MEGA_BASE.mp4")
|
await target.send(content="https://cdn.discordapp.com/attachments/408777890222571530/909534123004133497/MEGA_BASE.mp4")
|
||||||
logging_embed=discord.Embed(title="SugonCredit Removed", color=await self.bot.get_embed_color(None), description=f"{ctx.author.name}#{ctx.author.discriminator} ({ctx.author.id}) removed {amount} SugonCredit from {target.name}#{target.discriminator} ({target.id})! They now have {new_bal} SugonCredit.")
|
logging_embed=discord.Embed(title="SugonCredit Removed", color=await self.bot.get_embed_color(None), description=f"{ctx.author.name}#{ctx.author.discriminator} ({ctx.author.id}) removed {output_amount} SugonCredit from {target.name}#{target.discriminator} ({target.id})! They now have {output_new_bal} SugonCredit.")
|
||||||
await logging_channel.send(embed=logging_embed)
|
await logging_channel.send(embed=logging_embed)
|
||||||
elif ctx.guild.id != 204965774618656769:
|
elif ctx.guild.id != 204965774618656769:
|
||||||
embed=discord.Embed(title=f"{bank_name} - Remove", color=await self.bot.get_embed_color(None), description=f"{target.mention}'s {currency_name} balance has been decreased by {amount}.\nCurrent balance is {new_bal}.")
|
embed=discord.Embed(title=f"{bank_name} - Remove", color=await self.bot.get_embed_color(None), description=f"{target.mention}'s {currency_name} balance has been decreased by {output_amount}.\nCurrent balance is {output_new_bal}.")
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
await bank.withdraw_credits(target, amount=val)
|
await bank.withdraw_credits(target, amount=val)
|
Loading…
Reference in a new issue