Formating added to Economyset

A small quality of life change... It would be nice if we can make the code not like like it comes from 2002 ;)
This commit is contained in:
Kowlin
2016-04-04 07:55:02 +02:00
parent 203b3b5a1a
commit 255842d3e6

View File

@@ -108,7 +108,7 @@ class Economy:
if self.account_check(id): if self.account_check(id):
if id in self.payday_register: if id in self.payday_register:
seconds = abs(self.payday_register[id] - int(time.perf_counter())) seconds = abs(self.payday_register[id] - int(time.perf_counter()))
if seconds >= self.settings["PAYDAY_TIME"]: if seconds >= self.settings["PAYDAY_TIME"]:
self.add_money(id, self.settings["PAYDAY_CREDITS"]) self.add_money(id, self.settings["PAYDAY_CREDITS"])
self.payday_register[id] = int(time.perf_counter()) self.payday_register[id] = int(time.perf_counter())
await self.bot.say("{} Here, take some credits. Enjoy! (+{} credits!)".format(author.mention, str(self.settings["PAYDAY_CREDITS"]))) await self.bot.say("{} Here, take some credits. Enjoy! (+{} credits!)".format(author.mention, str(self.settings["PAYDAY_CREDITS"])))
@@ -213,10 +213,10 @@ class Economy:
async def economyset(self, ctx): async def economyset(self, ctx):
"""Changes economy module settings""" """Changes economy module settings"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
msg = "" msg = "```"
for k, v in self.settings.items(): for k, v in self.settings.items():
msg += str(k) + ": " + str(v) + "\n" msg += str(k) + ": " + str(v) + "\n"
msg += "\nType help economyset to see the list of commands." msg += "\nType help {}economyset to see the list of commands.```".format(ctx.prefix)
await self.bot.say(msg) await self.bot.say(msg)
@economyset.command() @economyset.command()
@@ -286,7 +286,7 @@ class Economy:
return False return False
def set_money(self, id, amount): def set_money(self, id, amount):
if self.account_check(id): if self.account_check(id):
self.bank[id]["balance"] = amount self.bank[id]["balance"] = amount
fileIO("data/economy/bank.json", "save", self.bank) fileIO("data/economy/bank.json", "save", self.bank)
return True return True
@@ -301,7 +301,7 @@ class Economy:
('minutes', 60), ('minutes', 60),
('seconds', 1), ('seconds', 1),
) )
result = [] result = []
for name, count in intervals: for name, count in intervals:
@@ -341,4 +341,4 @@ def setup(bot):
handler = logging.FileHandler(filename='data/economy/economy.log', encoding='utf-8', mode='a') handler = logging.FileHandler(filename='data/economy/economy.log', encoding='utf-8', mode='a')
handler.setFormatter(logging.Formatter('%(asctime)s %(message)s', datefmt="[%d/%m/%Y %H:%M]")) handler.setFormatter(logging.Formatter('%(asctime)s %(message)s', datefmt="[%d/%m/%Y %H:%M]"))
logger.addHandler(handler) logger.addHandler(handler)
bot.add_cog(Economy(bot)) bot.add_cog(Economy(bot))