From 891b79d0df8df4c99c1060e24f2d1a9b59417d3d Mon Sep 17 00:00:00 2001 From: Matthias Nadler Date: Sun, 14 Apr 2019 01:09:11 +0200 Subject: [PATCH] Fixed exporting weights for users that left the server and reduced debug output --- cogs/poll.py | 2 +- essentials/messagecache.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cogs/poll.py b/cogs/poll.py index e49b205..eacb541 100644 --- a/cogs/poll.py +++ b/cogs/poll.py @@ -796,7 +796,7 @@ class Poll: if not name: name = member.name export += f'\n{name}' - if self.votes[str(member.id)]['weight'] != 1: + if self.votes[str(user_id)]['weight'] != 1: export += f' (weight: {self.votes[str(user_id)]["weight"]})' export += ': ' + ', '.join([self.options_reaction[c] for c in self.votes[str(user_id)]['choices']]) export += '\n' diff --git a/essentials/messagecache.py b/essentials/messagecache.py index c4ed282..92b017e 100644 --- a/essentials/messagecache.py +++ b/essentials/messagecache.py @@ -1,5 +1,8 @@ +import logging import discord +logger = logging.getLogger('bot') + class MessageCache: def __init__(self, _bot): @@ -8,7 +11,8 @@ class MessageCache: def put(self, key, value: discord.Message): self._cache_dict[key] = value - print("cache size:", self._cache_dict.__len__()) + if self._cache_dict.__len__() % 5 == 0: + logger.info("cache size:", self._cache_dict.__len__()) def get(self, key): # Try to find it in this cache, then see if it is cached in the bots own message cache