From 03fc4cadff80a1ebadf0c486de0b09d31cb5b0ba Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 3 Feb 2020 16:41:30 +0100 Subject: [PATCH] Added gridlines to graph --- api/carbon.py | 1 + cogs/fun/logger.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/carbon.py b/api/carbon.py index 0f4053e..4ccd697 100644 --- a/api/carbon.py +++ b/api/carbon.py @@ -75,6 +75,7 @@ def level_from_to(start: str, stop: str) -> str: plt.ylabel("Carbon Intensity [gCO2/kWh]") plt.xticks(rotation=45) plt.gcf().subplots_adjust(bottom=0.2) + plt.grid(b=True) plt.savefig("plot.png") plt.clf() return "plot.png" \ No newline at end of file diff --git a/cogs/fun/logger.py b/cogs/fun/logger.py index 80d59e3..a935214 100644 --- a/cogs/fun/logger.py +++ b/cogs/fun/logger.py @@ -1,9 +1,14 @@ import discord from discord.ext import commands +import re +from datetime import datetime class Logger(commands.Cog): def __init__(self, client): self.client = client + self.first = True + self.last_update = datetime.now() + self.most_common = [] @commands.Cog.listener() async def on_message(self, message): @@ -18,6 +23,7 @@ class Logger(commands.Cog): with open('data/naughty_step.txt', 'a') as file: file.write(message.content + '\n') - + + def setup(client): client.add_cog(Logger(client))