Merge pull request #117 from Kowlin/economy

Added formating to Economy
This commit is contained in:
Twentysix 2016-04-04 20:30:46 +02:00
commit 38881cf71d
2 changed files with 7 additions and 7 deletions

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))

View File

@ -316,4 +316,4 @@ class NewPoll():
def setup(bot): def setup(bot):
n = General(bot) n = General(bot)
bot.add_listener(n.check_poll_votes, "on_message") bot.add_listener(n.check_poll_votes, "on_message")
bot.add_cog(n) bot.add_cog(n)